app.js 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339
  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/views/App.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/views/App.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. //
  1598. //
  1599. //
  1600. //
  1601. //
  1602. //
  1603. //
  1604. //
  1605. //
  1606. //
  1607. //
  1608. //
  1609. //
  1610. //
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. /* harmony default export */ __webpack_exports__["default"] = ({
  1653. data: function data() {
  1654. return {
  1655. isLoggedIn: null,
  1656. username: null
  1657. };
  1658. },
  1659. mounted: function mounted() {
  1660. this.isLoggedIn = localStorage.getItem('jwt');
  1661. this.username = localStorage.getItem('user');
  1662. }
  1663. });
  1664. /***/ }),
  1665. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  1666. /*!***************************************************************************************************************************************************************!*\
  1667. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  1668. \***************************************************************************************************************************************************************/
  1669. /*! exports provided: default */
  1670. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1671. "use strict";
  1672. __webpack_require__.r(__webpack_exports__);
  1673. //
  1674. //
  1675. //
  1676. //
  1677. //
  1678. //
  1679. //
  1680. //
  1681. //
  1682. //
  1683. //
  1684. //
  1685. //
  1686. //
  1687. //
  1688. //
  1689. //
  1690. //
  1691. //
  1692. //
  1693. //
  1694. //
  1695. //
  1696. /* harmony default export */ __webpack_exports__["default"] = ({
  1697. data: function data() {
  1698. return {
  1699. workOrders: []
  1700. };
  1701. },
  1702. mounted: function mounted() {
  1703. var _this = this;
  1704. var token = localStorage.getItem('jwt');
  1705. var user = localStorage.getItem('user');
  1706. axios.defaults.headers.common['Content-Type'] = 'application/json';
  1707. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  1708. axios.get('api/users/' + user + '/workorders').then(function (response) {
  1709. _this.workOrders = response.data;
  1710. })["catch"](function (error) {
  1711. console.log(error);
  1712. });
  1713. },
  1714. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  1715. if (!localStorage.getItem('jwt')) {
  1716. return next('login');
  1717. }
  1718. next();
  1719. }
  1720. });
  1721. /***/ }),
  1722. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  1723. /*!***********************************************************************************************************************************************************!*\
  1724. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  1725. \***********************************************************************************************************************************************************/
  1726. /*! exports provided: default */
  1727. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1728. "use strict";
  1729. __webpack_require__.r(__webpack_exports__);
  1730. //
  1731. //
  1732. //
  1733. //
  1734. //
  1735. //
  1736. //
  1737. //
  1738. //
  1739. //
  1740. //
  1741. //
  1742. //
  1743. //
  1744. //
  1745. //
  1746. //
  1747. //
  1748. //
  1749. //
  1750. //
  1751. //
  1752. //
  1753. //
  1754. //
  1755. //
  1756. //
  1757. //
  1758. //
  1759. //
  1760. //
  1761. //
  1762. //
  1763. //
  1764. //
  1765. //
  1766. //
  1767. //
  1768. //
  1769. /* harmony default export */ __webpack_exports__["default"] = ({
  1770. data: function data() {
  1771. return {
  1772. username: "",
  1773. password: ""
  1774. };
  1775. },
  1776. methods: {
  1777. handleSubmit: function handleSubmit(e) {
  1778. var _this = this;
  1779. e.preventDefault();
  1780. if (this.password.length > 0) {
  1781. axios.post('api/login', {
  1782. username: this.username,
  1783. password: this.password
  1784. }).then(function (response) {
  1785. localStorage.setItem('user', response.data.success.username);
  1786. localStorage.setItem('jwt', response.data.success.token);
  1787. if (localStorage.getItem('jwt') != null) {
  1788. _this.$router.go('/dashboard');
  1789. }
  1790. })["catch"](function (error) {
  1791. console.error(error);
  1792. });
  1793. }
  1794. }
  1795. },
  1796. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  1797. if (localStorage.getItem('jwt')) {
  1798. return next('board');
  1799. }
  1800. next();
  1801. }
  1802. });
  1803. /***/ }),
  1804. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  1805. /*!*************************************************************************************************************************************************************!*\
  1806. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  1807. \*************************************************************************************************************************************************************/
  1808. /*! exports provided: default */
  1809. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1810. "use strict";
  1811. __webpack_require__.r(__webpack_exports__);
  1812. //
  1813. //
  1814. //
  1815. //
  1816. //
  1817. //
  1818. //
  1819. //
  1820. //
  1821. //
  1822. //
  1823. //
  1824. //
  1825. //
  1826. //
  1827. //
  1828. //
  1829. //
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. //
  1856. //
  1857. //
  1858. //
  1859. //
  1860. //
  1861. //
  1862. //
  1863. /* harmony default export */ __webpack_exports__["default"] = ({});
  1864. /***/ }),
  1865. /***/ "./node_modules/base64-js/index.js":
  1866. /*!*****************************************!*\
  1867. !*** ./node_modules/base64-js/index.js ***!
  1868. \*****************************************/
  1869. /*! no static exports found */
  1870. /***/ (function(module, exports, __webpack_require__) {
  1871. "use strict";
  1872. exports.byteLength = byteLength
  1873. exports.toByteArray = toByteArray
  1874. exports.fromByteArray = fromByteArray
  1875. var lookup = []
  1876. var revLookup = []
  1877. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  1878. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  1879. for (var i = 0, len = code.length; i < len; ++i) {
  1880. lookup[i] = code[i]
  1881. revLookup[code.charCodeAt(i)] = i
  1882. }
  1883. // Support decoding URL-safe base64 strings, as Node.js does.
  1884. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  1885. revLookup['-'.charCodeAt(0)] = 62
  1886. revLookup['_'.charCodeAt(0)] = 63
  1887. function getLens (b64) {
  1888. var len = b64.length
  1889. if (len % 4 > 0) {
  1890. throw new Error('Invalid string. Length must be a multiple of 4')
  1891. }
  1892. // Trim off extra bytes after placeholder bytes are found
  1893. // See: https://github.com/beatgammit/base64-js/issues/42
  1894. var validLen = b64.indexOf('=')
  1895. if (validLen === -1) validLen = len
  1896. var placeHoldersLen = validLen === len
  1897. ? 0
  1898. : 4 - (validLen % 4)
  1899. return [validLen, placeHoldersLen]
  1900. }
  1901. // base64 is 4/3 + up to two characters of the original data
  1902. function byteLength (b64) {
  1903. var lens = getLens(b64)
  1904. var validLen = lens[0]
  1905. var placeHoldersLen = lens[1]
  1906. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1907. }
  1908. function _byteLength (b64, validLen, placeHoldersLen) {
  1909. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1910. }
  1911. function toByteArray (b64) {
  1912. var tmp
  1913. var lens = getLens(b64)
  1914. var validLen = lens[0]
  1915. var placeHoldersLen = lens[1]
  1916. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  1917. var curByte = 0
  1918. // if there are placeholders, only get up to the last complete 4 chars
  1919. var len = placeHoldersLen > 0
  1920. ? validLen - 4
  1921. : validLen
  1922. var i
  1923. for (i = 0; i < len; i += 4) {
  1924. tmp =
  1925. (revLookup[b64.charCodeAt(i)] << 18) |
  1926. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  1927. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  1928. revLookup[b64.charCodeAt(i + 3)]
  1929. arr[curByte++] = (tmp >> 16) & 0xFF
  1930. arr[curByte++] = (tmp >> 8) & 0xFF
  1931. arr[curByte++] = tmp & 0xFF
  1932. }
  1933. if (placeHoldersLen === 2) {
  1934. tmp =
  1935. (revLookup[b64.charCodeAt(i)] << 2) |
  1936. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  1937. arr[curByte++] = tmp & 0xFF
  1938. }
  1939. if (placeHoldersLen === 1) {
  1940. tmp =
  1941. (revLookup[b64.charCodeAt(i)] << 10) |
  1942. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  1943. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  1944. arr[curByte++] = (tmp >> 8) & 0xFF
  1945. arr[curByte++] = tmp & 0xFF
  1946. }
  1947. return arr
  1948. }
  1949. function tripletToBase64 (num) {
  1950. return lookup[num >> 18 & 0x3F] +
  1951. lookup[num >> 12 & 0x3F] +
  1952. lookup[num >> 6 & 0x3F] +
  1953. lookup[num & 0x3F]
  1954. }
  1955. function encodeChunk (uint8, start, end) {
  1956. var tmp
  1957. var output = []
  1958. for (var i = start; i < end; i += 3) {
  1959. tmp =
  1960. ((uint8[i] << 16) & 0xFF0000) +
  1961. ((uint8[i + 1] << 8) & 0xFF00) +
  1962. (uint8[i + 2] & 0xFF)
  1963. output.push(tripletToBase64(tmp))
  1964. }
  1965. return output.join('')
  1966. }
  1967. function fromByteArray (uint8) {
  1968. var tmp
  1969. var len = uint8.length
  1970. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  1971. var parts = []
  1972. var maxChunkLength = 16383 // must be multiple of 3
  1973. // go through the array every three bytes, we'll deal with trailing stuff later
  1974. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  1975. parts.push(encodeChunk(
  1976. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  1977. ))
  1978. }
  1979. // pad the end with zeros, but make sure to not forget the extra bytes
  1980. if (extraBytes === 1) {
  1981. tmp = uint8[len - 1]
  1982. parts.push(
  1983. lookup[tmp >> 2] +
  1984. lookup[(tmp << 4) & 0x3F] +
  1985. '=='
  1986. )
  1987. } else if (extraBytes === 2) {
  1988. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  1989. parts.push(
  1990. lookup[tmp >> 10] +
  1991. lookup[(tmp >> 4) & 0x3F] +
  1992. lookup[(tmp << 2) & 0x3F] +
  1993. '='
  1994. )
  1995. }
  1996. return parts.join('')
  1997. }
  1998. /***/ }),
  1999. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2000. /*!*****************************************************!*\
  2001. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2002. \*****************************************************/
  2003. /*! no static exports found */
  2004. /***/ (function(module, exports, __webpack_require__) {
  2005. /*!
  2006. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2007. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2008. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2009. */
  2010. (function (global, factory) {
  2011. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2012. undefined;
  2013. }(this, (function (exports, $, Popper) { 'use strict';
  2014. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2015. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2016. function _defineProperties(target, props) {
  2017. for (var i = 0; i < props.length; i++) {
  2018. var descriptor = props[i];
  2019. descriptor.enumerable = descriptor.enumerable || false;
  2020. descriptor.configurable = true;
  2021. if ("value" in descriptor) descriptor.writable = true;
  2022. Object.defineProperty(target, descriptor.key, descriptor);
  2023. }
  2024. }
  2025. function _createClass(Constructor, protoProps, staticProps) {
  2026. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2027. if (staticProps) _defineProperties(Constructor, staticProps);
  2028. return Constructor;
  2029. }
  2030. function _defineProperty(obj, key, value) {
  2031. if (key in obj) {
  2032. Object.defineProperty(obj, key, {
  2033. value: value,
  2034. enumerable: true,
  2035. configurable: true,
  2036. writable: true
  2037. });
  2038. } else {
  2039. obj[key] = value;
  2040. }
  2041. return obj;
  2042. }
  2043. function ownKeys(object, enumerableOnly) {
  2044. var keys = Object.keys(object);
  2045. if (Object.getOwnPropertySymbols) {
  2046. var symbols = Object.getOwnPropertySymbols(object);
  2047. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2048. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2049. });
  2050. keys.push.apply(keys, symbols);
  2051. }
  2052. return keys;
  2053. }
  2054. function _objectSpread2(target) {
  2055. for (var i = 1; i < arguments.length; i++) {
  2056. var source = arguments[i] != null ? arguments[i] : {};
  2057. if (i % 2) {
  2058. ownKeys(Object(source), true).forEach(function (key) {
  2059. _defineProperty(target, key, source[key]);
  2060. });
  2061. } else if (Object.getOwnPropertyDescriptors) {
  2062. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2063. } else {
  2064. ownKeys(Object(source)).forEach(function (key) {
  2065. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2066. });
  2067. }
  2068. }
  2069. return target;
  2070. }
  2071. function _inheritsLoose(subClass, superClass) {
  2072. subClass.prototype = Object.create(superClass.prototype);
  2073. subClass.prototype.constructor = subClass;
  2074. subClass.__proto__ = superClass;
  2075. }
  2076. /**
  2077. * --------------------------------------------------------------------------
  2078. * Bootstrap (v4.4.1): util.js
  2079. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2080. * --------------------------------------------------------------------------
  2081. */
  2082. /**
  2083. * ------------------------------------------------------------------------
  2084. * Private TransitionEnd Helpers
  2085. * ------------------------------------------------------------------------
  2086. */
  2087. var TRANSITION_END = 'transitionend';
  2088. var MAX_UID = 1000000;
  2089. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2090. function toType(obj) {
  2091. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2092. }
  2093. function getSpecialTransitionEndEvent() {
  2094. return {
  2095. bindType: TRANSITION_END,
  2096. delegateType: TRANSITION_END,
  2097. handle: function handle(event) {
  2098. if ($(event.target).is(this)) {
  2099. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2100. }
  2101. return undefined; // eslint-disable-line no-undefined
  2102. }
  2103. };
  2104. }
  2105. function transitionEndEmulator(duration) {
  2106. var _this = this;
  2107. var called = false;
  2108. $(this).one(Util.TRANSITION_END, function () {
  2109. called = true;
  2110. });
  2111. setTimeout(function () {
  2112. if (!called) {
  2113. Util.triggerTransitionEnd(_this);
  2114. }
  2115. }, duration);
  2116. return this;
  2117. }
  2118. function setTransitionEndSupport() {
  2119. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2120. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2121. }
  2122. /**
  2123. * --------------------------------------------------------------------------
  2124. * Public Util Api
  2125. * --------------------------------------------------------------------------
  2126. */
  2127. var Util = {
  2128. TRANSITION_END: 'bsTransitionEnd',
  2129. getUID: function getUID(prefix) {
  2130. do {
  2131. // eslint-disable-next-line no-bitwise
  2132. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2133. } while (document.getElementById(prefix));
  2134. return prefix;
  2135. },
  2136. getSelectorFromElement: function getSelectorFromElement(element) {
  2137. var selector = element.getAttribute('data-target');
  2138. if (!selector || selector === '#') {
  2139. var hrefAttr = element.getAttribute('href');
  2140. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2141. }
  2142. try {
  2143. return document.querySelector(selector) ? selector : null;
  2144. } catch (err) {
  2145. return null;
  2146. }
  2147. },
  2148. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2149. if (!element) {
  2150. return 0;
  2151. } // Get transition-duration of the element
  2152. var transitionDuration = $(element).css('transition-duration');
  2153. var transitionDelay = $(element).css('transition-delay');
  2154. var floatTransitionDuration = parseFloat(transitionDuration);
  2155. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2156. if (!floatTransitionDuration && !floatTransitionDelay) {
  2157. return 0;
  2158. } // If multiple durations are defined, take the first
  2159. transitionDuration = transitionDuration.split(',')[0];
  2160. transitionDelay = transitionDelay.split(',')[0];
  2161. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2162. },
  2163. reflow: function reflow(element) {
  2164. return element.offsetHeight;
  2165. },
  2166. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2167. $(element).trigger(TRANSITION_END);
  2168. },
  2169. // TODO: Remove in v5
  2170. supportsTransitionEnd: function supportsTransitionEnd() {
  2171. return Boolean(TRANSITION_END);
  2172. },
  2173. isElement: function isElement(obj) {
  2174. return (obj[0] || obj).nodeType;
  2175. },
  2176. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2177. for (var property in configTypes) {
  2178. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2179. var expectedTypes = configTypes[property];
  2180. var value = config[property];
  2181. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2182. if (!new RegExp(expectedTypes).test(valueType)) {
  2183. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2184. }
  2185. }
  2186. }
  2187. },
  2188. findShadowRoot: function findShadowRoot(element) {
  2189. if (!document.documentElement.attachShadow) {
  2190. return null;
  2191. } // Can find the shadow root otherwise it'll return the document
  2192. if (typeof element.getRootNode === 'function') {
  2193. var root = element.getRootNode();
  2194. return root instanceof ShadowRoot ? root : null;
  2195. }
  2196. if (element instanceof ShadowRoot) {
  2197. return element;
  2198. } // when we don't find a shadow root
  2199. if (!element.parentNode) {
  2200. return null;
  2201. }
  2202. return Util.findShadowRoot(element.parentNode);
  2203. },
  2204. jQueryDetection: function jQueryDetection() {
  2205. if (typeof $ === 'undefined') {
  2206. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2207. }
  2208. var version = $.fn.jquery.split(' ')[0].split('.');
  2209. var minMajor = 1;
  2210. var ltMajor = 2;
  2211. var minMinor = 9;
  2212. var minPatch = 1;
  2213. var maxMajor = 4;
  2214. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2215. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2216. }
  2217. }
  2218. };
  2219. Util.jQueryDetection();
  2220. setTransitionEndSupport();
  2221. /**
  2222. * ------------------------------------------------------------------------
  2223. * Constants
  2224. * ------------------------------------------------------------------------
  2225. */
  2226. var NAME = 'alert';
  2227. var VERSION = '4.4.1';
  2228. var DATA_KEY = 'bs.alert';
  2229. var EVENT_KEY = "." + DATA_KEY;
  2230. var DATA_API_KEY = '.data-api';
  2231. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2232. var Selector = {
  2233. DISMISS: '[data-dismiss="alert"]'
  2234. };
  2235. var Event = {
  2236. CLOSE: "close" + EVENT_KEY,
  2237. CLOSED: "closed" + EVENT_KEY,
  2238. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2239. };
  2240. var ClassName = {
  2241. ALERT: 'alert',
  2242. FADE: 'fade',
  2243. SHOW: 'show'
  2244. };
  2245. /**
  2246. * ------------------------------------------------------------------------
  2247. * Class Definition
  2248. * ------------------------------------------------------------------------
  2249. */
  2250. var Alert =
  2251. /*#__PURE__*/
  2252. function () {
  2253. function Alert(element) {
  2254. this._element = element;
  2255. } // Getters
  2256. var _proto = Alert.prototype;
  2257. // Public
  2258. _proto.close = function close(element) {
  2259. var rootElement = this._element;
  2260. if (element) {
  2261. rootElement = this._getRootElement(element);
  2262. }
  2263. var customEvent = this._triggerCloseEvent(rootElement);
  2264. if (customEvent.isDefaultPrevented()) {
  2265. return;
  2266. }
  2267. this._removeElement(rootElement);
  2268. };
  2269. _proto.dispose = function dispose() {
  2270. $.removeData(this._element, DATA_KEY);
  2271. this._element = null;
  2272. } // Private
  2273. ;
  2274. _proto._getRootElement = function _getRootElement(element) {
  2275. var selector = Util.getSelectorFromElement(element);
  2276. var parent = false;
  2277. if (selector) {
  2278. parent = document.querySelector(selector);
  2279. }
  2280. if (!parent) {
  2281. parent = $(element).closest("." + ClassName.ALERT)[0];
  2282. }
  2283. return parent;
  2284. };
  2285. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2286. var closeEvent = $.Event(Event.CLOSE);
  2287. $(element).trigger(closeEvent);
  2288. return closeEvent;
  2289. };
  2290. _proto._removeElement = function _removeElement(element) {
  2291. var _this = this;
  2292. $(element).removeClass(ClassName.SHOW);
  2293. if (!$(element).hasClass(ClassName.FADE)) {
  2294. this._destroyElement(element);
  2295. return;
  2296. }
  2297. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2298. $(element).one(Util.TRANSITION_END, function (event) {
  2299. return _this._destroyElement(element, event);
  2300. }).emulateTransitionEnd(transitionDuration);
  2301. };
  2302. _proto._destroyElement = function _destroyElement(element) {
  2303. $(element).detach().trigger(Event.CLOSED).remove();
  2304. } // Static
  2305. ;
  2306. Alert._jQueryInterface = function _jQueryInterface(config) {
  2307. return this.each(function () {
  2308. var $element = $(this);
  2309. var data = $element.data(DATA_KEY);
  2310. if (!data) {
  2311. data = new Alert(this);
  2312. $element.data(DATA_KEY, data);
  2313. }
  2314. if (config === 'close') {
  2315. data[config](this);
  2316. }
  2317. });
  2318. };
  2319. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2320. return function (event) {
  2321. if (event) {
  2322. event.preventDefault();
  2323. }
  2324. alertInstance.close(this);
  2325. };
  2326. };
  2327. _createClass(Alert, null, [{
  2328. key: "VERSION",
  2329. get: function get() {
  2330. return VERSION;
  2331. }
  2332. }]);
  2333. return Alert;
  2334. }();
  2335. /**
  2336. * ------------------------------------------------------------------------
  2337. * Data Api implementation
  2338. * ------------------------------------------------------------------------
  2339. */
  2340. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2341. /**
  2342. * ------------------------------------------------------------------------
  2343. * jQuery
  2344. * ------------------------------------------------------------------------
  2345. */
  2346. $.fn[NAME] = Alert._jQueryInterface;
  2347. $.fn[NAME].Constructor = Alert;
  2348. $.fn[NAME].noConflict = function () {
  2349. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2350. return Alert._jQueryInterface;
  2351. };
  2352. /**
  2353. * ------------------------------------------------------------------------
  2354. * Constants
  2355. * ------------------------------------------------------------------------
  2356. */
  2357. var NAME$1 = 'button';
  2358. var VERSION$1 = '4.4.1';
  2359. var DATA_KEY$1 = 'bs.button';
  2360. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2361. var DATA_API_KEY$1 = '.data-api';
  2362. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2363. var ClassName$1 = {
  2364. ACTIVE: 'active',
  2365. BUTTON: 'btn',
  2366. FOCUS: 'focus'
  2367. };
  2368. var Selector$1 = {
  2369. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2370. DATA_TOGGLES: '[data-toggle="buttons"]',
  2371. DATA_TOGGLE: '[data-toggle="button"]',
  2372. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2373. INPUT: 'input:not([type="hidden"])',
  2374. ACTIVE: '.active',
  2375. BUTTON: '.btn'
  2376. };
  2377. var Event$1 = {
  2378. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2379. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2380. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2381. };
  2382. /**
  2383. * ------------------------------------------------------------------------
  2384. * Class Definition
  2385. * ------------------------------------------------------------------------
  2386. */
  2387. var Button =
  2388. /*#__PURE__*/
  2389. function () {
  2390. function Button(element) {
  2391. this._element = element;
  2392. } // Getters
  2393. var _proto = Button.prototype;
  2394. // Public
  2395. _proto.toggle = function toggle() {
  2396. var triggerChangeEvent = true;
  2397. var addAriaPressed = true;
  2398. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2399. if (rootElement) {
  2400. var input = this._element.querySelector(Selector$1.INPUT);
  2401. if (input) {
  2402. if (input.type === 'radio') {
  2403. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2404. triggerChangeEvent = false;
  2405. } else {
  2406. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2407. if (activeElement) {
  2408. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2409. }
  2410. }
  2411. } else if (input.type === 'checkbox') {
  2412. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2413. triggerChangeEvent = false;
  2414. }
  2415. } else {
  2416. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2417. triggerChangeEvent = false;
  2418. }
  2419. if (triggerChangeEvent) {
  2420. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2421. $(input).trigger('change');
  2422. }
  2423. input.focus();
  2424. addAriaPressed = false;
  2425. }
  2426. }
  2427. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2428. if (addAriaPressed) {
  2429. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2430. }
  2431. if (triggerChangeEvent) {
  2432. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2433. }
  2434. }
  2435. };
  2436. _proto.dispose = function dispose() {
  2437. $.removeData(this._element, DATA_KEY$1);
  2438. this._element = null;
  2439. } // Static
  2440. ;
  2441. Button._jQueryInterface = function _jQueryInterface(config) {
  2442. return this.each(function () {
  2443. var data = $(this).data(DATA_KEY$1);
  2444. if (!data) {
  2445. data = new Button(this);
  2446. $(this).data(DATA_KEY$1, data);
  2447. }
  2448. if (config === 'toggle') {
  2449. data[config]();
  2450. }
  2451. });
  2452. };
  2453. _createClass(Button, null, [{
  2454. key: "VERSION",
  2455. get: function get() {
  2456. return VERSION$1;
  2457. }
  2458. }]);
  2459. return Button;
  2460. }();
  2461. /**
  2462. * ------------------------------------------------------------------------
  2463. * Data Api implementation
  2464. * ------------------------------------------------------------------------
  2465. */
  2466. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2467. var button = event.target;
  2468. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2469. button = $(button).closest(Selector$1.BUTTON)[0];
  2470. }
  2471. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2472. event.preventDefault(); // work around Firefox bug #1540995
  2473. } else {
  2474. var inputBtn = button.querySelector(Selector$1.INPUT);
  2475. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2476. event.preventDefault(); // work around Firefox bug #1540995
  2477. return;
  2478. }
  2479. Button._jQueryInterface.call($(button), 'toggle');
  2480. }
  2481. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2482. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2483. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2484. });
  2485. $(window).on(Event$1.LOAD_DATA_API, function () {
  2486. // ensure correct active class is set to match the controls' actual values/states
  2487. // find all checkboxes/readio buttons inside data-toggle groups
  2488. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2489. for (var i = 0, len = buttons.length; i < len; i++) {
  2490. var button = buttons[i];
  2491. var input = button.querySelector(Selector$1.INPUT);
  2492. if (input.checked || input.hasAttribute('checked')) {
  2493. button.classList.add(ClassName$1.ACTIVE);
  2494. } else {
  2495. button.classList.remove(ClassName$1.ACTIVE);
  2496. }
  2497. } // find all button toggles
  2498. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2499. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2500. var _button = buttons[_i];
  2501. if (_button.getAttribute('aria-pressed') === 'true') {
  2502. _button.classList.add(ClassName$1.ACTIVE);
  2503. } else {
  2504. _button.classList.remove(ClassName$1.ACTIVE);
  2505. }
  2506. }
  2507. });
  2508. /**
  2509. * ------------------------------------------------------------------------
  2510. * jQuery
  2511. * ------------------------------------------------------------------------
  2512. */
  2513. $.fn[NAME$1] = Button._jQueryInterface;
  2514. $.fn[NAME$1].Constructor = Button;
  2515. $.fn[NAME$1].noConflict = function () {
  2516. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2517. return Button._jQueryInterface;
  2518. };
  2519. /**
  2520. * ------------------------------------------------------------------------
  2521. * Constants
  2522. * ------------------------------------------------------------------------
  2523. */
  2524. var NAME$2 = 'carousel';
  2525. var VERSION$2 = '4.4.1';
  2526. var DATA_KEY$2 = 'bs.carousel';
  2527. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2528. var DATA_API_KEY$2 = '.data-api';
  2529. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2530. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2531. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2532. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2533. var SWIPE_THRESHOLD = 40;
  2534. var Default = {
  2535. interval: 5000,
  2536. keyboard: true,
  2537. slide: false,
  2538. pause: 'hover',
  2539. wrap: true,
  2540. touch: true
  2541. };
  2542. var DefaultType = {
  2543. interval: '(number|boolean)',
  2544. keyboard: 'boolean',
  2545. slide: '(boolean|string)',
  2546. pause: '(string|boolean)',
  2547. wrap: 'boolean',
  2548. touch: 'boolean'
  2549. };
  2550. var Direction = {
  2551. NEXT: 'next',
  2552. PREV: 'prev',
  2553. LEFT: 'left',
  2554. RIGHT: 'right'
  2555. };
  2556. var Event$2 = {
  2557. SLIDE: "slide" + EVENT_KEY$2,
  2558. SLID: "slid" + EVENT_KEY$2,
  2559. KEYDOWN: "keydown" + EVENT_KEY$2,
  2560. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2561. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2562. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2563. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2564. TOUCHEND: "touchend" + EVENT_KEY$2,
  2565. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2566. POINTERUP: "pointerup" + EVENT_KEY$2,
  2567. DRAG_START: "dragstart" + EVENT_KEY$2,
  2568. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2569. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2570. };
  2571. var ClassName$2 = {
  2572. CAROUSEL: 'carousel',
  2573. ACTIVE: 'active',
  2574. SLIDE: 'slide',
  2575. RIGHT: 'carousel-item-right',
  2576. LEFT: 'carousel-item-left',
  2577. NEXT: 'carousel-item-next',
  2578. PREV: 'carousel-item-prev',
  2579. ITEM: 'carousel-item',
  2580. POINTER_EVENT: 'pointer-event'
  2581. };
  2582. var Selector$2 = {
  2583. ACTIVE: '.active',
  2584. ACTIVE_ITEM: '.active.carousel-item',
  2585. ITEM: '.carousel-item',
  2586. ITEM_IMG: '.carousel-item img',
  2587. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2588. INDICATORS: '.carousel-indicators',
  2589. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2590. DATA_RIDE: '[data-ride="carousel"]'
  2591. };
  2592. var PointerType = {
  2593. TOUCH: 'touch',
  2594. PEN: 'pen'
  2595. };
  2596. /**
  2597. * ------------------------------------------------------------------------
  2598. * Class Definition
  2599. * ------------------------------------------------------------------------
  2600. */
  2601. var Carousel =
  2602. /*#__PURE__*/
  2603. function () {
  2604. function Carousel(element, config) {
  2605. this._items = null;
  2606. this._interval = null;
  2607. this._activeElement = null;
  2608. this._isPaused = false;
  2609. this._isSliding = false;
  2610. this.touchTimeout = null;
  2611. this.touchStartX = 0;
  2612. this.touchDeltaX = 0;
  2613. this._config = this._getConfig(config);
  2614. this._element = element;
  2615. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2616. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2617. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2618. this._addEventListeners();
  2619. } // Getters
  2620. var _proto = Carousel.prototype;
  2621. // Public
  2622. _proto.next = function next() {
  2623. if (!this._isSliding) {
  2624. this._slide(Direction.NEXT);
  2625. }
  2626. };
  2627. _proto.nextWhenVisible = function nextWhenVisible() {
  2628. // Don't call next when the page isn't visible
  2629. // or the carousel or its parent isn't visible
  2630. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2631. this.next();
  2632. }
  2633. };
  2634. _proto.prev = function prev() {
  2635. if (!this._isSliding) {
  2636. this._slide(Direction.PREV);
  2637. }
  2638. };
  2639. _proto.pause = function pause(event) {
  2640. if (!event) {
  2641. this._isPaused = true;
  2642. }
  2643. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2644. Util.triggerTransitionEnd(this._element);
  2645. this.cycle(true);
  2646. }
  2647. clearInterval(this._interval);
  2648. this._interval = null;
  2649. };
  2650. _proto.cycle = function cycle(event) {
  2651. if (!event) {
  2652. this._isPaused = false;
  2653. }
  2654. if (this._interval) {
  2655. clearInterval(this._interval);
  2656. this._interval = null;
  2657. }
  2658. if (this._config.interval && !this._isPaused) {
  2659. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2660. }
  2661. };
  2662. _proto.to = function to(index) {
  2663. var _this = this;
  2664. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2665. var activeIndex = this._getItemIndex(this._activeElement);
  2666. if (index > this._items.length - 1 || index < 0) {
  2667. return;
  2668. }
  2669. if (this._isSliding) {
  2670. $(this._element).one(Event$2.SLID, function () {
  2671. return _this.to(index);
  2672. });
  2673. return;
  2674. }
  2675. if (activeIndex === index) {
  2676. this.pause();
  2677. this.cycle();
  2678. return;
  2679. }
  2680. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2681. this._slide(direction, this._items[index]);
  2682. };
  2683. _proto.dispose = function dispose() {
  2684. $(this._element).off(EVENT_KEY$2);
  2685. $.removeData(this._element, DATA_KEY$2);
  2686. this._items = null;
  2687. this._config = null;
  2688. this._element = null;
  2689. this._interval = null;
  2690. this._isPaused = null;
  2691. this._isSliding = null;
  2692. this._activeElement = null;
  2693. this._indicatorsElement = null;
  2694. } // Private
  2695. ;
  2696. _proto._getConfig = function _getConfig(config) {
  2697. config = _objectSpread2({}, Default, {}, config);
  2698. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2699. return config;
  2700. };
  2701. _proto._handleSwipe = function _handleSwipe() {
  2702. var absDeltax = Math.abs(this.touchDeltaX);
  2703. if (absDeltax <= SWIPE_THRESHOLD) {
  2704. return;
  2705. }
  2706. var direction = absDeltax / this.touchDeltaX;
  2707. this.touchDeltaX = 0; // swipe left
  2708. if (direction > 0) {
  2709. this.prev();
  2710. } // swipe right
  2711. if (direction < 0) {
  2712. this.next();
  2713. }
  2714. };
  2715. _proto._addEventListeners = function _addEventListeners() {
  2716. var _this2 = this;
  2717. if (this._config.keyboard) {
  2718. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2719. return _this2._keydown(event);
  2720. });
  2721. }
  2722. if (this._config.pause === 'hover') {
  2723. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2724. return _this2.pause(event);
  2725. }).on(Event$2.MOUSELEAVE, function (event) {
  2726. return _this2.cycle(event);
  2727. });
  2728. }
  2729. if (this._config.touch) {
  2730. this._addTouchEventListeners();
  2731. }
  2732. };
  2733. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2734. var _this3 = this;
  2735. if (!this._touchSupported) {
  2736. return;
  2737. }
  2738. var start = function start(event) {
  2739. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2740. _this3.touchStartX = event.originalEvent.clientX;
  2741. } else if (!_this3._pointerEvent) {
  2742. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2743. }
  2744. };
  2745. var move = function move(event) {
  2746. // ensure swiping with one touch and not pinching
  2747. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2748. _this3.touchDeltaX = 0;
  2749. } else {
  2750. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2751. }
  2752. };
  2753. var end = function end(event) {
  2754. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2755. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2756. }
  2757. _this3._handleSwipe();
  2758. if (_this3._config.pause === 'hover') {
  2759. // If it's a touch-enabled device, mouseenter/leave are fired as
  2760. // part of the mouse compatibility events on first tap - the carousel
  2761. // would stop cycling until user tapped out of it;
  2762. // here, we listen for touchend, explicitly pause the carousel
  2763. // (as if it's the second time we tap on it, mouseenter compat event
  2764. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2765. // events to fire) we explicitly restart cycling
  2766. _this3.pause();
  2767. if (_this3.touchTimeout) {
  2768. clearTimeout(_this3.touchTimeout);
  2769. }
  2770. _this3.touchTimeout = setTimeout(function (event) {
  2771. return _this3.cycle(event);
  2772. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2773. }
  2774. };
  2775. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2776. return e.preventDefault();
  2777. });
  2778. if (this._pointerEvent) {
  2779. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2780. return start(event);
  2781. });
  2782. $(this._element).on(Event$2.POINTERUP, function (event) {
  2783. return end(event);
  2784. });
  2785. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2786. } else {
  2787. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2788. return start(event);
  2789. });
  2790. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2791. return move(event);
  2792. });
  2793. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2794. return end(event);
  2795. });
  2796. }
  2797. };
  2798. _proto._keydown = function _keydown(event) {
  2799. if (/input|textarea/i.test(event.target.tagName)) {
  2800. return;
  2801. }
  2802. switch (event.which) {
  2803. case ARROW_LEFT_KEYCODE:
  2804. event.preventDefault();
  2805. this.prev();
  2806. break;
  2807. case ARROW_RIGHT_KEYCODE:
  2808. event.preventDefault();
  2809. this.next();
  2810. break;
  2811. }
  2812. };
  2813. _proto._getItemIndex = function _getItemIndex(element) {
  2814. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2815. return this._items.indexOf(element);
  2816. };
  2817. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2818. var isNextDirection = direction === Direction.NEXT;
  2819. var isPrevDirection = direction === Direction.PREV;
  2820. var activeIndex = this._getItemIndex(activeElement);
  2821. var lastItemIndex = this._items.length - 1;
  2822. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2823. if (isGoingToWrap && !this._config.wrap) {
  2824. return activeElement;
  2825. }
  2826. var delta = direction === Direction.PREV ? -1 : 1;
  2827. var itemIndex = (activeIndex + delta) % this._items.length;
  2828. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2829. };
  2830. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2831. var targetIndex = this._getItemIndex(relatedTarget);
  2832. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2833. var slideEvent = $.Event(Event$2.SLIDE, {
  2834. relatedTarget: relatedTarget,
  2835. direction: eventDirectionName,
  2836. from: fromIndex,
  2837. to: targetIndex
  2838. });
  2839. $(this._element).trigger(slideEvent);
  2840. return slideEvent;
  2841. };
  2842. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2843. if (this._indicatorsElement) {
  2844. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2845. $(indicators).removeClass(ClassName$2.ACTIVE);
  2846. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2847. if (nextIndicator) {
  2848. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2849. }
  2850. }
  2851. };
  2852. _proto._slide = function _slide(direction, element) {
  2853. var _this4 = this;
  2854. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2855. var activeElementIndex = this._getItemIndex(activeElement);
  2856. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2857. var nextElementIndex = this._getItemIndex(nextElement);
  2858. var isCycling = Boolean(this._interval);
  2859. var directionalClassName;
  2860. var orderClassName;
  2861. var eventDirectionName;
  2862. if (direction === Direction.NEXT) {
  2863. directionalClassName = ClassName$2.LEFT;
  2864. orderClassName = ClassName$2.NEXT;
  2865. eventDirectionName = Direction.LEFT;
  2866. } else {
  2867. directionalClassName = ClassName$2.RIGHT;
  2868. orderClassName = ClassName$2.PREV;
  2869. eventDirectionName = Direction.RIGHT;
  2870. }
  2871. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2872. this._isSliding = false;
  2873. return;
  2874. }
  2875. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2876. if (slideEvent.isDefaultPrevented()) {
  2877. return;
  2878. }
  2879. if (!activeElement || !nextElement) {
  2880. // Some weirdness is happening, so we bail
  2881. return;
  2882. }
  2883. this._isSliding = true;
  2884. if (isCycling) {
  2885. this.pause();
  2886. }
  2887. this._setActiveIndicatorElement(nextElement);
  2888. var slidEvent = $.Event(Event$2.SLID, {
  2889. relatedTarget: nextElement,
  2890. direction: eventDirectionName,
  2891. from: activeElementIndex,
  2892. to: nextElementIndex
  2893. });
  2894. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2895. $(nextElement).addClass(orderClassName);
  2896. Util.reflow(nextElement);
  2897. $(activeElement).addClass(directionalClassName);
  2898. $(nextElement).addClass(directionalClassName);
  2899. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2900. if (nextElementInterval) {
  2901. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2902. this._config.interval = nextElementInterval;
  2903. } else {
  2904. this._config.interval = this._config.defaultInterval || this._config.interval;
  2905. }
  2906. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2907. $(activeElement).one(Util.TRANSITION_END, function () {
  2908. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2909. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2910. _this4._isSliding = false;
  2911. setTimeout(function () {
  2912. return $(_this4._element).trigger(slidEvent);
  2913. }, 0);
  2914. }).emulateTransitionEnd(transitionDuration);
  2915. } else {
  2916. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2917. $(nextElement).addClass(ClassName$2.ACTIVE);
  2918. this._isSliding = false;
  2919. $(this._element).trigger(slidEvent);
  2920. }
  2921. if (isCycling) {
  2922. this.cycle();
  2923. }
  2924. } // Static
  2925. ;
  2926. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2927. return this.each(function () {
  2928. var data = $(this).data(DATA_KEY$2);
  2929. var _config = _objectSpread2({}, Default, {}, $(this).data());
  2930. if (typeof config === 'object') {
  2931. _config = _objectSpread2({}, _config, {}, config);
  2932. }
  2933. var action = typeof config === 'string' ? config : _config.slide;
  2934. if (!data) {
  2935. data = new Carousel(this, _config);
  2936. $(this).data(DATA_KEY$2, data);
  2937. }
  2938. if (typeof config === 'number') {
  2939. data.to(config);
  2940. } else if (typeof action === 'string') {
  2941. if (typeof data[action] === 'undefined') {
  2942. throw new TypeError("No method named \"" + action + "\"");
  2943. }
  2944. data[action]();
  2945. } else if (_config.interval && _config.ride) {
  2946. data.pause();
  2947. data.cycle();
  2948. }
  2949. });
  2950. };
  2951. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2952. var selector = Util.getSelectorFromElement(this);
  2953. if (!selector) {
  2954. return;
  2955. }
  2956. var target = $(selector)[0];
  2957. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  2958. return;
  2959. }
  2960. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  2961. var slideIndex = this.getAttribute('data-slide-to');
  2962. if (slideIndex) {
  2963. config.interval = false;
  2964. }
  2965. Carousel._jQueryInterface.call($(target), config);
  2966. if (slideIndex) {
  2967. $(target).data(DATA_KEY$2).to(slideIndex);
  2968. }
  2969. event.preventDefault();
  2970. };
  2971. _createClass(Carousel, null, [{
  2972. key: "VERSION",
  2973. get: function get() {
  2974. return VERSION$2;
  2975. }
  2976. }, {
  2977. key: "Default",
  2978. get: function get() {
  2979. return Default;
  2980. }
  2981. }]);
  2982. return Carousel;
  2983. }();
  2984. /**
  2985. * ------------------------------------------------------------------------
  2986. * Data Api implementation
  2987. * ------------------------------------------------------------------------
  2988. */
  2989. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  2990. $(window).on(Event$2.LOAD_DATA_API, function () {
  2991. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  2992. for (var i = 0, len = carousels.length; i < len; i++) {
  2993. var $carousel = $(carousels[i]);
  2994. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2995. }
  2996. });
  2997. /**
  2998. * ------------------------------------------------------------------------
  2999. * jQuery
  3000. * ------------------------------------------------------------------------
  3001. */
  3002. $.fn[NAME$2] = Carousel._jQueryInterface;
  3003. $.fn[NAME$2].Constructor = Carousel;
  3004. $.fn[NAME$2].noConflict = function () {
  3005. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3006. return Carousel._jQueryInterface;
  3007. };
  3008. /**
  3009. * ------------------------------------------------------------------------
  3010. * Constants
  3011. * ------------------------------------------------------------------------
  3012. */
  3013. var NAME$3 = 'collapse';
  3014. var VERSION$3 = '4.4.1';
  3015. var DATA_KEY$3 = 'bs.collapse';
  3016. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3017. var DATA_API_KEY$3 = '.data-api';
  3018. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3019. var Default$1 = {
  3020. toggle: true,
  3021. parent: ''
  3022. };
  3023. var DefaultType$1 = {
  3024. toggle: 'boolean',
  3025. parent: '(string|element)'
  3026. };
  3027. var Event$3 = {
  3028. SHOW: "show" + EVENT_KEY$3,
  3029. SHOWN: "shown" + EVENT_KEY$3,
  3030. HIDE: "hide" + EVENT_KEY$3,
  3031. HIDDEN: "hidden" + EVENT_KEY$3,
  3032. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3033. };
  3034. var ClassName$3 = {
  3035. SHOW: 'show',
  3036. COLLAPSE: 'collapse',
  3037. COLLAPSING: 'collapsing',
  3038. COLLAPSED: 'collapsed'
  3039. };
  3040. var Dimension = {
  3041. WIDTH: 'width',
  3042. HEIGHT: 'height'
  3043. };
  3044. var Selector$3 = {
  3045. ACTIVES: '.show, .collapsing',
  3046. DATA_TOGGLE: '[data-toggle="collapse"]'
  3047. };
  3048. /**
  3049. * ------------------------------------------------------------------------
  3050. * Class Definition
  3051. * ------------------------------------------------------------------------
  3052. */
  3053. var Collapse =
  3054. /*#__PURE__*/
  3055. function () {
  3056. function Collapse(element, config) {
  3057. this._isTransitioning = false;
  3058. this._element = element;
  3059. this._config = this._getConfig(config);
  3060. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3061. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3062. for (var i = 0, len = toggleList.length; i < len; i++) {
  3063. var elem = toggleList[i];
  3064. var selector = Util.getSelectorFromElement(elem);
  3065. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3066. return foundElem === element;
  3067. });
  3068. if (selector !== null && filterElement.length > 0) {
  3069. this._selector = selector;
  3070. this._triggerArray.push(elem);
  3071. }
  3072. }
  3073. this._parent = this._config.parent ? this._getParent() : null;
  3074. if (!this._config.parent) {
  3075. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3076. }
  3077. if (this._config.toggle) {
  3078. this.toggle();
  3079. }
  3080. } // Getters
  3081. var _proto = Collapse.prototype;
  3082. // Public
  3083. _proto.toggle = function toggle() {
  3084. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3085. this.hide();
  3086. } else {
  3087. this.show();
  3088. }
  3089. };
  3090. _proto.show = function show() {
  3091. var _this = this;
  3092. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3093. return;
  3094. }
  3095. var actives;
  3096. var activesData;
  3097. if (this._parent) {
  3098. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3099. if (typeof _this._config.parent === 'string') {
  3100. return elem.getAttribute('data-parent') === _this._config.parent;
  3101. }
  3102. return elem.classList.contains(ClassName$3.COLLAPSE);
  3103. });
  3104. if (actives.length === 0) {
  3105. actives = null;
  3106. }
  3107. }
  3108. if (actives) {
  3109. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3110. if (activesData && activesData._isTransitioning) {
  3111. return;
  3112. }
  3113. }
  3114. var startEvent = $.Event(Event$3.SHOW);
  3115. $(this._element).trigger(startEvent);
  3116. if (startEvent.isDefaultPrevented()) {
  3117. return;
  3118. }
  3119. if (actives) {
  3120. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3121. if (!activesData) {
  3122. $(actives).data(DATA_KEY$3, null);
  3123. }
  3124. }
  3125. var dimension = this._getDimension();
  3126. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3127. this._element.style[dimension] = 0;
  3128. if (this._triggerArray.length) {
  3129. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3130. }
  3131. this.setTransitioning(true);
  3132. var complete = function complete() {
  3133. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3134. _this._element.style[dimension] = '';
  3135. _this.setTransitioning(false);
  3136. $(_this._element).trigger(Event$3.SHOWN);
  3137. };
  3138. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3139. var scrollSize = "scroll" + capitalizedDimension;
  3140. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3141. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3142. this._element.style[dimension] = this._element[scrollSize] + "px";
  3143. };
  3144. _proto.hide = function hide() {
  3145. var _this2 = this;
  3146. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3147. return;
  3148. }
  3149. var startEvent = $.Event(Event$3.HIDE);
  3150. $(this._element).trigger(startEvent);
  3151. if (startEvent.isDefaultPrevented()) {
  3152. return;
  3153. }
  3154. var dimension = this._getDimension();
  3155. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3156. Util.reflow(this._element);
  3157. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3158. var triggerArrayLength = this._triggerArray.length;
  3159. if (triggerArrayLength > 0) {
  3160. for (var i = 0; i < triggerArrayLength; i++) {
  3161. var trigger = this._triggerArray[i];
  3162. var selector = Util.getSelectorFromElement(trigger);
  3163. if (selector !== null) {
  3164. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3165. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3166. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3167. }
  3168. }
  3169. }
  3170. }
  3171. this.setTransitioning(true);
  3172. var complete = function complete() {
  3173. _this2.setTransitioning(false);
  3174. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3175. };
  3176. this._element.style[dimension] = '';
  3177. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3178. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3179. };
  3180. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3181. this._isTransitioning = isTransitioning;
  3182. };
  3183. _proto.dispose = function dispose() {
  3184. $.removeData(this._element, DATA_KEY$3);
  3185. this._config = null;
  3186. this._parent = null;
  3187. this._element = null;
  3188. this._triggerArray = null;
  3189. this._isTransitioning = null;
  3190. } // Private
  3191. ;
  3192. _proto._getConfig = function _getConfig(config) {
  3193. config = _objectSpread2({}, Default$1, {}, config);
  3194. config.toggle = Boolean(config.toggle); // Coerce string values
  3195. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3196. return config;
  3197. };
  3198. _proto._getDimension = function _getDimension() {
  3199. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3200. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3201. };
  3202. _proto._getParent = function _getParent() {
  3203. var _this3 = this;
  3204. var parent;
  3205. if (Util.isElement(this._config.parent)) {
  3206. parent = this._config.parent; // It's a jQuery object
  3207. if (typeof this._config.parent.jquery !== 'undefined') {
  3208. parent = this._config.parent[0];
  3209. }
  3210. } else {
  3211. parent = document.querySelector(this._config.parent);
  3212. }
  3213. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3214. var children = [].slice.call(parent.querySelectorAll(selector));
  3215. $(children).each(function (i, element) {
  3216. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3217. });
  3218. return parent;
  3219. };
  3220. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3221. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3222. if (triggerArray.length) {
  3223. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3224. }
  3225. } // Static
  3226. ;
  3227. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3228. var selector = Util.getSelectorFromElement(element);
  3229. return selector ? document.querySelector(selector) : null;
  3230. };
  3231. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3232. return this.each(function () {
  3233. var $this = $(this);
  3234. var data = $this.data(DATA_KEY$3);
  3235. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3236. if (!data && _config.toggle && /show|hide/.test(config)) {
  3237. _config.toggle = false;
  3238. }
  3239. if (!data) {
  3240. data = new Collapse(this, _config);
  3241. $this.data(DATA_KEY$3, data);
  3242. }
  3243. if (typeof config === 'string') {
  3244. if (typeof data[config] === 'undefined') {
  3245. throw new TypeError("No method named \"" + config + "\"");
  3246. }
  3247. data[config]();
  3248. }
  3249. });
  3250. };
  3251. _createClass(Collapse, null, [{
  3252. key: "VERSION",
  3253. get: function get() {
  3254. return VERSION$3;
  3255. }
  3256. }, {
  3257. key: "Default",
  3258. get: function get() {
  3259. return Default$1;
  3260. }
  3261. }]);
  3262. return Collapse;
  3263. }();
  3264. /**
  3265. * ------------------------------------------------------------------------
  3266. * Data Api implementation
  3267. * ------------------------------------------------------------------------
  3268. */
  3269. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3270. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3271. if (event.currentTarget.tagName === 'A') {
  3272. event.preventDefault();
  3273. }
  3274. var $trigger = $(this);
  3275. var selector = Util.getSelectorFromElement(this);
  3276. var selectors = [].slice.call(document.querySelectorAll(selector));
  3277. $(selectors).each(function () {
  3278. var $target = $(this);
  3279. var data = $target.data(DATA_KEY$3);
  3280. var config = data ? 'toggle' : $trigger.data();
  3281. Collapse._jQueryInterface.call($target, config);
  3282. });
  3283. });
  3284. /**
  3285. * ------------------------------------------------------------------------
  3286. * jQuery
  3287. * ------------------------------------------------------------------------
  3288. */
  3289. $.fn[NAME$3] = Collapse._jQueryInterface;
  3290. $.fn[NAME$3].Constructor = Collapse;
  3291. $.fn[NAME$3].noConflict = function () {
  3292. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3293. return Collapse._jQueryInterface;
  3294. };
  3295. /**
  3296. * ------------------------------------------------------------------------
  3297. * Constants
  3298. * ------------------------------------------------------------------------
  3299. */
  3300. var NAME$4 = 'dropdown';
  3301. var VERSION$4 = '4.4.1';
  3302. var DATA_KEY$4 = 'bs.dropdown';
  3303. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3304. var DATA_API_KEY$4 = '.data-api';
  3305. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3306. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3307. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3308. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3309. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3310. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3311. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3312. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3313. var Event$4 = {
  3314. HIDE: "hide" + EVENT_KEY$4,
  3315. HIDDEN: "hidden" + EVENT_KEY$4,
  3316. SHOW: "show" + EVENT_KEY$4,
  3317. SHOWN: "shown" + EVENT_KEY$4,
  3318. CLICK: "click" + EVENT_KEY$4,
  3319. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3320. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3321. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3322. };
  3323. var ClassName$4 = {
  3324. DISABLED: 'disabled',
  3325. SHOW: 'show',
  3326. DROPUP: 'dropup',
  3327. DROPRIGHT: 'dropright',
  3328. DROPLEFT: 'dropleft',
  3329. MENURIGHT: 'dropdown-menu-right',
  3330. MENULEFT: 'dropdown-menu-left',
  3331. POSITION_STATIC: 'position-static'
  3332. };
  3333. var Selector$4 = {
  3334. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3335. FORM_CHILD: '.dropdown form',
  3336. MENU: '.dropdown-menu',
  3337. NAVBAR_NAV: '.navbar-nav',
  3338. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3339. };
  3340. var AttachmentMap = {
  3341. TOP: 'top-start',
  3342. TOPEND: 'top-end',
  3343. BOTTOM: 'bottom-start',
  3344. BOTTOMEND: 'bottom-end',
  3345. RIGHT: 'right-start',
  3346. RIGHTEND: 'right-end',
  3347. LEFT: 'left-start',
  3348. LEFTEND: 'left-end'
  3349. };
  3350. var Default$2 = {
  3351. offset: 0,
  3352. flip: true,
  3353. boundary: 'scrollParent',
  3354. reference: 'toggle',
  3355. display: 'dynamic',
  3356. popperConfig: null
  3357. };
  3358. var DefaultType$2 = {
  3359. offset: '(number|string|function)',
  3360. flip: 'boolean',
  3361. boundary: '(string|element)',
  3362. reference: '(string|element)',
  3363. display: 'string',
  3364. popperConfig: '(null|object)'
  3365. };
  3366. /**
  3367. * ------------------------------------------------------------------------
  3368. * Class Definition
  3369. * ------------------------------------------------------------------------
  3370. */
  3371. var Dropdown =
  3372. /*#__PURE__*/
  3373. function () {
  3374. function Dropdown(element, config) {
  3375. this._element = element;
  3376. this._popper = null;
  3377. this._config = this._getConfig(config);
  3378. this._menu = this._getMenuElement();
  3379. this._inNavbar = this._detectNavbar();
  3380. this._addEventListeners();
  3381. } // Getters
  3382. var _proto = Dropdown.prototype;
  3383. // Public
  3384. _proto.toggle = function toggle() {
  3385. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3386. return;
  3387. }
  3388. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3389. Dropdown._clearMenus();
  3390. if (isActive) {
  3391. return;
  3392. }
  3393. this.show(true);
  3394. };
  3395. _proto.show = function show(usePopper) {
  3396. if (usePopper === void 0) {
  3397. usePopper = false;
  3398. }
  3399. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3400. return;
  3401. }
  3402. var relatedTarget = {
  3403. relatedTarget: this._element
  3404. };
  3405. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3406. var parent = Dropdown._getParentFromElement(this._element);
  3407. $(parent).trigger(showEvent);
  3408. if (showEvent.isDefaultPrevented()) {
  3409. return;
  3410. } // Disable totally Popper.js for Dropdown in Navbar
  3411. if (!this._inNavbar && usePopper) {
  3412. /**
  3413. * Check for Popper dependency
  3414. * Popper - https://popper.js.org
  3415. */
  3416. if (typeof Popper === 'undefined') {
  3417. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3418. }
  3419. var referenceElement = this._element;
  3420. if (this._config.reference === 'parent') {
  3421. referenceElement = parent;
  3422. } else if (Util.isElement(this._config.reference)) {
  3423. referenceElement = this._config.reference; // Check if it's jQuery element
  3424. if (typeof this._config.reference.jquery !== 'undefined') {
  3425. referenceElement = this._config.reference[0];
  3426. }
  3427. } // If boundary is not `scrollParent`, then set position to `static`
  3428. // to allow the menu to "escape" the scroll parent's boundaries
  3429. // https://github.com/twbs/bootstrap/issues/24251
  3430. if (this._config.boundary !== 'scrollParent') {
  3431. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3432. }
  3433. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3434. } // If this is a touch-enabled device we add extra
  3435. // empty mouseover listeners to the body's immediate children;
  3436. // only needed because of broken event delegation on iOS
  3437. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3438. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3439. $(document.body).children().on('mouseover', null, $.noop);
  3440. }
  3441. this._element.focus();
  3442. this._element.setAttribute('aria-expanded', true);
  3443. $(this._menu).toggleClass(ClassName$4.SHOW);
  3444. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3445. };
  3446. _proto.hide = function hide() {
  3447. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3448. return;
  3449. }
  3450. var relatedTarget = {
  3451. relatedTarget: this._element
  3452. };
  3453. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3454. var parent = Dropdown._getParentFromElement(this._element);
  3455. $(parent).trigger(hideEvent);
  3456. if (hideEvent.isDefaultPrevented()) {
  3457. return;
  3458. }
  3459. if (this._popper) {
  3460. this._popper.destroy();
  3461. }
  3462. $(this._menu).toggleClass(ClassName$4.SHOW);
  3463. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3464. };
  3465. _proto.dispose = function dispose() {
  3466. $.removeData(this._element, DATA_KEY$4);
  3467. $(this._element).off(EVENT_KEY$4);
  3468. this._element = null;
  3469. this._menu = null;
  3470. if (this._popper !== null) {
  3471. this._popper.destroy();
  3472. this._popper = null;
  3473. }
  3474. };
  3475. _proto.update = function update() {
  3476. this._inNavbar = this._detectNavbar();
  3477. if (this._popper !== null) {
  3478. this._popper.scheduleUpdate();
  3479. }
  3480. } // Private
  3481. ;
  3482. _proto._addEventListeners = function _addEventListeners() {
  3483. var _this = this;
  3484. $(this._element).on(Event$4.CLICK, function (event) {
  3485. event.preventDefault();
  3486. event.stopPropagation();
  3487. _this.toggle();
  3488. });
  3489. };
  3490. _proto._getConfig = function _getConfig(config) {
  3491. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3492. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3493. return config;
  3494. };
  3495. _proto._getMenuElement = function _getMenuElement() {
  3496. if (!this._menu) {
  3497. var parent = Dropdown._getParentFromElement(this._element);
  3498. if (parent) {
  3499. this._menu = parent.querySelector(Selector$4.MENU);
  3500. }
  3501. }
  3502. return this._menu;
  3503. };
  3504. _proto._getPlacement = function _getPlacement() {
  3505. var $parentDropdown = $(this._element.parentNode);
  3506. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3507. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3508. placement = AttachmentMap.TOP;
  3509. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3510. placement = AttachmentMap.TOPEND;
  3511. }
  3512. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3513. placement = AttachmentMap.RIGHT;
  3514. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3515. placement = AttachmentMap.LEFT;
  3516. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3517. placement = AttachmentMap.BOTTOMEND;
  3518. }
  3519. return placement;
  3520. };
  3521. _proto._detectNavbar = function _detectNavbar() {
  3522. return $(this._element).closest('.navbar').length > 0;
  3523. };
  3524. _proto._getOffset = function _getOffset() {
  3525. var _this2 = this;
  3526. var offset = {};
  3527. if (typeof this._config.offset === 'function') {
  3528. offset.fn = function (data) {
  3529. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3530. return data;
  3531. };
  3532. } else {
  3533. offset.offset = this._config.offset;
  3534. }
  3535. return offset;
  3536. };
  3537. _proto._getPopperConfig = function _getPopperConfig() {
  3538. var popperConfig = {
  3539. placement: this._getPlacement(),
  3540. modifiers: {
  3541. offset: this._getOffset(),
  3542. flip: {
  3543. enabled: this._config.flip
  3544. },
  3545. preventOverflow: {
  3546. boundariesElement: this._config.boundary
  3547. }
  3548. }
  3549. }; // Disable Popper.js if we have a static display
  3550. if (this._config.display === 'static') {
  3551. popperConfig.modifiers.applyStyle = {
  3552. enabled: false
  3553. };
  3554. }
  3555. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3556. } // Static
  3557. ;
  3558. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3559. return this.each(function () {
  3560. var data = $(this).data(DATA_KEY$4);
  3561. var _config = typeof config === 'object' ? config : null;
  3562. if (!data) {
  3563. data = new Dropdown(this, _config);
  3564. $(this).data(DATA_KEY$4, data);
  3565. }
  3566. if (typeof config === 'string') {
  3567. if (typeof data[config] === 'undefined') {
  3568. throw new TypeError("No method named \"" + config + "\"");
  3569. }
  3570. data[config]();
  3571. }
  3572. });
  3573. };
  3574. Dropdown._clearMenus = function _clearMenus(event) {
  3575. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3576. return;
  3577. }
  3578. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3579. for (var i = 0, len = toggles.length; i < len; i++) {
  3580. var parent = Dropdown._getParentFromElement(toggles[i]);
  3581. var context = $(toggles[i]).data(DATA_KEY$4);
  3582. var relatedTarget = {
  3583. relatedTarget: toggles[i]
  3584. };
  3585. if (event && event.type === 'click') {
  3586. relatedTarget.clickEvent = event;
  3587. }
  3588. if (!context) {
  3589. continue;
  3590. }
  3591. var dropdownMenu = context._menu;
  3592. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3593. continue;
  3594. }
  3595. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3596. continue;
  3597. }
  3598. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3599. $(parent).trigger(hideEvent);
  3600. if (hideEvent.isDefaultPrevented()) {
  3601. continue;
  3602. } // If this is a touch-enabled device we remove the extra
  3603. // empty mouseover listeners we added for iOS support
  3604. if ('ontouchstart' in document.documentElement) {
  3605. $(document.body).children().off('mouseover', null, $.noop);
  3606. }
  3607. toggles[i].setAttribute('aria-expanded', 'false');
  3608. if (context._popper) {
  3609. context._popper.destroy();
  3610. }
  3611. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3612. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3613. }
  3614. };
  3615. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3616. var parent;
  3617. var selector = Util.getSelectorFromElement(element);
  3618. if (selector) {
  3619. parent = document.querySelector(selector);
  3620. }
  3621. return parent || element.parentNode;
  3622. } // eslint-disable-next-line complexity
  3623. ;
  3624. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3625. // If not input/textarea:
  3626. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3627. // If input/textarea:
  3628. // - If space key => not a dropdown command
  3629. // - If key is other than escape
  3630. // - If key is not up or down => not a dropdown command
  3631. // - If trigger inside the menu => not a dropdown command
  3632. if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
  3633. return;
  3634. }
  3635. event.preventDefault();
  3636. event.stopPropagation();
  3637. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3638. return;
  3639. }
  3640. var parent = Dropdown._getParentFromElement(this);
  3641. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3642. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3643. return;
  3644. }
  3645. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3646. if (event.which === ESCAPE_KEYCODE) {
  3647. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3648. $(toggle).trigger('focus');
  3649. }
  3650. $(this).trigger('click');
  3651. return;
  3652. }
  3653. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3654. return $(item).is(':visible');
  3655. });
  3656. if (items.length === 0) {
  3657. return;
  3658. }
  3659. var index = items.indexOf(event.target);
  3660. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3661. // Up
  3662. index--;
  3663. }
  3664. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3665. // Down
  3666. index++;
  3667. }
  3668. if (index < 0) {
  3669. index = 0;
  3670. }
  3671. items[index].focus();
  3672. };
  3673. _createClass(Dropdown, null, [{
  3674. key: "VERSION",
  3675. get: function get() {
  3676. return VERSION$4;
  3677. }
  3678. }, {
  3679. key: "Default",
  3680. get: function get() {
  3681. return Default$2;
  3682. }
  3683. }, {
  3684. key: "DefaultType",
  3685. get: function get() {
  3686. return DefaultType$2;
  3687. }
  3688. }]);
  3689. return Dropdown;
  3690. }();
  3691. /**
  3692. * ------------------------------------------------------------------------
  3693. * Data Api implementation
  3694. * ------------------------------------------------------------------------
  3695. */
  3696. $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
  3697. event.preventDefault();
  3698. event.stopPropagation();
  3699. Dropdown._jQueryInterface.call($(this), 'toggle');
  3700. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3701. e.stopPropagation();
  3702. });
  3703. /**
  3704. * ------------------------------------------------------------------------
  3705. * jQuery
  3706. * ------------------------------------------------------------------------
  3707. */
  3708. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3709. $.fn[NAME$4].Constructor = Dropdown;
  3710. $.fn[NAME$4].noConflict = function () {
  3711. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3712. return Dropdown._jQueryInterface;
  3713. };
  3714. /**
  3715. * ------------------------------------------------------------------------
  3716. * Constants
  3717. * ------------------------------------------------------------------------
  3718. */
  3719. var NAME$5 = 'modal';
  3720. var VERSION$5 = '4.4.1';
  3721. var DATA_KEY$5 = 'bs.modal';
  3722. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3723. var DATA_API_KEY$5 = '.data-api';
  3724. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3725. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3726. var Default$3 = {
  3727. backdrop: true,
  3728. keyboard: true,
  3729. focus: true,
  3730. show: true
  3731. };
  3732. var DefaultType$3 = {
  3733. backdrop: '(boolean|string)',
  3734. keyboard: 'boolean',
  3735. focus: 'boolean',
  3736. show: 'boolean'
  3737. };
  3738. var Event$5 = {
  3739. HIDE: "hide" + EVENT_KEY$5,
  3740. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3741. HIDDEN: "hidden" + EVENT_KEY$5,
  3742. SHOW: "show" + EVENT_KEY$5,
  3743. SHOWN: "shown" + EVENT_KEY$5,
  3744. FOCUSIN: "focusin" + EVENT_KEY$5,
  3745. RESIZE: "resize" + EVENT_KEY$5,
  3746. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3747. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3748. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3749. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3750. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3751. };
  3752. var ClassName$5 = {
  3753. SCROLLABLE: 'modal-dialog-scrollable',
  3754. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3755. BACKDROP: 'modal-backdrop',
  3756. OPEN: 'modal-open',
  3757. FADE: 'fade',
  3758. SHOW: 'show',
  3759. STATIC: 'modal-static'
  3760. };
  3761. var Selector$5 = {
  3762. DIALOG: '.modal-dialog',
  3763. MODAL_BODY: '.modal-body',
  3764. DATA_TOGGLE: '[data-toggle="modal"]',
  3765. DATA_DISMISS: '[data-dismiss="modal"]',
  3766. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3767. STICKY_CONTENT: '.sticky-top'
  3768. };
  3769. /**
  3770. * ------------------------------------------------------------------------
  3771. * Class Definition
  3772. * ------------------------------------------------------------------------
  3773. */
  3774. var Modal =
  3775. /*#__PURE__*/
  3776. function () {
  3777. function Modal(element, config) {
  3778. this._config = this._getConfig(config);
  3779. this._element = element;
  3780. this._dialog = element.querySelector(Selector$5.DIALOG);
  3781. this._backdrop = null;
  3782. this._isShown = false;
  3783. this._isBodyOverflowing = false;
  3784. this._ignoreBackdropClick = false;
  3785. this._isTransitioning = false;
  3786. this._scrollbarWidth = 0;
  3787. } // Getters
  3788. var _proto = Modal.prototype;
  3789. // Public
  3790. _proto.toggle = function toggle(relatedTarget) {
  3791. return this._isShown ? this.hide() : this.show(relatedTarget);
  3792. };
  3793. _proto.show = function show(relatedTarget) {
  3794. var _this = this;
  3795. if (this._isShown || this._isTransitioning) {
  3796. return;
  3797. }
  3798. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3799. this._isTransitioning = true;
  3800. }
  3801. var showEvent = $.Event(Event$5.SHOW, {
  3802. relatedTarget: relatedTarget
  3803. });
  3804. $(this._element).trigger(showEvent);
  3805. if (this._isShown || showEvent.isDefaultPrevented()) {
  3806. return;
  3807. }
  3808. this._isShown = true;
  3809. this._checkScrollbar();
  3810. this._setScrollbar();
  3811. this._adjustDialog();
  3812. this._setEscapeEvent();
  3813. this._setResizeEvent();
  3814. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3815. return _this.hide(event);
  3816. });
  3817. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3818. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3819. if ($(event.target).is(_this._element)) {
  3820. _this._ignoreBackdropClick = true;
  3821. }
  3822. });
  3823. });
  3824. this._showBackdrop(function () {
  3825. return _this._showElement(relatedTarget);
  3826. });
  3827. };
  3828. _proto.hide = function hide(event) {
  3829. var _this2 = this;
  3830. if (event) {
  3831. event.preventDefault();
  3832. }
  3833. if (!this._isShown || this._isTransitioning) {
  3834. return;
  3835. }
  3836. var hideEvent = $.Event(Event$5.HIDE);
  3837. $(this._element).trigger(hideEvent);
  3838. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3839. return;
  3840. }
  3841. this._isShown = false;
  3842. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3843. if (transition) {
  3844. this._isTransitioning = true;
  3845. }
  3846. this._setEscapeEvent();
  3847. this._setResizeEvent();
  3848. $(document).off(Event$5.FOCUSIN);
  3849. $(this._element).removeClass(ClassName$5.SHOW);
  3850. $(this._element).off(Event$5.CLICK_DISMISS);
  3851. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3852. if (transition) {
  3853. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3854. $(this._element).one(Util.TRANSITION_END, function (event) {
  3855. return _this2._hideModal(event);
  3856. }).emulateTransitionEnd(transitionDuration);
  3857. } else {
  3858. this._hideModal();
  3859. }
  3860. };
  3861. _proto.dispose = function dispose() {
  3862. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3863. return $(htmlElement).off(EVENT_KEY$5);
  3864. });
  3865. /**
  3866. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3867. * Do not move `document` in `htmlElements` array
  3868. * It will remove `Event.CLICK_DATA_API` event that should remain
  3869. */
  3870. $(document).off(Event$5.FOCUSIN);
  3871. $.removeData(this._element, DATA_KEY$5);
  3872. this._config = null;
  3873. this._element = null;
  3874. this._dialog = null;
  3875. this._backdrop = null;
  3876. this._isShown = null;
  3877. this._isBodyOverflowing = null;
  3878. this._ignoreBackdropClick = null;
  3879. this._isTransitioning = null;
  3880. this._scrollbarWidth = null;
  3881. };
  3882. _proto.handleUpdate = function handleUpdate() {
  3883. this._adjustDialog();
  3884. } // Private
  3885. ;
  3886. _proto._getConfig = function _getConfig(config) {
  3887. config = _objectSpread2({}, Default$3, {}, config);
  3888. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3889. return config;
  3890. };
  3891. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3892. var _this3 = this;
  3893. if (this._config.backdrop === 'static') {
  3894. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  3895. $(this._element).trigger(hideEventPrevented);
  3896. if (hideEventPrevented.defaultPrevented) {
  3897. return;
  3898. }
  3899. this._element.classList.add(ClassName$5.STATIC);
  3900. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3901. $(this._element).one(Util.TRANSITION_END, function () {
  3902. _this3._element.classList.remove(ClassName$5.STATIC);
  3903. }).emulateTransitionEnd(modalTransitionDuration);
  3904. this._element.focus();
  3905. } else {
  3906. this.hide();
  3907. }
  3908. };
  3909. _proto._showElement = function _showElement(relatedTarget) {
  3910. var _this4 = this;
  3911. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3912. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  3913. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3914. // Don't move modal's DOM position
  3915. document.body.appendChild(this._element);
  3916. }
  3917. this._element.style.display = 'block';
  3918. this._element.removeAttribute('aria-hidden');
  3919. this._element.setAttribute('aria-modal', true);
  3920. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  3921. modalBody.scrollTop = 0;
  3922. } else {
  3923. this._element.scrollTop = 0;
  3924. }
  3925. if (transition) {
  3926. Util.reflow(this._element);
  3927. }
  3928. $(this._element).addClass(ClassName$5.SHOW);
  3929. if (this._config.focus) {
  3930. this._enforceFocus();
  3931. }
  3932. var shownEvent = $.Event(Event$5.SHOWN, {
  3933. relatedTarget: relatedTarget
  3934. });
  3935. var transitionComplete = function transitionComplete() {
  3936. if (_this4._config.focus) {
  3937. _this4._element.focus();
  3938. }
  3939. _this4._isTransitioning = false;
  3940. $(_this4._element).trigger(shownEvent);
  3941. };
  3942. if (transition) {
  3943. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3944. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3945. } else {
  3946. transitionComplete();
  3947. }
  3948. };
  3949. _proto._enforceFocus = function _enforceFocus() {
  3950. var _this5 = this;
  3951. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  3952. .on(Event$5.FOCUSIN, function (event) {
  3953. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3954. _this5._element.focus();
  3955. }
  3956. });
  3957. };
  3958. _proto._setEscapeEvent = function _setEscapeEvent() {
  3959. var _this6 = this;
  3960. if (this._isShown && this._config.keyboard) {
  3961. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  3962. if (event.which === ESCAPE_KEYCODE$1) {
  3963. _this6._triggerBackdropTransition();
  3964. }
  3965. });
  3966. } else if (!this._isShown) {
  3967. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  3968. }
  3969. };
  3970. _proto._setResizeEvent = function _setResizeEvent() {
  3971. var _this7 = this;
  3972. if (this._isShown) {
  3973. $(window).on(Event$5.RESIZE, function (event) {
  3974. return _this7.handleUpdate(event);
  3975. });
  3976. } else {
  3977. $(window).off(Event$5.RESIZE);
  3978. }
  3979. };
  3980. _proto._hideModal = function _hideModal() {
  3981. var _this8 = this;
  3982. this._element.style.display = 'none';
  3983. this._element.setAttribute('aria-hidden', true);
  3984. this._element.removeAttribute('aria-modal');
  3985. this._isTransitioning = false;
  3986. this._showBackdrop(function () {
  3987. $(document.body).removeClass(ClassName$5.OPEN);
  3988. _this8._resetAdjustments();
  3989. _this8._resetScrollbar();
  3990. $(_this8._element).trigger(Event$5.HIDDEN);
  3991. });
  3992. };
  3993. _proto._removeBackdrop = function _removeBackdrop() {
  3994. if (this._backdrop) {
  3995. $(this._backdrop).remove();
  3996. this._backdrop = null;
  3997. }
  3998. };
  3999. _proto._showBackdrop = function _showBackdrop(callback) {
  4000. var _this9 = this;
  4001. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4002. if (this._isShown && this._config.backdrop) {
  4003. this._backdrop = document.createElement('div');
  4004. this._backdrop.className = ClassName$5.BACKDROP;
  4005. if (animate) {
  4006. this._backdrop.classList.add(animate);
  4007. }
  4008. $(this._backdrop).appendTo(document.body);
  4009. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4010. if (_this9._ignoreBackdropClick) {
  4011. _this9._ignoreBackdropClick = false;
  4012. return;
  4013. }
  4014. if (event.target !== event.currentTarget) {
  4015. return;
  4016. }
  4017. _this9._triggerBackdropTransition();
  4018. });
  4019. if (animate) {
  4020. Util.reflow(this._backdrop);
  4021. }
  4022. $(this._backdrop).addClass(ClassName$5.SHOW);
  4023. if (!callback) {
  4024. return;
  4025. }
  4026. if (!animate) {
  4027. callback();
  4028. return;
  4029. }
  4030. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4031. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4032. } else if (!this._isShown && this._backdrop) {
  4033. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4034. var callbackRemove = function callbackRemove() {
  4035. _this9._removeBackdrop();
  4036. if (callback) {
  4037. callback();
  4038. }
  4039. };
  4040. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4041. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4042. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4043. } else {
  4044. callbackRemove();
  4045. }
  4046. } else if (callback) {
  4047. callback();
  4048. }
  4049. } // ----------------------------------------------------------------------
  4050. // the following methods are used to handle overflowing modals
  4051. // todo (fat): these should probably be refactored out of modal.js
  4052. // ----------------------------------------------------------------------
  4053. ;
  4054. _proto._adjustDialog = function _adjustDialog() {
  4055. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4056. if (!this._isBodyOverflowing && isModalOverflowing) {
  4057. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4058. }
  4059. if (this._isBodyOverflowing && !isModalOverflowing) {
  4060. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4061. }
  4062. };
  4063. _proto._resetAdjustments = function _resetAdjustments() {
  4064. this._element.style.paddingLeft = '';
  4065. this._element.style.paddingRight = '';
  4066. };
  4067. _proto._checkScrollbar = function _checkScrollbar() {
  4068. var rect = document.body.getBoundingClientRect();
  4069. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4070. this._scrollbarWidth = this._getScrollbarWidth();
  4071. };
  4072. _proto._setScrollbar = function _setScrollbar() {
  4073. var _this10 = this;
  4074. if (this._isBodyOverflowing) {
  4075. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4076. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4077. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4078. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4079. $(fixedContent).each(function (index, element) {
  4080. var actualPadding = element.style.paddingRight;
  4081. var calculatedPadding = $(element).css('padding-right');
  4082. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4083. }); // Adjust sticky content margin
  4084. $(stickyContent).each(function (index, element) {
  4085. var actualMargin = element.style.marginRight;
  4086. var calculatedMargin = $(element).css('margin-right');
  4087. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4088. }); // Adjust body padding
  4089. var actualPadding = document.body.style.paddingRight;
  4090. var calculatedPadding = $(document.body).css('padding-right');
  4091. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4092. }
  4093. $(document.body).addClass(ClassName$5.OPEN);
  4094. };
  4095. _proto._resetScrollbar = function _resetScrollbar() {
  4096. // Restore fixed content padding
  4097. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4098. $(fixedContent).each(function (index, element) {
  4099. var padding = $(element).data('padding-right');
  4100. $(element).removeData('padding-right');
  4101. element.style.paddingRight = padding ? padding : '';
  4102. }); // Restore sticky content
  4103. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4104. $(elements).each(function (index, element) {
  4105. var margin = $(element).data('margin-right');
  4106. if (typeof margin !== 'undefined') {
  4107. $(element).css('margin-right', margin).removeData('margin-right');
  4108. }
  4109. }); // Restore body padding
  4110. var padding = $(document.body).data('padding-right');
  4111. $(document.body).removeData('padding-right');
  4112. document.body.style.paddingRight = padding ? padding : '';
  4113. };
  4114. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4115. // thx d.walsh
  4116. var scrollDiv = document.createElement('div');
  4117. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4118. document.body.appendChild(scrollDiv);
  4119. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4120. document.body.removeChild(scrollDiv);
  4121. return scrollbarWidth;
  4122. } // Static
  4123. ;
  4124. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4125. return this.each(function () {
  4126. var data = $(this).data(DATA_KEY$5);
  4127. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4128. if (!data) {
  4129. data = new Modal(this, _config);
  4130. $(this).data(DATA_KEY$5, data);
  4131. }
  4132. if (typeof config === 'string') {
  4133. if (typeof data[config] === 'undefined') {
  4134. throw new TypeError("No method named \"" + config + "\"");
  4135. }
  4136. data[config](relatedTarget);
  4137. } else if (_config.show) {
  4138. data.show(relatedTarget);
  4139. }
  4140. });
  4141. };
  4142. _createClass(Modal, null, [{
  4143. key: "VERSION",
  4144. get: function get() {
  4145. return VERSION$5;
  4146. }
  4147. }, {
  4148. key: "Default",
  4149. get: function get() {
  4150. return Default$3;
  4151. }
  4152. }]);
  4153. return Modal;
  4154. }();
  4155. /**
  4156. * ------------------------------------------------------------------------
  4157. * Data Api implementation
  4158. * ------------------------------------------------------------------------
  4159. */
  4160. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4161. var _this11 = this;
  4162. var target;
  4163. var selector = Util.getSelectorFromElement(this);
  4164. if (selector) {
  4165. target = document.querySelector(selector);
  4166. }
  4167. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4168. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4169. event.preventDefault();
  4170. }
  4171. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4172. if (showEvent.isDefaultPrevented()) {
  4173. // Only register focus restorer if modal will actually get shown
  4174. return;
  4175. }
  4176. $target.one(Event$5.HIDDEN, function () {
  4177. if ($(_this11).is(':visible')) {
  4178. _this11.focus();
  4179. }
  4180. });
  4181. });
  4182. Modal._jQueryInterface.call($(target), config, this);
  4183. });
  4184. /**
  4185. * ------------------------------------------------------------------------
  4186. * jQuery
  4187. * ------------------------------------------------------------------------
  4188. */
  4189. $.fn[NAME$5] = Modal._jQueryInterface;
  4190. $.fn[NAME$5].Constructor = Modal;
  4191. $.fn[NAME$5].noConflict = function () {
  4192. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4193. return Modal._jQueryInterface;
  4194. };
  4195. /**
  4196. * --------------------------------------------------------------------------
  4197. * Bootstrap (v4.4.1): tools/sanitizer.js
  4198. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4199. * --------------------------------------------------------------------------
  4200. */
  4201. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4202. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4203. var DefaultWhitelist = {
  4204. // Global attributes allowed on any supplied element below.
  4205. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4206. a: ['target', 'href', 'title', 'rel'],
  4207. area: [],
  4208. b: [],
  4209. br: [],
  4210. col: [],
  4211. code: [],
  4212. div: [],
  4213. em: [],
  4214. hr: [],
  4215. h1: [],
  4216. h2: [],
  4217. h3: [],
  4218. h4: [],
  4219. h5: [],
  4220. h6: [],
  4221. i: [],
  4222. img: ['src', 'alt', 'title', 'width', 'height'],
  4223. li: [],
  4224. ol: [],
  4225. p: [],
  4226. pre: [],
  4227. s: [],
  4228. small: [],
  4229. span: [],
  4230. sub: [],
  4231. sup: [],
  4232. strong: [],
  4233. u: [],
  4234. ul: []
  4235. };
  4236. /**
  4237. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4238. *
  4239. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4240. */
  4241. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4242. /**
  4243. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4244. *
  4245. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4246. */
  4247. var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
  4248. function allowedAttribute(attr, allowedAttributeList) {
  4249. var attrName = attr.nodeName.toLowerCase();
  4250. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4251. if (uriAttrs.indexOf(attrName) !== -1) {
  4252. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4253. }
  4254. return true;
  4255. }
  4256. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4257. return attrRegex instanceof RegExp;
  4258. }); // Check if a regular expression validates the attribute.
  4259. for (var i = 0, l = regExp.length; i < l; i++) {
  4260. if (attrName.match(regExp[i])) {
  4261. return true;
  4262. }
  4263. }
  4264. return false;
  4265. }
  4266. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4267. if (unsafeHtml.length === 0) {
  4268. return unsafeHtml;
  4269. }
  4270. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4271. return sanitizeFn(unsafeHtml);
  4272. }
  4273. var domParser = new window.DOMParser();
  4274. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4275. var whitelistKeys = Object.keys(whiteList);
  4276. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4277. var _loop = function _loop(i, len) {
  4278. var el = elements[i];
  4279. var elName = el.nodeName.toLowerCase();
  4280. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4281. el.parentNode.removeChild(el);
  4282. return "continue";
  4283. }
  4284. var attributeList = [].slice.call(el.attributes);
  4285. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4286. attributeList.forEach(function (attr) {
  4287. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4288. el.removeAttribute(attr.nodeName);
  4289. }
  4290. });
  4291. };
  4292. for (var i = 0, len = elements.length; i < len; i++) {
  4293. var _ret = _loop(i);
  4294. if (_ret === "continue") continue;
  4295. }
  4296. return createdDocument.body.innerHTML;
  4297. }
  4298. /**
  4299. * ------------------------------------------------------------------------
  4300. * Constants
  4301. * ------------------------------------------------------------------------
  4302. */
  4303. var NAME$6 = 'tooltip';
  4304. var VERSION$6 = '4.4.1';
  4305. var DATA_KEY$6 = 'bs.tooltip';
  4306. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4307. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4308. var CLASS_PREFIX = 'bs-tooltip';
  4309. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4310. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4311. var DefaultType$4 = {
  4312. animation: 'boolean',
  4313. template: 'string',
  4314. title: '(string|element|function)',
  4315. trigger: 'string',
  4316. delay: '(number|object)',
  4317. html: 'boolean',
  4318. selector: '(string|boolean)',
  4319. placement: '(string|function)',
  4320. offset: '(number|string|function)',
  4321. container: '(string|element|boolean)',
  4322. fallbackPlacement: '(string|array)',
  4323. boundary: '(string|element)',
  4324. sanitize: 'boolean',
  4325. sanitizeFn: '(null|function)',
  4326. whiteList: 'object',
  4327. popperConfig: '(null|object)'
  4328. };
  4329. var AttachmentMap$1 = {
  4330. AUTO: 'auto',
  4331. TOP: 'top',
  4332. RIGHT: 'right',
  4333. BOTTOM: 'bottom',
  4334. LEFT: 'left'
  4335. };
  4336. var Default$4 = {
  4337. animation: true,
  4338. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4339. trigger: 'hover focus',
  4340. title: '',
  4341. delay: 0,
  4342. html: false,
  4343. selector: false,
  4344. placement: 'top',
  4345. offset: 0,
  4346. container: false,
  4347. fallbackPlacement: 'flip',
  4348. boundary: 'scrollParent',
  4349. sanitize: true,
  4350. sanitizeFn: null,
  4351. whiteList: DefaultWhitelist,
  4352. popperConfig: null
  4353. };
  4354. var HoverState = {
  4355. SHOW: 'show',
  4356. OUT: 'out'
  4357. };
  4358. var Event$6 = {
  4359. HIDE: "hide" + EVENT_KEY$6,
  4360. HIDDEN: "hidden" + EVENT_KEY$6,
  4361. SHOW: "show" + EVENT_KEY$6,
  4362. SHOWN: "shown" + EVENT_KEY$6,
  4363. INSERTED: "inserted" + EVENT_KEY$6,
  4364. CLICK: "click" + EVENT_KEY$6,
  4365. FOCUSIN: "focusin" + EVENT_KEY$6,
  4366. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4367. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4368. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4369. };
  4370. var ClassName$6 = {
  4371. FADE: 'fade',
  4372. SHOW: 'show'
  4373. };
  4374. var Selector$6 = {
  4375. TOOLTIP: '.tooltip',
  4376. TOOLTIP_INNER: '.tooltip-inner',
  4377. ARROW: '.arrow'
  4378. };
  4379. var Trigger = {
  4380. HOVER: 'hover',
  4381. FOCUS: 'focus',
  4382. CLICK: 'click',
  4383. MANUAL: 'manual'
  4384. };
  4385. /**
  4386. * ------------------------------------------------------------------------
  4387. * Class Definition
  4388. * ------------------------------------------------------------------------
  4389. */
  4390. var Tooltip =
  4391. /*#__PURE__*/
  4392. function () {
  4393. function Tooltip(element, config) {
  4394. if (typeof Popper === 'undefined') {
  4395. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4396. } // private
  4397. this._isEnabled = true;
  4398. this._timeout = 0;
  4399. this._hoverState = '';
  4400. this._activeTrigger = {};
  4401. this._popper = null; // Protected
  4402. this.element = element;
  4403. this.config = this._getConfig(config);
  4404. this.tip = null;
  4405. this._setListeners();
  4406. } // Getters
  4407. var _proto = Tooltip.prototype;
  4408. // Public
  4409. _proto.enable = function enable() {
  4410. this._isEnabled = true;
  4411. };
  4412. _proto.disable = function disable() {
  4413. this._isEnabled = false;
  4414. };
  4415. _proto.toggleEnabled = function toggleEnabled() {
  4416. this._isEnabled = !this._isEnabled;
  4417. };
  4418. _proto.toggle = function toggle(event) {
  4419. if (!this._isEnabled) {
  4420. return;
  4421. }
  4422. if (event) {
  4423. var dataKey = this.constructor.DATA_KEY;
  4424. var context = $(event.currentTarget).data(dataKey);
  4425. if (!context) {
  4426. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4427. $(event.currentTarget).data(dataKey, context);
  4428. }
  4429. context._activeTrigger.click = !context._activeTrigger.click;
  4430. if (context._isWithActiveTrigger()) {
  4431. context._enter(null, context);
  4432. } else {
  4433. context._leave(null, context);
  4434. }
  4435. } else {
  4436. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4437. this._leave(null, this);
  4438. return;
  4439. }
  4440. this._enter(null, this);
  4441. }
  4442. };
  4443. _proto.dispose = function dispose() {
  4444. clearTimeout(this._timeout);
  4445. $.removeData(this.element, this.constructor.DATA_KEY);
  4446. $(this.element).off(this.constructor.EVENT_KEY);
  4447. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4448. if (this.tip) {
  4449. $(this.tip).remove();
  4450. }
  4451. this._isEnabled = null;
  4452. this._timeout = null;
  4453. this._hoverState = null;
  4454. this._activeTrigger = null;
  4455. if (this._popper) {
  4456. this._popper.destroy();
  4457. }
  4458. this._popper = null;
  4459. this.element = null;
  4460. this.config = null;
  4461. this.tip = null;
  4462. };
  4463. _proto.show = function show() {
  4464. var _this = this;
  4465. if ($(this.element).css('display') === 'none') {
  4466. throw new Error('Please use show on visible elements');
  4467. }
  4468. var showEvent = $.Event(this.constructor.Event.SHOW);
  4469. if (this.isWithContent() && this._isEnabled) {
  4470. $(this.element).trigger(showEvent);
  4471. var shadowRoot = Util.findShadowRoot(this.element);
  4472. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4473. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4474. return;
  4475. }
  4476. var tip = this.getTipElement();
  4477. var tipId = Util.getUID(this.constructor.NAME);
  4478. tip.setAttribute('id', tipId);
  4479. this.element.setAttribute('aria-describedby', tipId);
  4480. this.setContent();
  4481. if (this.config.animation) {
  4482. $(tip).addClass(ClassName$6.FADE);
  4483. }
  4484. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4485. var attachment = this._getAttachment(placement);
  4486. this.addAttachmentClass(attachment);
  4487. var container = this._getContainer();
  4488. $(tip).data(this.constructor.DATA_KEY, this);
  4489. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4490. $(tip).appendTo(container);
  4491. }
  4492. $(this.element).trigger(this.constructor.Event.INSERTED);
  4493. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4494. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4495. // empty mouseover listeners to the body's immediate children;
  4496. // only needed because of broken event delegation on iOS
  4497. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4498. if ('ontouchstart' in document.documentElement) {
  4499. $(document.body).children().on('mouseover', null, $.noop);
  4500. }
  4501. var complete = function complete() {
  4502. if (_this.config.animation) {
  4503. _this._fixTransition();
  4504. }
  4505. var prevHoverState = _this._hoverState;
  4506. _this._hoverState = null;
  4507. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4508. if (prevHoverState === HoverState.OUT) {
  4509. _this._leave(null, _this);
  4510. }
  4511. };
  4512. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4513. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4514. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4515. } else {
  4516. complete();
  4517. }
  4518. }
  4519. };
  4520. _proto.hide = function hide(callback) {
  4521. var _this2 = this;
  4522. var tip = this.getTipElement();
  4523. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4524. var complete = function complete() {
  4525. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4526. tip.parentNode.removeChild(tip);
  4527. }
  4528. _this2._cleanTipClass();
  4529. _this2.element.removeAttribute('aria-describedby');
  4530. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4531. if (_this2._popper !== null) {
  4532. _this2._popper.destroy();
  4533. }
  4534. if (callback) {
  4535. callback();
  4536. }
  4537. };
  4538. $(this.element).trigger(hideEvent);
  4539. if (hideEvent.isDefaultPrevented()) {
  4540. return;
  4541. }
  4542. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4543. // empty mouseover listeners we added for iOS support
  4544. if ('ontouchstart' in document.documentElement) {
  4545. $(document.body).children().off('mouseover', null, $.noop);
  4546. }
  4547. this._activeTrigger[Trigger.CLICK] = false;
  4548. this._activeTrigger[Trigger.FOCUS] = false;
  4549. this._activeTrigger[Trigger.HOVER] = false;
  4550. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4551. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4552. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4553. } else {
  4554. complete();
  4555. }
  4556. this._hoverState = '';
  4557. };
  4558. _proto.update = function update() {
  4559. if (this._popper !== null) {
  4560. this._popper.scheduleUpdate();
  4561. }
  4562. } // Protected
  4563. ;
  4564. _proto.isWithContent = function isWithContent() {
  4565. return Boolean(this.getTitle());
  4566. };
  4567. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4568. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4569. };
  4570. _proto.getTipElement = function getTipElement() {
  4571. this.tip = this.tip || $(this.config.template)[0];
  4572. return this.tip;
  4573. };
  4574. _proto.setContent = function setContent() {
  4575. var tip = this.getTipElement();
  4576. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4577. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4578. };
  4579. _proto.setElementContent = function setElementContent($element, content) {
  4580. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4581. // Content is a DOM node or a jQuery
  4582. if (this.config.html) {
  4583. if (!$(content).parent().is($element)) {
  4584. $element.empty().append(content);
  4585. }
  4586. } else {
  4587. $element.text($(content).text());
  4588. }
  4589. return;
  4590. }
  4591. if (this.config.html) {
  4592. if (this.config.sanitize) {
  4593. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4594. }
  4595. $element.html(content);
  4596. } else {
  4597. $element.text(content);
  4598. }
  4599. };
  4600. _proto.getTitle = function getTitle() {
  4601. var title = this.element.getAttribute('data-original-title');
  4602. if (!title) {
  4603. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4604. }
  4605. return title;
  4606. } // Private
  4607. ;
  4608. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4609. var _this3 = this;
  4610. var defaultBsConfig = {
  4611. placement: attachment,
  4612. modifiers: {
  4613. offset: this._getOffset(),
  4614. flip: {
  4615. behavior: this.config.fallbackPlacement
  4616. },
  4617. arrow: {
  4618. element: Selector$6.ARROW
  4619. },
  4620. preventOverflow: {
  4621. boundariesElement: this.config.boundary
  4622. }
  4623. },
  4624. onCreate: function onCreate(data) {
  4625. if (data.originalPlacement !== data.placement) {
  4626. _this3._handlePopperPlacementChange(data);
  4627. }
  4628. },
  4629. onUpdate: function onUpdate(data) {
  4630. return _this3._handlePopperPlacementChange(data);
  4631. }
  4632. };
  4633. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4634. };
  4635. _proto._getOffset = function _getOffset() {
  4636. var _this4 = this;
  4637. var offset = {};
  4638. if (typeof this.config.offset === 'function') {
  4639. offset.fn = function (data) {
  4640. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4641. return data;
  4642. };
  4643. } else {
  4644. offset.offset = this.config.offset;
  4645. }
  4646. return offset;
  4647. };
  4648. _proto._getContainer = function _getContainer() {
  4649. if (this.config.container === false) {
  4650. return document.body;
  4651. }
  4652. if (Util.isElement(this.config.container)) {
  4653. return $(this.config.container);
  4654. }
  4655. return $(document).find(this.config.container);
  4656. };
  4657. _proto._getAttachment = function _getAttachment(placement) {
  4658. return AttachmentMap$1[placement.toUpperCase()];
  4659. };
  4660. _proto._setListeners = function _setListeners() {
  4661. var _this5 = this;
  4662. var triggers = this.config.trigger.split(' ');
  4663. triggers.forEach(function (trigger) {
  4664. if (trigger === 'click') {
  4665. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4666. return _this5.toggle(event);
  4667. });
  4668. } else if (trigger !== Trigger.MANUAL) {
  4669. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4670. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4671. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4672. return _this5._enter(event);
  4673. }).on(eventOut, _this5.config.selector, function (event) {
  4674. return _this5._leave(event);
  4675. });
  4676. }
  4677. });
  4678. this._hideModalHandler = function () {
  4679. if (_this5.element) {
  4680. _this5.hide();
  4681. }
  4682. };
  4683. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4684. if (this.config.selector) {
  4685. this.config = _objectSpread2({}, this.config, {
  4686. trigger: 'manual',
  4687. selector: ''
  4688. });
  4689. } else {
  4690. this._fixTitle();
  4691. }
  4692. };
  4693. _proto._fixTitle = function _fixTitle() {
  4694. var titleType = typeof this.element.getAttribute('data-original-title');
  4695. if (this.element.getAttribute('title') || titleType !== 'string') {
  4696. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4697. this.element.setAttribute('title', '');
  4698. }
  4699. };
  4700. _proto._enter = function _enter(event, context) {
  4701. var dataKey = this.constructor.DATA_KEY;
  4702. context = context || $(event.currentTarget).data(dataKey);
  4703. if (!context) {
  4704. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4705. $(event.currentTarget).data(dataKey, context);
  4706. }
  4707. if (event) {
  4708. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4709. }
  4710. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4711. context._hoverState = HoverState.SHOW;
  4712. return;
  4713. }
  4714. clearTimeout(context._timeout);
  4715. context._hoverState = HoverState.SHOW;
  4716. if (!context.config.delay || !context.config.delay.show) {
  4717. context.show();
  4718. return;
  4719. }
  4720. context._timeout = setTimeout(function () {
  4721. if (context._hoverState === HoverState.SHOW) {
  4722. context.show();
  4723. }
  4724. }, context.config.delay.show);
  4725. };
  4726. _proto._leave = function _leave(event, context) {
  4727. var dataKey = this.constructor.DATA_KEY;
  4728. context = context || $(event.currentTarget).data(dataKey);
  4729. if (!context) {
  4730. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4731. $(event.currentTarget).data(dataKey, context);
  4732. }
  4733. if (event) {
  4734. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4735. }
  4736. if (context._isWithActiveTrigger()) {
  4737. return;
  4738. }
  4739. clearTimeout(context._timeout);
  4740. context._hoverState = HoverState.OUT;
  4741. if (!context.config.delay || !context.config.delay.hide) {
  4742. context.hide();
  4743. return;
  4744. }
  4745. context._timeout = setTimeout(function () {
  4746. if (context._hoverState === HoverState.OUT) {
  4747. context.hide();
  4748. }
  4749. }, context.config.delay.hide);
  4750. };
  4751. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4752. for (var trigger in this._activeTrigger) {
  4753. if (this._activeTrigger[trigger]) {
  4754. return true;
  4755. }
  4756. }
  4757. return false;
  4758. };
  4759. _proto._getConfig = function _getConfig(config) {
  4760. var dataAttributes = $(this.element).data();
  4761. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4762. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4763. delete dataAttributes[dataAttr];
  4764. }
  4765. });
  4766. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4767. if (typeof config.delay === 'number') {
  4768. config.delay = {
  4769. show: config.delay,
  4770. hide: config.delay
  4771. };
  4772. }
  4773. if (typeof config.title === 'number') {
  4774. config.title = config.title.toString();
  4775. }
  4776. if (typeof config.content === 'number') {
  4777. config.content = config.content.toString();
  4778. }
  4779. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4780. if (config.sanitize) {
  4781. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4782. }
  4783. return config;
  4784. };
  4785. _proto._getDelegateConfig = function _getDelegateConfig() {
  4786. var config = {};
  4787. if (this.config) {
  4788. for (var key in this.config) {
  4789. if (this.constructor.Default[key] !== this.config[key]) {
  4790. config[key] = this.config[key];
  4791. }
  4792. }
  4793. }
  4794. return config;
  4795. };
  4796. _proto._cleanTipClass = function _cleanTipClass() {
  4797. var $tip = $(this.getTipElement());
  4798. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4799. if (tabClass !== null && tabClass.length) {
  4800. $tip.removeClass(tabClass.join(''));
  4801. }
  4802. };
  4803. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4804. var popperInstance = popperData.instance;
  4805. this.tip = popperInstance.popper;
  4806. this._cleanTipClass();
  4807. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4808. };
  4809. _proto._fixTransition = function _fixTransition() {
  4810. var tip = this.getTipElement();
  4811. var initConfigAnimation = this.config.animation;
  4812. if (tip.getAttribute('x-placement') !== null) {
  4813. return;
  4814. }
  4815. $(tip).removeClass(ClassName$6.FADE);
  4816. this.config.animation = false;
  4817. this.hide();
  4818. this.show();
  4819. this.config.animation = initConfigAnimation;
  4820. } // Static
  4821. ;
  4822. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4823. return this.each(function () {
  4824. var data = $(this).data(DATA_KEY$6);
  4825. var _config = typeof config === 'object' && config;
  4826. if (!data && /dispose|hide/.test(config)) {
  4827. return;
  4828. }
  4829. if (!data) {
  4830. data = new Tooltip(this, _config);
  4831. $(this).data(DATA_KEY$6, data);
  4832. }
  4833. if (typeof config === 'string') {
  4834. if (typeof data[config] === 'undefined') {
  4835. throw new TypeError("No method named \"" + config + "\"");
  4836. }
  4837. data[config]();
  4838. }
  4839. });
  4840. };
  4841. _createClass(Tooltip, null, [{
  4842. key: "VERSION",
  4843. get: function get() {
  4844. return VERSION$6;
  4845. }
  4846. }, {
  4847. key: "Default",
  4848. get: function get() {
  4849. return Default$4;
  4850. }
  4851. }, {
  4852. key: "NAME",
  4853. get: function get() {
  4854. return NAME$6;
  4855. }
  4856. }, {
  4857. key: "DATA_KEY",
  4858. get: function get() {
  4859. return DATA_KEY$6;
  4860. }
  4861. }, {
  4862. key: "Event",
  4863. get: function get() {
  4864. return Event$6;
  4865. }
  4866. }, {
  4867. key: "EVENT_KEY",
  4868. get: function get() {
  4869. return EVENT_KEY$6;
  4870. }
  4871. }, {
  4872. key: "DefaultType",
  4873. get: function get() {
  4874. return DefaultType$4;
  4875. }
  4876. }]);
  4877. return Tooltip;
  4878. }();
  4879. /**
  4880. * ------------------------------------------------------------------------
  4881. * jQuery
  4882. * ------------------------------------------------------------------------
  4883. */
  4884. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4885. $.fn[NAME$6].Constructor = Tooltip;
  4886. $.fn[NAME$6].noConflict = function () {
  4887. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4888. return Tooltip._jQueryInterface;
  4889. };
  4890. /**
  4891. * ------------------------------------------------------------------------
  4892. * Constants
  4893. * ------------------------------------------------------------------------
  4894. */
  4895. var NAME$7 = 'popover';
  4896. var VERSION$7 = '4.4.1';
  4897. var DATA_KEY$7 = 'bs.popover';
  4898. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4899. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4900. var CLASS_PREFIX$1 = 'bs-popover';
  4901. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4902. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  4903. placement: 'right',
  4904. trigger: 'click',
  4905. content: '',
  4906. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4907. });
  4908. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  4909. content: '(string|element|function)'
  4910. });
  4911. var ClassName$7 = {
  4912. FADE: 'fade',
  4913. SHOW: 'show'
  4914. };
  4915. var Selector$7 = {
  4916. TITLE: '.popover-header',
  4917. CONTENT: '.popover-body'
  4918. };
  4919. var Event$7 = {
  4920. HIDE: "hide" + EVENT_KEY$7,
  4921. HIDDEN: "hidden" + EVENT_KEY$7,
  4922. SHOW: "show" + EVENT_KEY$7,
  4923. SHOWN: "shown" + EVENT_KEY$7,
  4924. INSERTED: "inserted" + EVENT_KEY$7,
  4925. CLICK: "click" + EVENT_KEY$7,
  4926. FOCUSIN: "focusin" + EVENT_KEY$7,
  4927. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4928. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4929. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4930. };
  4931. /**
  4932. * ------------------------------------------------------------------------
  4933. * Class Definition
  4934. * ------------------------------------------------------------------------
  4935. */
  4936. var Popover =
  4937. /*#__PURE__*/
  4938. function (_Tooltip) {
  4939. _inheritsLoose(Popover, _Tooltip);
  4940. function Popover() {
  4941. return _Tooltip.apply(this, arguments) || this;
  4942. }
  4943. var _proto = Popover.prototype;
  4944. // Overrides
  4945. _proto.isWithContent = function isWithContent() {
  4946. return this.getTitle() || this._getContent();
  4947. };
  4948. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4949. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4950. };
  4951. _proto.getTipElement = function getTipElement() {
  4952. this.tip = this.tip || $(this.config.template)[0];
  4953. return this.tip;
  4954. };
  4955. _proto.setContent = function setContent() {
  4956. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4957. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4958. var content = this._getContent();
  4959. if (typeof content === 'function') {
  4960. content = content.call(this.element);
  4961. }
  4962. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4963. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4964. } // Private
  4965. ;
  4966. _proto._getContent = function _getContent() {
  4967. return this.element.getAttribute('data-content') || this.config.content;
  4968. };
  4969. _proto._cleanTipClass = function _cleanTipClass() {
  4970. var $tip = $(this.getTipElement());
  4971. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4972. if (tabClass !== null && tabClass.length > 0) {
  4973. $tip.removeClass(tabClass.join(''));
  4974. }
  4975. } // Static
  4976. ;
  4977. Popover._jQueryInterface = function _jQueryInterface(config) {
  4978. return this.each(function () {
  4979. var data = $(this).data(DATA_KEY$7);
  4980. var _config = typeof config === 'object' ? config : null;
  4981. if (!data && /dispose|hide/.test(config)) {
  4982. return;
  4983. }
  4984. if (!data) {
  4985. data = new Popover(this, _config);
  4986. $(this).data(DATA_KEY$7, data);
  4987. }
  4988. if (typeof config === 'string') {
  4989. if (typeof data[config] === 'undefined') {
  4990. throw new TypeError("No method named \"" + config + "\"");
  4991. }
  4992. data[config]();
  4993. }
  4994. });
  4995. };
  4996. _createClass(Popover, null, [{
  4997. key: "VERSION",
  4998. // Getters
  4999. get: function get() {
  5000. return VERSION$7;
  5001. }
  5002. }, {
  5003. key: "Default",
  5004. get: function get() {
  5005. return Default$5;
  5006. }
  5007. }, {
  5008. key: "NAME",
  5009. get: function get() {
  5010. return NAME$7;
  5011. }
  5012. }, {
  5013. key: "DATA_KEY",
  5014. get: function get() {
  5015. return DATA_KEY$7;
  5016. }
  5017. }, {
  5018. key: "Event",
  5019. get: function get() {
  5020. return Event$7;
  5021. }
  5022. }, {
  5023. key: "EVENT_KEY",
  5024. get: function get() {
  5025. return EVENT_KEY$7;
  5026. }
  5027. }, {
  5028. key: "DefaultType",
  5029. get: function get() {
  5030. return DefaultType$5;
  5031. }
  5032. }]);
  5033. return Popover;
  5034. }(Tooltip);
  5035. /**
  5036. * ------------------------------------------------------------------------
  5037. * jQuery
  5038. * ------------------------------------------------------------------------
  5039. */
  5040. $.fn[NAME$7] = Popover._jQueryInterface;
  5041. $.fn[NAME$7].Constructor = Popover;
  5042. $.fn[NAME$7].noConflict = function () {
  5043. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5044. return Popover._jQueryInterface;
  5045. };
  5046. /**
  5047. * ------------------------------------------------------------------------
  5048. * Constants
  5049. * ------------------------------------------------------------------------
  5050. */
  5051. var NAME$8 = 'scrollspy';
  5052. var VERSION$8 = '4.4.1';
  5053. var DATA_KEY$8 = 'bs.scrollspy';
  5054. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5055. var DATA_API_KEY$6 = '.data-api';
  5056. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5057. var Default$6 = {
  5058. offset: 10,
  5059. method: 'auto',
  5060. target: ''
  5061. };
  5062. var DefaultType$6 = {
  5063. offset: 'number',
  5064. method: 'string',
  5065. target: '(string|element)'
  5066. };
  5067. var Event$8 = {
  5068. ACTIVATE: "activate" + EVENT_KEY$8,
  5069. SCROLL: "scroll" + EVENT_KEY$8,
  5070. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5071. };
  5072. var ClassName$8 = {
  5073. DROPDOWN_ITEM: 'dropdown-item',
  5074. DROPDOWN_MENU: 'dropdown-menu',
  5075. ACTIVE: 'active'
  5076. };
  5077. var Selector$8 = {
  5078. DATA_SPY: '[data-spy="scroll"]',
  5079. ACTIVE: '.active',
  5080. NAV_LIST_GROUP: '.nav, .list-group',
  5081. NAV_LINKS: '.nav-link',
  5082. NAV_ITEMS: '.nav-item',
  5083. LIST_ITEMS: '.list-group-item',
  5084. DROPDOWN: '.dropdown',
  5085. DROPDOWN_ITEMS: '.dropdown-item',
  5086. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5087. };
  5088. var OffsetMethod = {
  5089. OFFSET: 'offset',
  5090. POSITION: 'position'
  5091. };
  5092. /**
  5093. * ------------------------------------------------------------------------
  5094. * Class Definition
  5095. * ------------------------------------------------------------------------
  5096. */
  5097. var ScrollSpy =
  5098. /*#__PURE__*/
  5099. function () {
  5100. function ScrollSpy(element, config) {
  5101. var _this = this;
  5102. this._element = element;
  5103. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5104. this._config = this._getConfig(config);
  5105. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5106. this._offsets = [];
  5107. this._targets = [];
  5108. this._activeTarget = null;
  5109. this._scrollHeight = 0;
  5110. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5111. return _this._process(event);
  5112. });
  5113. this.refresh();
  5114. this._process();
  5115. } // Getters
  5116. var _proto = ScrollSpy.prototype;
  5117. // Public
  5118. _proto.refresh = function refresh() {
  5119. var _this2 = this;
  5120. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5121. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5122. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5123. this._offsets = [];
  5124. this._targets = [];
  5125. this._scrollHeight = this._getScrollHeight();
  5126. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5127. targets.map(function (element) {
  5128. var target;
  5129. var targetSelector = Util.getSelectorFromElement(element);
  5130. if (targetSelector) {
  5131. target = document.querySelector(targetSelector);
  5132. }
  5133. if (target) {
  5134. var targetBCR = target.getBoundingClientRect();
  5135. if (targetBCR.width || targetBCR.height) {
  5136. // TODO (fat): remove sketch reliance on jQuery position/offset
  5137. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5138. }
  5139. }
  5140. return null;
  5141. }).filter(function (item) {
  5142. return item;
  5143. }).sort(function (a, b) {
  5144. return a[0] - b[0];
  5145. }).forEach(function (item) {
  5146. _this2._offsets.push(item[0]);
  5147. _this2._targets.push(item[1]);
  5148. });
  5149. };
  5150. _proto.dispose = function dispose() {
  5151. $.removeData(this._element, DATA_KEY$8);
  5152. $(this._scrollElement).off(EVENT_KEY$8);
  5153. this._element = null;
  5154. this._scrollElement = null;
  5155. this._config = null;
  5156. this._selector = null;
  5157. this._offsets = null;
  5158. this._targets = null;
  5159. this._activeTarget = null;
  5160. this._scrollHeight = null;
  5161. } // Private
  5162. ;
  5163. _proto._getConfig = function _getConfig(config) {
  5164. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5165. if (typeof config.target !== 'string') {
  5166. var id = $(config.target).attr('id');
  5167. if (!id) {
  5168. id = Util.getUID(NAME$8);
  5169. $(config.target).attr('id', id);
  5170. }
  5171. config.target = "#" + id;
  5172. }
  5173. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5174. return config;
  5175. };
  5176. _proto._getScrollTop = function _getScrollTop() {
  5177. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5178. };
  5179. _proto._getScrollHeight = function _getScrollHeight() {
  5180. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5181. };
  5182. _proto._getOffsetHeight = function _getOffsetHeight() {
  5183. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5184. };
  5185. _proto._process = function _process() {
  5186. var scrollTop = this._getScrollTop() + this._config.offset;
  5187. var scrollHeight = this._getScrollHeight();
  5188. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5189. if (this._scrollHeight !== scrollHeight) {
  5190. this.refresh();
  5191. }
  5192. if (scrollTop >= maxScroll) {
  5193. var target = this._targets[this._targets.length - 1];
  5194. if (this._activeTarget !== target) {
  5195. this._activate(target);
  5196. }
  5197. return;
  5198. }
  5199. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5200. this._activeTarget = null;
  5201. this._clear();
  5202. return;
  5203. }
  5204. var offsetLength = this._offsets.length;
  5205. for (var i = offsetLength; i--;) {
  5206. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5207. if (isActiveTarget) {
  5208. this._activate(this._targets[i]);
  5209. }
  5210. }
  5211. };
  5212. _proto._activate = function _activate(target) {
  5213. this._activeTarget = target;
  5214. this._clear();
  5215. var queries = this._selector.split(',').map(function (selector) {
  5216. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5217. });
  5218. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5219. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5220. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5221. $link.addClass(ClassName$8.ACTIVE);
  5222. } else {
  5223. // Set triggered link as active
  5224. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5225. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5226. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
  5227. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5228. }
  5229. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5230. relatedTarget: target
  5231. });
  5232. };
  5233. _proto._clear = function _clear() {
  5234. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5235. return node.classList.contains(ClassName$8.ACTIVE);
  5236. }).forEach(function (node) {
  5237. return node.classList.remove(ClassName$8.ACTIVE);
  5238. });
  5239. } // Static
  5240. ;
  5241. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5242. return this.each(function () {
  5243. var data = $(this).data(DATA_KEY$8);
  5244. var _config = typeof config === 'object' && config;
  5245. if (!data) {
  5246. data = new ScrollSpy(this, _config);
  5247. $(this).data(DATA_KEY$8, data);
  5248. }
  5249. if (typeof config === 'string') {
  5250. if (typeof data[config] === 'undefined') {
  5251. throw new TypeError("No method named \"" + config + "\"");
  5252. }
  5253. data[config]();
  5254. }
  5255. });
  5256. };
  5257. _createClass(ScrollSpy, null, [{
  5258. key: "VERSION",
  5259. get: function get() {
  5260. return VERSION$8;
  5261. }
  5262. }, {
  5263. key: "Default",
  5264. get: function get() {
  5265. return Default$6;
  5266. }
  5267. }]);
  5268. return ScrollSpy;
  5269. }();
  5270. /**
  5271. * ------------------------------------------------------------------------
  5272. * Data Api implementation
  5273. * ------------------------------------------------------------------------
  5274. */
  5275. $(window).on(Event$8.LOAD_DATA_API, function () {
  5276. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5277. var scrollSpysLength = scrollSpys.length;
  5278. for (var i = scrollSpysLength; i--;) {
  5279. var $spy = $(scrollSpys[i]);
  5280. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5281. }
  5282. });
  5283. /**
  5284. * ------------------------------------------------------------------------
  5285. * jQuery
  5286. * ------------------------------------------------------------------------
  5287. */
  5288. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5289. $.fn[NAME$8].Constructor = ScrollSpy;
  5290. $.fn[NAME$8].noConflict = function () {
  5291. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5292. return ScrollSpy._jQueryInterface;
  5293. };
  5294. /**
  5295. * ------------------------------------------------------------------------
  5296. * Constants
  5297. * ------------------------------------------------------------------------
  5298. */
  5299. var NAME$9 = 'tab';
  5300. var VERSION$9 = '4.4.1';
  5301. var DATA_KEY$9 = 'bs.tab';
  5302. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5303. var DATA_API_KEY$7 = '.data-api';
  5304. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5305. var Event$9 = {
  5306. HIDE: "hide" + EVENT_KEY$9,
  5307. HIDDEN: "hidden" + EVENT_KEY$9,
  5308. SHOW: "show" + EVENT_KEY$9,
  5309. SHOWN: "shown" + EVENT_KEY$9,
  5310. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5311. };
  5312. var ClassName$9 = {
  5313. DROPDOWN_MENU: 'dropdown-menu',
  5314. ACTIVE: 'active',
  5315. DISABLED: 'disabled',
  5316. FADE: 'fade',
  5317. SHOW: 'show'
  5318. };
  5319. var Selector$9 = {
  5320. DROPDOWN: '.dropdown',
  5321. NAV_LIST_GROUP: '.nav, .list-group',
  5322. ACTIVE: '.active',
  5323. ACTIVE_UL: '> li > .active',
  5324. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5325. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5326. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5327. };
  5328. /**
  5329. * ------------------------------------------------------------------------
  5330. * Class Definition
  5331. * ------------------------------------------------------------------------
  5332. */
  5333. var Tab =
  5334. /*#__PURE__*/
  5335. function () {
  5336. function Tab(element) {
  5337. this._element = element;
  5338. } // Getters
  5339. var _proto = Tab.prototype;
  5340. // Public
  5341. _proto.show = function show() {
  5342. var _this = this;
  5343. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5344. return;
  5345. }
  5346. var target;
  5347. var previous;
  5348. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5349. var selector = Util.getSelectorFromElement(this._element);
  5350. if (listElement) {
  5351. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5352. previous = $.makeArray($(listElement).find(itemSelector));
  5353. previous = previous[previous.length - 1];
  5354. }
  5355. var hideEvent = $.Event(Event$9.HIDE, {
  5356. relatedTarget: this._element
  5357. });
  5358. var showEvent = $.Event(Event$9.SHOW, {
  5359. relatedTarget: previous
  5360. });
  5361. if (previous) {
  5362. $(previous).trigger(hideEvent);
  5363. }
  5364. $(this._element).trigger(showEvent);
  5365. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5366. return;
  5367. }
  5368. if (selector) {
  5369. target = document.querySelector(selector);
  5370. }
  5371. this._activate(this._element, listElement);
  5372. var complete = function complete() {
  5373. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5374. relatedTarget: _this._element
  5375. });
  5376. var shownEvent = $.Event(Event$9.SHOWN, {
  5377. relatedTarget: previous
  5378. });
  5379. $(previous).trigger(hiddenEvent);
  5380. $(_this._element).trigger(shownEvent);
  5381. };
  5382. if (target) {
  5383. this._activate(target, target.parentNode, complete);
  5384. } else {
  5385. complete();
  5386. }
  5387. };
  5388. _proto.dispose = function dispose() {
  5389. $.removeData(this._element, DATA_KEY$9);
  5390. this._element = null;
  5391. } // Private
  5392. ;
  5393. _proto._activate = function _activate(element, container, callback) {
  5394. var _this2 = this;
  5395. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5396. var active = activeElements[0];
  5397. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5398. var complete = function complete() {
  5399. return _this2._transitionComplete(element, active, callback);
  5400. };
  5401. if (active && isTransitioning) {
  5402. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5403. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5404. } else {
  5405. complete();
  5406. }
  5407. };
  5408. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5409. if (active) {
  5410. $(active).removeClass(ClassName$9.ACTIVE);
  5411. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5412. if (dropdownChild) {
  5413. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5414. }
  5415. if (active.getAttribute('role') === 'tab') {
  5416. active.setAttribute('aria-selected', false);
  5417. }
  5418. }
  5419. $(element).addClass(ClassName$9.ACTIVE);
  5420. if (element.getAttribute('role') === 'tab') {
  5421. element.setAttribute('aria-selected', true);
  5422. }
  5423. Util.reflow(element);
  5424. if (element.classList.contains(ClassName$9.FADE)) {
  5425. element.classList.add(ClassName$9.SHOW);
  5426. }
  5427. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5428. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5429. if (dropdownElement) {
  5430. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5431. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5432. }
  5433. element.setAttribute('aria-expanded', true);
  5434. }
  5435. if (callback) {
  5436. callback();
  5437. }
  5438. } // Static
  5439. ;
  5440. Tab._jQueryInterface = function _jQueryInterface(config) {
  5441. return this.each(function () {
  5442. var $this = $(this);
  5443. var data = $this.data(DATA_KEY$9);
  5444. if (!data) {
  5445. data = new Tab(this);
  5446. $this.data(DATA_KEY$9, data);
  5447. }
  5448. if (typeof config === 'string') {
  5449. if (typeof data[config] === 'undefined') {
  5450. throw new TypeError("No method named \"" + config + "\"");
  5451. }
  5452. data[config]();
  5453. }
  5454. });
  5455. };
  5456. _createClass(Tab, null, [{
  5457. key: "VERSION",
  5458. get: function get() {
  5459. return VERSION$9;
  5460. }
  5461. }]);
  5462. return Tab;
  5463. }();
  5464. /**
  5465. * ------------------------------------------------------------------------
  5466. * Data Api implementation
  5467. * ------------------------------------------------------------------------
  5468. */
  5469. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5470. event.preventDefault();
  5471. Tab._jQueryInterface.call($(this), 'show');
  5472. });
  5473. /**
  5474. * ------------------------------------------------------------------------
  5475. * jQuery
  5476. * ------------------------------------------------------------------------
  5477. */
  5478. $.fn[NAME$9] = Tab._jQueryInterface;
  5479. $.fn[NAME$9].Constructor = Tab;
  5480. $.fn[NAME$9].noConflict = function () {
  5481. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5482. return Tab._jQueryInterface;
  5483. };
  5484. /**
  5485. * ------------------------------------------------------------------------
  5486. * Constants
  5487. * ------------------------------------------------------------------------
  5488. */
  5489. var NAME$a = 'toast';
  5490. var VERSION$a = '4.4.1';
  5491. var DATA_KEY$a = 'bs.toast';
  5492. var EVENT_KEY$a = "." + DATA_KEY$a;
  5493. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5494. var Event$a = {
  5495. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5496. HIDE: "hide" + EVENT_KEY$a,
  5497. HIDDEN: "hidden" + EVENT_KEY$a,
  5498. SHOW: "show" + EVENT_KEY$a,
  5499. SHOWN: "shown" + EVENT_KEY$a
  5500. };
  5501. var ClassName$a = {
  5502. FADE: 'fade',
  5503. HIDE: 'hide',
  5504. SHOW: 'show',
  5505. SHOWING: 'showing'
  5506. };
  5507. var DefaultType$7 = {
  5508. animation: 'boolean',
  5509. autohide: 'boolean',
  5510. delay: 'number'
  5511. };
  5512. var Default$7 = {
  5513. animation: true,
  5514. autohide: true,
  5515. delay: 500
  5516. };
  5517. var Selector$a = {
  5518. DATA_DISMISS: '[data-dismiss="toast"]'
  5519. };
  5520. /**
  5521. * ------------------------------------------------------------------------
  5522. * Class Definition
  5523. * ------------------------------------------------------------------------
  5524. */
  5525. var Toast =
  5526. /*#__PURE__*/
  5527. function () {
  5528. function Toast(element, config) {
  5529. this._element = element;
  5530. this._config = this._getConfig(config);
  5531. this._timeout = null;
  5532. this._setListeners();
  5533. } // Getters
  5534. var _proto = Toast.prototype;
  5535. // Public
  5536. _proto.show = function show() {
  5537. var _this = this;
  5538. var showEvent = $.Event(Event$a.SHOW);
  5539. $(this._element).trigger(showEvent);
  5540. if (showEvent.isDefaultPrevented()) {
  5541. return;
  5542. }
  5543. if (this._config.animation) {
  5544. this._element.classList.add(ClassName$a.FADE);
  5545. }
  5546. var complete = function complete() {
  5547. _this._element.classList.remove(ClassName$a.SHOWING);
  5548. _this._element.classList.add(ClassName$a.SHOW);
  5549. $(_this._element).trigger(Event$a.SHOWN);
  5550. if (_this._config.autohide) {
  5551. _this._timeout = setTimeout(function () {
  5552. _this.hide();
  5553. }, _this._config.delay);
  5554. }
  5555. };
  5556. this._element.classList.remove(ClassName$a.HIDE);
  5557. Util.reflow(this._element);
  5558. this._element.classList.add(ClassName$a.SHOWING);
  5559. if (this._config.animation) {
  5560. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5561. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5562. } else {
  5563. complete();
  5564. }
  5565. };
  5566. _proto.hide = function hide() {
  5567. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5568. return;
  5569. }
  5570. var hideEvent = $.Event(Event$a.HIDE);
  5571. $(this._element).trigger(hideEvent);
  5572. if (hideEvent.isDefaultPrevented()) {
  5573. return;
  5574. }
  5575. this._close();
  5576. };
  5577. _proto.dispose = function dispose() {
  5578. clearTimeout(this._timeout);
  5579. this._timeout = null;
  5580. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5581. this._element.classList.remove(ClassName$a.SHOW);
  5582. }
  5583. $(this._element).off(Event$a.CLICK_DISMISS);
  5584. $.removeData(this._element, DATA_KEY$a);
  5585. this._element = null;
  5586. this._config = null;
  5587. } // Private
  5588. ;
  5589. _proto._getConfig = function _getConfig(config) {
  5590. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5591. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5592. return config;
  5593. };
  5594. _proto._setListeners = function _setListeners() {
  5595. var _this2 = this;
  5596. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5597. return _this2.hide();
  5598. });
  5599. };
  5600. _proto._close = function _close() {
  5601. var _this3 = this;
  5602. var complete = function complete() {
  5603. _this3._element.classList.add(ClassName$a.HIDE);
  5604. $(_this3._element).trigger(Event$a.HIDDEN);
  5605. };
  5606. this._element.classList.remove(ClassName$a.SHOW);
  5607. if (this._config.animation) {
  5608. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5609. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5610. } else {
  5611. complete();
  5612. }
  5613. } // Static
  5614. ;
  5615. Toast._jQueryInterface = function _jQueryInterface(config) {
  5616. return this.each(function () {
  5617. var $element = $(this);
  5618. var data = $element.data(DATA_KEY$a);
  5619. var _config = typeof config === 'object' && config;
  5620. if (!data) {
  5621. data = new Toast(this, _config);
  5622. $element.data(DATA_KEY$a, data);
  5623. }
  5624. if (typeof config === 'string') {
  5625. if (typeof data[config] === 'undefined') {
  5626. throw new TypeError("No method named \"" + config + "\"");
  5627. }
  5628. data[config](this);
  5629. }
  5630. });
  5631. };
  5632. _createClass(Toast, null, [{
  5633. key: "VERSION",
  5634. get: function get() {
  5635. return VERSION$a;
  5636. }
  5637. }, {
  5638. key: "DefaultType",
  5639. get: function get() {
  5640. return DefaultType$7;
  5641. }
  5642. }, {
  5643. key: "Default",
  5644. get: function get() {
  5645. return Default$7;
  5646. }
  5647. }]);
  5648. return Toast;
  5649. }();
  5650. /**
  5651. * ------------------------------------------------------------------------
  5652. * jQuery
  5653. * ------------------------------------------------------------------------
  5654. */
  5655. $.fn[NAME$a] = Toast._jQueryInterface;
  5656. $.fn[NAME$a].Constructor = Toast;
  5657. $.fn[NAME$a].noConflict = function () {
  5658. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5659. return Toast._jQueryInterface;
  5660. };
  5661. exports.Alert = Alert;
  5662. exports.Button = Button;
  5663. exports.Carousel = Carousel;
  5664. exports.Collapse = Collapse;
  5665. exports.Dropdown = Dropdown;
  5666. exports.Modal = Modal;
  5667. exports.Popover = Popover;
  5668. exports.Scrollspy = ScrollSpy;
  5669. exports.Tab = Tab;
  5670. exports.Toast = Toast;
  5671. exports.Tooltip = Tooltip;
  5672. exports.Util = Util;
  5673. Object.defineProperty(exports, '__esModule', { value: true });
  5674. })));
  5675. //# sourceMappingURL=bootstrap.js.map
  5676. /***/ }),
  5677. /***/ "./node_modules/buffer/index.js":
  5678. /*!**************************************!*\
  5679. !*** ./node_modules/buffer/index.js ***!
  5680. \**************************************/
  5681. /*! no static exports found */
  5682. /***/ (function(module, exports, __webpack_require__) {
  5683. "use strict";
  5684. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5685. * The buffer module from node.js, for the browser.
  5686. *
  5687. * @author Feross Aboukhadijeh <http://feross.org>
  5688. * @license MIT
  5689. */
  5690. /* eslint-disable no-proto */
  5691. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5692. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5693. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5694. exports.Buffer = Buffer
  5695. exports.SlowBuffer = SlowBuffer
  5696. exports.INSPECT_MAX_BYTES = 50
  5697. /**
  5698. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5699. * === true Use Uint8Array implementation (fastest)
  5700. * === false Use Object implementation (most compatible, even IE6)
  5701. *
  5702. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5703. * Opera 11.6+, iOS 4.2+.
  5704. *
  5705. * Due to various browser bugs, sometimes the Object implementation will be used even
  5706. * when the browser supports typed arrays.
  5707. *
  5708. * Note:
  5709. *
  5710. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5711. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5712. *
  5713. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5714. *
  5715. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5716. * incorrect length in some situations.
  5717. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5718. * get the Object implementation, which is slower but behaves correctly.
  5719. */
  5720. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5721. ? global.TYPED_ARRAY_SUPPORT
  5722. : typedArraySupport()
  5723. /*
  5724. * Export kMaxLength after typed array support is determined.
  5725. */
  5726. exports.kMaxLength = kMaxLength()
  5727. function typedArraySupport () {
  5728. try {
  5729. var arr = new Uint8Array(1)
  5730. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5731. return arr.foo() === 42 && // typed array instances can be augmented
  5732. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5733. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5734. } catch (e) {
  5735. return false
  5736. }
  5737. }
  5738. function kMaxLength () {
  5739. return Buffer.TYPED_ARRAY_SUPPORT
  5740. ? 0x7fffffff
  5741. : 0x3fffffff
  5742. }
  5743. function createBuffer (that, length) {
  5744. if (kMaxLength() < length) {
  5745. throw new RangeError('Invalid typed array length')
  5746. }
  5747. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5748. // Return an augmented `Uint8Array` instance, for best performance
  5749. that = new Uint8Array(length)
  5750. that.__proto__ = Buffer.prototype
  5751. } else {
  5752. // Fallback: Return an object instance of the Buffer class
  5753. if (that === null) {
  5754. that = new Buffer(length)
  5755. }
  5756. that.length = length
  5757. }
  5758. return that
  5759. }
  5760. /**
  5761. * The Buffer constructor returns instances of `Uint8Array` that have their
  5762. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5763. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5764. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5765. * returns a single octet.
  5766. *
  5767. * The `Uint8Array` prototype remains unmodified.
  5768. */
  5769. function Buffer (arg, encodingOrOffset, length) {
  5770. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5771. return new Buffer(arg, encodingOrOffset, length)
  5772. }
  5773. // Common case.
  5774. if (typeof arg === 'number') {
  5775. if (typeof encodingOrOffset === 'string') {
  5776. throw new Error(
  5777. 'If encoding is specified then the first argument must be a string'
  5778. )
  5779. }
  5780. return allocUnsafe(this, arg)
  5781. }
  5782. return from(this, arg, encodingOrOffset, length)
  5783. }
  5784. Buffer.poolSize = 8192 // not used by this implementation
  5785. // TODO: Legacy, not needed anymore. Remove in next major version.
  5786. Buffer._augment = function (arr) {
  5787. arr.__proto__ = Buffer.prototype
  5788. return arr
  5789. }
  5790. function from (that, value, encodingOrOffset, length) {
  5791. if (typeof value === 'number') {
  5792. throw new TypeError('"value" argument must not be a number')
  5793. }
  5794. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5795. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5796. }
  5797. if (typeof value === 'string') {
  5798. return fromString(that, value, encodingOrOffset)
  5799. }
  5800. return fromObject(that, value)
  5801. }
  5802. /**
  5803. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5804. * if value is a number.
  5805. * Buffer.from(str[, encoding])
  5806. * Buffer.from(array)
  5807. * Buffer.from(buffer)
  5808. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5809. **/
  5810. Buffer.from = function (value, encodingOrOffset, length) {
  5811. return from(null, value, encodingOrOffset, length)
  5812. }
  5813. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5814. Buffer.prototype.__proto__ = Uint8Array.prototype
  5815. Buffer.__proto__ = Uint8Array
  5816. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5817. Buffer[Symbol.species] === Buffer) {
  5818. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5819. Object.defineProperty(Buffer, Symbol.species, {
  5820. value: null,
  5821. configurable: true
  5822. })
  5823. }
  5824. }
  5825. function assertSize (size) {
  5826. if (typeof size !== 'number') {
  5827. throw new TypeError('"size" argument must be a number')
  5828. } else if (size < 0) {
  5829. throw new RangeError('"size" argument must not be negative')
  5830. }
  5831. }
  5832. function alloc (that, size, fill, encoding) {
  5833. assertSize(size)
  5834. if (size <= 0) {
  5835. return createBuffer(that, size)
  5836. }
  5837. if (fill !== undefined) {
  5838. // Only pay attention to encoding if it's a string. This
  5839. // prevents accidentally sending in a number that would
  5840. // be interpretted as a start offset.
  5841. return typeof encoding === 'string'
  5842. ? createBuffer(that, size).fill(fill, encoding)
  5843. : createBuffer(that, size).fill(fill)
  5844. }
  5845. return createBuffer(that, size)
  5846. }
  5847. /**
  5848. * Creates a new filled Buffer instance.
  5849. * alloc(size[, fill[, encoding]])
  5850. **/
  5851. Buffer.alloc = function (size, fill, encoding) {
  5852. return alloc(null, size, fill, encoding)
  5853. }
  5854. function allocUnsafe (that, size) {
  5855. assertSize(size)
  5856. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5857. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5858. for (var i = 0; i < size; ++i) {
  5859. that[i] = 0
  5860. }
  5861. }
  5862. return that
  5863. }
  5864. /**
  5865. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  5866. * */
  5867. Buffer.allocUnsafe = function (size) {
  5868. return allocUnsafe(null, size)
  5869. }
  5870. /**
  5871. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  5872. */
  5873. Buffer.allocUnsafeSlow = function (size) {
  5874. return allocUnsafe(null, size)
  5875. }
  5876. function fromString (that, string, encoding) {
  5877. if (typeof encoding !== 'string' || encoding === '') {
  5878. encoding = 'utf8'
  5879. }
  5880. if (!Buffer.isEncoding(encoding)) {
  5881. throw new TypeError('"encoding" must be a valid string encoding')
  5882. }
  5883. var length = byteLength(string, encoding) | 0
  5884. that = createBuffer(that, length)
  5885. var actual = that.write(string, encoding)
  5886. if (actual !== length) {
  5887. // Writing a hex string, for example, that contains invalid characters will
  5888. // cause everything after the first invalid character to be ignored. (e.g.
  5889. // 'abxxcd' will be treated as 'ab')
  5890. that = that.slice(0, actual)
  5891. }
  5892. return that
  5893. }
  5894. function fromArrayLike (that, array) {
  5895. var length = array.length < 0 ? 0 : checked(array.length) | 0
  5896. that = createBuffer(that, length)
  5897. for (var i = 0; i < length; i += 1) {
  5898. that[i] = array[i] & 255
  5899. }
  5900. return that
  5901. }
  5902. function fromArrayBuffer (that, array, byteOffset, length) {
  5903. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  5904. if (byteOffset < 0 || array.byteLength < byteOffset) {
  5905. throw new RangeError('\'offset\' is out of bounds')
  5906. }
  5907. if (array.byteLength < byteOffset + (length || 0)) {
  5908. throw new RangeError('\'length\' is out of bounds')
  5909. }
  5910. if (byteOffset === undefined && length === undefined) {
  5911. array = new Uint8Array(array)
  5912. } else if (length === undefined) {
  5913. array = new Uint8Array(array, byteOffset)
  5914. } else {
  5915. array = new Uint8Array(array, byteOffset, length)
  5916. }
  5917. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5918. // Return an augmented `Uint8Array` instance, for best performance
  5919. that = array
  5920. that.__proto__ = Buffer.prototype
  5921. } else {
  5922. // Fallback: Return an object instance of the Buffer class
  5923. that = fromArrayLike(that, array)
  5924. }
  5925. return that
  5926. }
  5927. function fromObject (that, obj) {
  5928. if (Buffer.isBuffer(obj)) {
  5929. var len = checked(obj.length) | 0
  5930. that = createBuffer(that, len)
  5931. if (that.length === 0) {
  5932. return that
  5933. }
  5934. obj.copy(that, 0, 0, len)
  5935. return that
  5936. }
  5937. if (obj) {
  5938. if ((typeof ArrayBuffer !== 'undefined' &&
  5939. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  5940. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  5941. return createBuffer(that, 0)
  5942. }
  5943. return fromArrayLike(that, obj)
  5944. }
  5945. if (obj.type === 'Buffer' && isArray(obj.data)) {
  5946. return fromArrayLike(that, obj.data)
  5947. }
  5948. }
  5949. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  5950. }
  5951. function checked (length) {
  5952. // Note: cannot use `length < kMaxLength()` here because that fails when
  5953. // length is NaN (which is otherwise coerced to zero.)
  5954. if (length >= kMaxLength()) {
  5955. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  5956. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  5957. }
  5958. return length | 0
  5959. }
  5960. function SlowBuffer (length) {
  5961. if (+length != length) { // eslint-disable-line eqeqeq
  5962. length = 0
  5963. }
  5964. return Buffer.alloc(+length)
  5965. }
  5966. Buffer.isBuffer = function isBuffer (b) {
  5967. return !!(b != null && b._isBuffer)
  5968. }
  5969. Buffer.compare = function compare (a, b) {
  5970. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  5971. throw new TypeError('Arguments must be Buffers')
  5972. }
  5973. if (a === b) return 0
  5974. var x = a.length
  5975. var y = b.length
  5976. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  5977. if (a[i] !== b[i]) {
  5978. x = a[i]
  5979. y = b[i]
  5980. break
  5981. }
  5982. }
  5983. if (x < y) return -1
  5984. if (y < x) return 1
  5985. return 0
  5986. }
  5987. Buffer.isEncoding = function isEncoding (encoding) {
  5988. switch (String(encoding).toLowerCase()) {
  5989. case 'hex':
  5990. case 'utf8':
  5991. case 'utf-8':
  5992. case 'ascii':
  5993. case 'latin1':
  5994. case 'binary':
  5995. case 'base64':
  5996. case 'ucs2':
  5997. case 'ucs-2':
  5998. case 'utf16le':
  5999. case 'utf-16le':
  6000. return true
  6001. default:
  6002. return false
  6003. }
  6004. }
  6005. Buffer.concat = function concat (list, length) {
  6006. if (!isArray(list)) {
  6007. throw new TypeError('"list" argument must be an Array of Buffers')
  6008. }
  6009. if (list.length === 0) {
  6010. return Buffer.alloc(0)
  6011. }
  6012. var i
  6013. if (length === undefined) {
  6014. length = 0
  6015. for (i = 0; i < list.length; ++i) {
  6016. length += list[i].length
  6017. }
  6018. }
  6019. var buffer = Buffer.allocUnsafe(length)
  6020. var pos = 0
  6021. for (i = 0; i < list.length; ++i) {
  6022. var buf = list[i]
  6023. if (!Buffer.isBuffer(buf)) {
  6024. throw new TypeError('"list" argument must be an Array of Buffers')
  6025. }
  6026. buf.copy(buffer, pos)
  6027. pos += buf.length
  6028. }
  6029. return buffer
  6030. }
  6031. function byteLength (string, encoding) {
  6032. if (Buffer.isBuffer(string)) {
  6033. return string.length
  6034. }
  6035. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6036. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6037. return string.byteLength
  6038. }
  6039. if (typeof string !== 'string') {
  6040. string = '' + string
  6041. }
  6042. var len = string.length
  6043. if (len === 0) return 0
  6044. // Use a for loop to avoid recursion
  6045. var loweredCase = false
  6046. for (;;) {
  6047. switch (encoding) {
  6048. case 'ascii':
  6049. case 'latin1':
  6050. case 'binary':
  6051. return len
  6052. case 'utf8':
  6053. case 'utf-8':
  6054. case undefined:
  6055. return utf8ToBytes(string).length
  6056. case 'ucs2':
  6057. case 'ucs-2':
  6058. case 'utf16le':
  6059. case 'utf-16le':
  6060. return len * 2
  6061. case 'hex':
  6062. return len >>> 1
  6063. case 'base64':
  6064. return base64ToBytes(string).length
  6065. default:
  6066. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6067. encoding = ('' + encoding).toLowerCase()
  6068. loweredCase = true
  6069. }
  6070. }
  6071. }
  6072. Buffer.byteLength = byteLength
  6073. function slowToString (encoding, start, end) {
  6074. var loweredCase = false
  6075. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6076. // property of a typed array.
  6077. // This behaves neither like String nor Uint8Array in that we set start/end
  6078. // to their upper/lower bounds if the value passed is out of range.
  6079. // undefined is handled specially as per ECMA-262 6th Edition,
  6080. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6081. if (start === undefined || start < 0) {
  6082. start = 0
  6083. }
  6084. // Return early if start > this.length. Done here to prevent potential uint32
  6085. // coercion fail below.
  6086. if (start > this.length) {
  6087. return ''
  6088. }
  6089. if (end === undefined || end > this.length) {
  6090. end = this.length
  6091. }
  6092. if (end <= 0) {
  6093. return ''
  6094. }
  6095. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6096. end >>>= 0
  6097. start >>>= 0
  6098. if (end <= start) {
  6099. return ''
  6100. }
  6101. if (!encoding) encoding = 'utf8'
  6102. while (true) {
  6103. switch (encoding) {
  6104. case 'hex':
  6105. return hexSlice(this, start, end)
  6106. case 'utf8':
  6107. case 'utf-8':
  6108. return utf8Slice(this, start, end)
  6109. case 'ascii':
  6110. return asciiSlice(this, start, end)
  6111. case 'latin1':
  6112. case 'binary':
  6113. return latin1Slice(this, start, end)
  6114. case 'base64':
  6115. return base64Slice(this, start, end)
  6116. case 'ucs2':
  6117. case 'ucs-2':
  6118. case 'utf16le':
  6119. case 'utf-16le':
  6120. return utf16leSlice(this, start, end)
  6121. default:
  6122. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6123. encoding = (encoding + '').toLowerCase()
  6124. loweredCase = true
  6125. }
  6126. }
  6127. }
  6128. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6129. // Buffer instances.
  6130. Buffer.prototype._isBuffer = true
  6131. function swap (b, n, m) {
  6132. var i = b[n]
  6133. b[n] = b[m]
  6134. b[m] = i
  6135. }
  6136. Buffer.prototype.swap16 = function swap16 () {
  6137. var len = this.length
  6138. if (len % 2 !== 0) {
  6139. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6140. }
  6141. for (var i = 0; i < len; i += 2) {
  6142. swap(this, i, i + 1)
  6143. }
  6144. return this
  6145. }
  6146. Buffer.prototype.swap32 = function swap32 () {
  6147. var len = this.length
  6148. if (len % 4 !== 0) {
  6149. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6150. }
  6151. for (var i = 0; i < len; i += 4) {
  6152. swap(this, i, i + 3)
  6153. swap(this, i + 1, i + 2)
  6154. }
  6155. return this
  6156. }
  6157. Buffer.prototype.swap64 = function swap64 () {
  6158. var len = this.length
  6159. if (len % 8 !== 0) {
  6160. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6161. }
  6162. for (var i = 0; i < len; i += 8) {
  6163. swap(this, i, i + 7)
  6164. swap(this, i + 1, i + 6)
  6165. swap(this, i + 2, i + 5)
  6166. swap(this, i + 3, i + 4)
  6167. }
  6168. return this
  6169. }
  6170. Buffer.prototype.toString = function toString () {
  6171. var length = this.length | 0
  6172. if (length === 0) return ''
  6173. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6174. return slowToString.apply(this, arguments)
  6175. }
  6176. Buffer.prototype.equals = function equals (b) {
  6177. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6178. if (this === b) return true
  6179. return Buffer.compare(this, b) === 0
  6180. }
  6181. Buffer.prototype.inspect = function inspect () {
  6182. var str = ''
  6183. var max = exports.INSPECT_MAX_BYTES
  6184. if (this.length > 0) {
  6185. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6186. if (this.length > max) str += ' ... '
  6187. }
  6188. return '<Buffer ' + str + '>'
  6189. }
  6190. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6191. if (!Buffer.isBuffer(target)) {
  6192. throw new TypeError('Argument must be a Buffer')
  6193. }
  6194. if (start === undefined) {
  6195. start = 0
  6196. }
  6197. if (end === undefined) {
  6198. end = target ? target.length : 0
  6199. }
  6200. if (thisStart === undefined) {
  6201. thisStart = 0
  6202. }
  6203. if (thisEnd === undefined) {
  6204. thisEnd = this.length
  6205. }
  6206. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6207. throw new RangeError('out of range index')
  6208. }
  6209. if (thisStart >= thisEnd && start >= end) {
  6210. return 0
  6211. }
  6212. if (thisStart >= thisEnd) {
  6213. return -1
  6214. }
  6215. if (start >= end) {
  6216. return 1
  6217. }
  6218. start >>>= 0
  6219. end >>>= 0
  6220. thisStart >>>= 0
  6221. thisEnd >>>= 0
  6222. if (this === target) return 0
  6223. var x = thisEnd - thisStart
  6224. var y = end - start
  6225. var len = Math.min(x, y)
  6226. var thisCopy = this.slice(thisStart, thisEnd)
  6227. var targetCopy = target.slice(start, end)
  6228. for (var i = 0; i < len; ++i) {
  6229. if (thisCopy[i] !== targetCopy[i]) {
  6230. x = thisCopy[i]
  6231. y = targetCopy[i]
  6232. break
  6233. }
  6234. }
  6235. if (x < y) return -1
  6236. if (y < x) return 1
  6237. return 0
  6238. }
  6239. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6240. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6241. //
  6242. // Arguments:
  6243. // - buffer - a Buffer to search
  6244. // - val - a string, Buffer, or number
  6245. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6246. // - encoding - an optional encoding, relevant is val is a string
  6247. // - dir - true for indexOf, false for lastIndexOf
  6248. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6249. // Empty buffer means no match
  6250. if (buffer.length === 0) return -1
  6251. // Normalize byteOffset
  6252. if (typeof byteOffset === 'string') {
  6253. encoding = byteOffset
  6254. byteOffset = 0
  6255. } else if (byteOffset > 0x7fffffff) {
  6256. byteOffset = 0x7fffffff
  6257. } else if (byteOffset < -0x80000000) {
  6258. byteOffset = -0x80000000
  6259. }
  6260. byteOffset = +byteOffset // Coerce to Number.
  6261. if (isNaN(byteOffset)) {
  6262. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6263. byteOffset = dir ? 0 : (buffer.length - 1)
  6264. }
  6265. // Normalize byteOffset: negative offsets start from the end of the buffer
  6266. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6267. if (byteOffset >= buffer.length) {
  6268. if (dir) return -1
  6269. else byteOffset = buffer.length - 1
  6270. } else if (byteOffset < 0) {
  6271. if (dir) byteOffset = 0
  6272. else return -1
  6273. }
  6274. // Normalize val
  6275. if (typeof val === 'string') {
  6276. val = Buffer.from(val, encoding)
  6277. }
  6278. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6279. if (Buffer.isBuffer(val)) {
  6280. // Special case: looking for empty string/buffer always fails
  6281. if (val.length === 0) {
  6282. return -1
  6283. }
  6284. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6285. } else if (typeof val === 'number') {
  6286. val = val & 0xFF // Search for a byte value [0-255]
  6287. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6288. typeof Uint8Array.prototype.indexOf === 'function') {
  6289. if (dir) {
  6290. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6291. } else {
  6292. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6293. }
  6294. }
  6295. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6296. }
  6297. throw new TypeError('val must be string, number or Buffer')
  6298. }
  6299. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6300. var indexSize = 1
  6301. var arrLength = arr.length
  6302. var valLength = val.length
  6303. if (encoding !== undefined) {
  6304. encoding = String(encoding).toLowerCase()
  6305. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6306. encoding === 'utf16le' || encoding === 'utf-16le') {
  6307. if (arr.length < 2 || val.length < 2) {
  6308. return -1
  6309. }
  6310. indexSize = 2
  6311. arrLength /= 2
  6312. valLength /= 2
  6313. byteOffset /= 2
  6314. }
  6315. }
  6316. function read (buf, i) {
  6317. if (indexSize === 1) {
  6318. return buf[i]
  6319. } else {
  6320. return buf.readUInt16BE(i * indexSize)
  6321. }
  6322. }
  6323. var i
  6324. if (dir) {
  6325. var foundIndex = -1
  6326. for (i = byteOffset; i < arrLength; i++) {
  6327. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6328. if (foundIndex === -1) foundIndex = i
  6329. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6330. } else {
  6331. if (foundIndex !== -1) i -= i - foundIndex
  6332. foundIndex = -1
  6333. }
  6334. }
  6335. } else {
  6336. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6337. for (i = byteOffset; i >= 0; i--) {
  6338. var found = true
  6339. for (var j = 0; j < valLength; j++) {
  6340. if (read(arr, i + j) !== read(val, j)) {
  6341. found = false
  6342. break
  6343. }
  6344. }
  6345. if (found) return i
  6346. }
  6347. }
  6348. return -1
  6349. }
  6350. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6351. return this.indexOf(val, byteOffset, encoding) !== -1
  6352. }
  6353. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6354. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6355. }
  6356. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6357. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6358. }
  6359. function hexWrite (buf, string, offset, length) {
  6360. offset = Number(offset) || 0
  6361. var remaining = buf.length - offset
  6362. if (!length) {
  6363. length = remaining
  6364. } else {
  6365. length = Number(length)
  6366. if (length > remaining) {
  6367. length = remaining
  6368. }
  6369. }
  6370. // must be an even number of digits
  6371. var strLen = string.length
  6372. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6373. if (length > strLen / 2) {
  6374. length = strLen / 2
  6375. }
  6376. for (var i = 0; i < length; ++i) {
  6377. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6378. if (isNaN(parsed)) return i
  6379. buf[offset + i] = parsed
  6380. }
  6381. return i
  6382. }
  6383. function utf8Write (buf, string, offset, length) {
  6384. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6385. }
  6386. function asciiWrite (buf, string, offset, length) {
  6387. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6388. }
  6389. function latin1Write (buf, string, offset, length) {
  6390. return asciiWrite(buf, string, offset, length)
  6391. }
  6392. function base64Write (buf, string, offset, length) {
  6393. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6394. }
  6395. function ucs2Write (buf, string, offset, length) {
  6396. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6397. }
  6398. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6399. // Buffer#write(string)
  6400. if (offset === undefined) {
  6401. encoding = 'utf8'
  6402. length = this.length
  6403. offset = 0
  6404. // Buffer#write(string, encoding)
  6405. } else if (length === undefined && typeof offset === 'string') {
  6406. encoding = offset
  6407. length = this.length
  6408. offset = 0
  6409. // Buffer#write(string, offset[, length][, encoding])
  6410. } else if (isFinite(offset)) {
  6411. offset = offset | 0
  6412. if (isFinite(length)) {
  6413. length = length | 0
  6414. if (encoding === undefined) encoding = 'utf8'
  6415. } else {
  6416. encoding = length
  6417. length = undefined
  6418. }
  6419. // legacy write(string, encoding, offset, length) - remove in v0.13
  6420. } else {
  6421. throw new Error(
  6422. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6423. )
  6424. }
  6425. var remaining = this.length - offset
  6426. if (length === undefined || length > remaining) length = remaining
  6427. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6428. throw new RangeError('Attempt to write outside buffer bounds')
  6429. }
  6430. if (!encoding) encoding = 'utf8'
  6431. var loweredCase = false
  6432. for (;;) {
  6433. switch (encoding) {
  6434. case 'hex':
  6435. return hexWrite(this, string, offset, length)
  6436. case 'utf8':
  6437. case 'utf-8':
  6438. return utf8Write(this, string, offset, length)
  6439. case 'ascii':
  6440. return asciiWrite(this, string, offset, length)
  6441. case 'latin1':
  6442. case 'binary':
  6443. return latin1Write(this, string, offset, length)
  6444. case 'base64':
  6445. // Warning: maxLength not taken into account in base64Write
  6446. return base64Write(this, string, offset, length)
  6447. case 'ucs2':
  6448. case 'ucs-2':
  6449. case 'utf16le':
  6450. case 'utf-16le':
  6451. return ucs2Write(this, string, offset, length)
  6452. default:
  6453. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6454. encoding = ('' + encoding).toLowerCase()
  6455. loweredCase = true
  6456. }
  6457. }
  6458. }
  6459. Buffer.prototype.toJSON = function toJSON () {
  6460. return {
  6461. type: 'Buffer',
  6462. data: Array.prototype.slice.call(this._arr || this, 0)
  6463. }
  6464. }
  6465. function base64Slice (buf, start, end) {
  6466. if (start === 0 && end === buf.length) {
  6467. return base64.fromByteArray(buf)
  6468. } else {
  6469. return base64.fromByteArray(buf.slice(start, end))
  6470. }
  6471. }
  6472. function utf8Slice (buf, start, end) {
  6473. end = Math.min(buf.length, end)
  6474. var res = []
  6475. var i = start
  6476. while (i < end) {
  6477. var firstByte = buf[i]
  6478. var codePoint = null
  6479. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6480. : (firstByte > 0xDF) ? 3
  6481. : (firstByte > 0xBF) ? 2
  6482. : 1
  6483. if (i + bytesPerSequence <= end) {
  6484. var secondByte, thirdByte, fourthByte, tempCodePoint
  6485. switch (bytesPerSequence) {
  6486. case 1:
  6487. if (firstByte < 0x80) {
  6488. codePoint = firstByte
  6489. }
  6490. break
  6491. case 2:
  6492. secondByte = buf[i + 1]
  6493. if ((secondByte & 0xC0) === 0x80) {
  6494. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6495. if (tempCodePoint > 0x7F) {
  6496. codePoint = tempCodePoint
  6497. }
  6498. }
  6499. break
  6500. case 3:
  6501. secondByte = buf[i + 1]
  6502. thirdByte = buf[i + 2]
  6503. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6504. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6505. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6506. codePoint = tempCodePoint
  6507. }
  6508. }
  6509. break
  6510. case 4:
  6511. secondByte = buf[i + 1]
  6512. thirdByte = buf[i + 2]
  6513. fourthByte = buf[i + 3]
  6514. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6515. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6516. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6517. codePoint = tempCodePoint
  6518. }
  6519. }
  6520. }
  6521. }
  6522. if (codePoint === null) {
  6523. // we did not generate a valid codePoint so insert a
  6524. // replacement char (U+FFFD) and advance only 1 byte
  6525. codePoint = 0xFFFD
  6526. bytesPerSequence = 1
  6527. } else if (codePoint > 0xFFFF) {
  6528. // encode to utf16 (surrogate pair dance)
  6529. codePoint -= 0x10000
  6530. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6531. codePoint = 0xDC00 | codePoint & 0x3FF
  6532. }
  6533. res.push(codePoint)
  6534. i += bytesPerSequence
  6535. }
  6536. return decodeCodePointsArray(res)
  6537. }
  6538. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6539. // the lowest limit is Chrome, with 0x10000 args.
  6540. // We go 1 magnitude less, for safety
  6541. var MAX_ARGUMENTS_LENGTH = 0x1000
  6542. function decodeCodePointsArray (codePoints) {
  6543. var len = codePoints.length
  6544. if (len <= MAX_ARGUMENTS_LENGTH) {
  6545. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6546. }
  6547. // Decode in chunks to avoid "call stack size exceeded".
  6548. var res = ''
  6549. var i = 0
  6550. while (i < len) {
  6551. res += String.fromCharCode.apply(
  6552. String,
  6553. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6554. )
  6555. }
  6556. return res
  6557. }
  6558. function asciiSlice (buf, start, end) {
  6559. var ret = ''
  6560. end = Math.min(buf.length, end)
  6561. for (var i = start; i < end; ++i) {
  6562. ret += String.fromCharCode(buf[i] & 0x7F)
  6563. }
  6564. return ret
  6565. }
  6566. function latin1Slice (buf, start, end) {
  6567. var ret = ''
  6568. end = Math.min(buf.length, end)
  6569. for (var i = start; i < end; ++i) {
  6570. ret += String.fromCharCode(buf[i])
  6571. }
  6572. return ret
  6573. }
  6574. function hexSlice (buf, start, end) {
  6575. var len = buf.length
  6576. if (!start || start < 0) start = 0
  6577. if (!end || end < 0 || end > len) end = len
  6578. var out = ''
  6579. for (var i = start; i < end; ++i) {
  6580. out += toHex(buf[i])
  6581. }
  6582. return out
  6583. }
  6584. function utf16leSlice (buf, start, end) {
  6585. var bytes = buf.slice(start, end)
  6586. var res = ''
  6587. for (var i = 0; i < bytes.length; i += 2) {
  6588. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6589. }
  6590. return res
  6591. }
  6592. Buffer.prototype.slice = function slice (start, end) {
  6593. var len = this.length
  6594. start = ~~start
  6595. end = end === undefined ? len : ~~end
  6596. if (start < 0) {
  6597. start += len
  6598. if (start < 0) start = 0
  6599. } else if (start > len) {
  6600. start = len
  6601. }
  6602. if (end < 0) {
  6603. end += len
  6604. if (end < 0) end = 0
  6605. } else if (end > len) {
  6606. end = len
  6607. }
  6608. if (end < start) end = start
  6609. var newBuf
  6610. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6611. newBuf = this.subarray(start, end)
  6612. newBuf.__proto__ = Buffer.prototype
  6613. } else {
  6614. var sliceLen = end - start
  6615. newBuf = new Buffer(sliceLen, undefined)
  6616. for (var i = 0; i < sliceLen; ++i) {
  6617. newBuf[i] = this[i + start]
  6618. }
  6619. }
  6620. return newBuf
  6621. }
  6622. /*
  6623. * Need to make sure that buffer isn't trying to write out of bounds.
  6624. */
  6625. function checkOffset (offset, ext, length) {
  6626. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6627. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6628. }
  6629. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6630. offset = offset | 0
  6631. byteLength = byteLength | 0
  6632. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6633. var val = this[offset]
  6634. var mul = 1
  6635. var i = 0
  6636. while (++i < byteLength && (mul *= 0x100)) {
  6637. val += this[offset + i] * mul
  6638. }
  6639. return val
  6640. }
  6641. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6642. offset = offset | 0
  6643. byteLength = byteLength | 0
  6644. if (!noAssert) {
  6645. checkOffset(offset, byteLength, this.length)
  6646. }
  6647. var val = this[offset + --byteLength]
  6648. var mul = 1
  6649. while (byteLength > 0 && (mul *= 0x100)) {
  6650. val += this[offset + --byteLength] * mul
  6651. }
  6652. return val
  6653. }
  6654. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6655. if (!noAssert) checkOffset(offset, 1, this.length)
  6656. return this[offset]
  6657. }
  6658. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6659. if (!noAssert) checkOffset(offset, 2, this.length)
  6660. return this[offset] | (this[offset + 1] << 8)
  6661. }
  6662. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6663. if (!noAssert) checkOffset(offset, 2, this.length)
  6664. return (this[offset] << 8) | this[offset + 1]
  6665. }
  6666. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6667. if (!noAssert) checkOffset(offset, 4, this.length)
  6668. return ((this[offset]) |
  6669. (this[offset + 1] << 8) |
  6670. (this[offset + 2] << 16)) +
  6671. (this[offset + 3] * 0x1000000)
  6672. }
  6673. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6674. if (!noAssert) checkOffset(offset, 4, this.length)
  6675. return (this[offset] * 0x1000000) +
  6676. ((this[offset + 1] << 16) |
  6677. (this[offset + 2] << 8) |
  6678. this[offset + 3])
  6679. }
  6680. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6681. offset = offset | 0
  6682. byteLength = byteLength | 0
  6683. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6684. var val = this[offset]
  6685. var mul = 1
  6686. var i = 0
  6687. while (++i < byteLength && (mul *= 0x100)) {
  6688. val += this[offset + i] * mul
  6689. }
  6690. mul *= 0x80
  6691. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6692. return val
  6693. }
  6694. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6695. offset = offset | 0
  6696. byteLength = byteLength | 0
  6697. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6698. var i = byteLength
  6699. var mul = 1
  6700. var val = this[offset + --i]
  6701. while (i > 0 && (mul *= 0x100)) {
  6702. val += this[offset + --i] * mul
  6703. }
  6704. mul *= 0x80
  6705. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6706. return val
  6707. }
  6708. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6709. if (!noAssert) checkOffset(offset, 1, this.length)
  6710. if (!(this[offset] & 0x80)) return (this[offset])
  6711. return ((0xff - this[offset] + 1) * -1)
  6712. }
  6713. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6714. if (!noAssert) checkOffset(offset, 2, this.length)
  6715. var val = this[offset] | (this[offset + 1] << 8)
  6716. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6717. }
  6718. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6719. if (!noAssert) checkOffset(offset, 2, this.length)
  6720. var val = this[offset + 1] | (this[offset] << 8)
  6721. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6722. }
  6723. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6724. if (!noAssert) checkOffset(offset, 4, this.length)
  6725. return (this[offset]) |
  6726. (this[offset + 1] << 8) |
  6727. (this[offset + 2] << 16) |
  6728. (this[offset + 3] << 24)
  6729. }
  6730. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6731. if (!noAssert) checkOffset(offset, 4, this.length)
  6732. return (this[offset] << 24) |
  6733. (this[offset + 1] << 16) |
  6734. (this[offset + 2] << 8) |
  6735. (this[offset + 3])
  6736. }
  6737. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6738. if (!noAssert) checkOffset(offset, 4, this.length)
  6739. return ieee754.read(this, offset, true, 23, 4)
  6740. }
  6741. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6742. if (!noAssert) checkOffset(offset, 4, this.length)
  6743. return ieee754.read(this, offset, false, 23, 4)
  6744. }
  6745. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6746. if (!noAssert) checkOffset(offset, 8, this.length)
  6747. return ieee754.read(this, offset, true, 52, 8)
  6748. }
  6749. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6750. if (!noAssert) checkOffset(offset, 8, this.length)
  6751. return ieee754.read(this, offset, false, 52, 8)
  6752. }
  6753. function checkInt (buf, value, offset, ext, max, min) {
  6754. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6755. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6756. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6757. }
  6758. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6759. value = +value
  6760. offset = offset | 0
  6761. byteLength = byteLength | 0
  6762. if (!noAssert) {
  6763. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6764. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6765. }
  6766. var mul = 1
  6767. var i = 0
  6768. this[offset] = value & 0xFF
  6769. while (++i < byteLength && (mul *= 0x100)) {
  6770. this[offset + i] = (value / mul) & 0xFF
  6771. }
  6772. return offset + byteLength
  6773. }
  6774. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6775. value = +value
  6776. offset = offset | 0
  6777. byteLength = byteLength | 0
  6778. if (!noAssert) {
  6779. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6780. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6781. }
  6782. var i = byteLength - 1
  6783. var mul = 1
  6784. this[offset + i] = value & 0xFF
  6785. while (--i >= 0 && (mul *= 0x100)) {
  6786. this[offset + i] = (value / mul) & 0xFF
  6787. }
  6788. return offset + byteLength
  6789. }
  6790. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6791. value = +value
  6792. offset = offset | 0
  6793. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6794. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6795. this[offset] = (value & 0xff)
  6796. return offset + 1
  6797. }
  6798. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6799. if (value < 0) value = 0xffff + value + 1
  6800. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6801. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6802. (littleEndian ? i : 1 - i) * 8
  6803. }
  6804. }
  6805. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6806. value = +value
  6807. offset = offset | 0
  6808. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6809. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6810. this[offset] = (value & 0xff)
  6811. this[offset + 1] = (value >>> 8)
  6812. } else {
  6813. objectWriteUInt16(this, value, offset, true)
  6814. }
  6815. return offset + 2
  6816. }
  6817. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6818. value = +value
  6819. offset = offset | 0
  6820. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6821. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6822. this[offset] = (value >>> 8)
  6823. this[offset + 1] = (value & 0xff)
  6824. } else {
  6825. objectWriteUInt16(this, value, offset, false)
  6826. }
  6827. return offset + 2
  6828. }
  6829. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6830. if (value < 0) value = 0xffffffff + value + 1
  6831. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6832. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6833. }
  6834. }
  6835. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6836. value = +value
  6837. offset = offset | 0
  6838. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6839. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6840. this[offset + 3] = (value >>> 24)
  6841. this[offset + 2] = (value >>> 16)
  6842. this[offset + 1] = (value >>> 8)
  6843. this[offset] = (value & 0xff)
  6844. } else {
  6845. objectWriteUInt32(this, value, offset, true)
  6846. }
  6847. return offset + 4
  6848. }
  6849. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6850. value = +value
  6851. offset = offset | 0
  6852. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6853. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6854. this[offset] = (value >>> 24)
  6855. this[offset + 1] = (value >>> 16)
  6856. this[offset + 2] = (value >>> 8)
  6857. this[offset + 3] = (value & 0xff)
  6858. } else {
  6859. objectWriteUInt32(this, value, offset, false)
  6860. }
  6861. return offset + 4
  6862. }
  6863. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  6864. value = +value
  6865. offset = offset | 0
  6866. if (!noAssert) {
  6867. var limit = Math.pow(2, 8 * byteLength - 1)
  6868. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6869. }
  6870. var i = 0
  6871. var mul = 1
  6872. var sub = 0
  6873. this[offset] = value & 0xFF
  6874. while (++i < byteLength && (mul *= 0x100)) {
  6875. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  6876. sub = 1
  6877. }
  6878. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6879. }
  6880. return offset + byteLength
  6881. }
  6882. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  6883. value = +value
  6884. offset = offset | 0
  6885. if (!noAssert) {
  6886. var limit = Math.pow(2, 8 * byteLength - 1)
  6887. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6888. }
  6889. var i = byteLength - 1
  6890. var mul = 1
  6891. var sub = 0
  6892. this[offset + i] = value & 0xFF
  6893. while (--i >= 0 && (mul *= 0x100)) {
  6894. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  6895. sub = 1
  6896. }
  6897. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6898. }
  6899. return offset + byteLength
  6900. }
  6901. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  6902. value = +value
  6903. offset = offset | 0
  6904. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  6905. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6906. if (value < 0) value = 0xff + value + 1
  6907. this[offset] = (value & 0xff)
  6908. return offset + 1
  6909. }
  6910. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  6911. value = +value
  6912. offset = offset | 0
  6913. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6914. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6915. this[offset] = (value & 0xff)
  6916. this[offset + 1] = (value >>> 8)
  6917. } else {
  6918. objectWriteUInt16(this, value, offset, true)
  6919. }
  6920. return offset + 2
  6921. }
  6922. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  6923. value = +value
  6924. offset = offset | 0
  6925. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6926. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6927. this[offset] = (value >>> 8)
  6928. this[offset + 1] = (value & 0xff)
  6929. } else {
  6930. objectWriteUInt16(this, value, offset, false)
  6931. }
  6932. return offset + 2
  6933. }
  6934. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  6935. value = +value
  6936. offset = offset | 0
  6937. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6938. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6939. this[offset] = (value & 0xff)
  6940. this[offset + 1] = (value >>> 8)
  6941. this[offset + 2] = (value >>> 16)
  6942. this[offset + 3] = (value >>> 24)
  6943. } else {
  6944. objectWriteUInt32(this, value, offset, true)
  6945. }
  6946. return offset + 4
  6947. }
  6948. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  6949. value = +value
  6950. offset = offset | 0
  6951. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6952. if (value < 0) value = 0xffffffff + value + 1
  6953. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6954. this[offset] = (value >>> 24)
  6955. this[offset + 1] = (value >>> 16)
  6956. this[offset + 2] = (value >>> 8)
  6957. this[offset + 3] = (value & 0xff)
  6958. } else {
  6959. objectWriteUInt32(this, value, offset, false)
  6960. }
  6961. return offset + 4
  6962. }
  6963. function checkIEEE754 (buf, value, offset, ext, max, min) {
  6964. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6965. if (offset < 0) throw new RangeError('Index out of range')
  6966. }
  6967. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  6968. if (!noAssert) {
  6969. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  6970. }
  6971. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  6972. return offset + 4
  6973. }
  6974. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  6975. return writeFloat(this, value, offset, true, noAssert)
  6976. }
  6977. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  6978. return writeFloat(this, value, offset, false, noAssert)
  6979. }
  6980. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  6981. if (!noAssert) {
  6982. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  6983. }
  6984. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  6985. return offset + 8
  6986. }
  6987. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  6988. return writeDouble(this, value, offset, true, noAssert)
  6989. }
  6990. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  6991. return writeDouble(this, value, offset, false, noAssert)
  6992. }
  6993. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  6994. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  6995. if (!start) start = 0
  6996. if (!end && end !== 0) end = this.length
  6997. if (targetStart >= target.length) targetStart = target.length
  6998. if (!targetStart) targetStart = 0
  6999. if (end > 0 && end < start) end = start
  7000. // Copy 0 bytes; we're done
  7001. if (end === start) return 0
  7002. if (target.length === 0 || this.length === 0) return 0
  7003. // Fatal error conditions
  7004. if (targetStart < 0) {
  7005. throw new RangeError('targetStart out of bounds')
  7006. }
  7007. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7008. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7009. // Are we oob?
  7010. if (end > this.length) end = this.length
  7011. if (target.length - targetStart < end - start) {
  7012. end = target.length - targetStart + start
  7013. }
  7014. var len = end - start
  7015. var i
  7016. if (this === target && start < targetStart && targetStart < end) {
  7017. // descending copy from end
  7018. for (i = len - 1; i >= 0; --i) {
  7019. target[i + targetStart] = this[i + start]
  7020. }
  7021. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7022. // ascending copy from start
  7023. for (i = 0; i < len; ++i) {
  7024. target[i + targetStart] = this[i + start]
  7025. }
  7026. } else {
  7027. Uint8Array.prototype.set.call(
  7028. target,
  7029. this.subarray(start, start + len),
  7030. targetStart
  7031. )
  7032. }
  7033. return len
  7034. }
  7035. // Usage:
  7036. // buffer.fill(number[, offset[, end]])
  7037. // buffer.fill(buffer[, offset[, end]])
  7038. // buffer.fill(string[, offset[, end]][, encoding])
  7039. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7040. // Handle string cases:
  7041. if (typeof val === 'string') {
  7042. if (typeof start === 'string') {
  7043. encoding = start
  7044. start = 0
  7045. end = this.length
  7046. } else if (typeof end === 'string') {
  7047. encoding = end
  7048. end = this.length
  7049. }
  7050. if (val.length === 1) {
  7051. var code = val.charCodeAt(0)
  7052. if (code < 256) {
  7053. val = code
  7054. }
  7055. }
  7056. if (encoding !== undefined && typeof encoding !== 'string') {
  7057. throw new TypeError('encoding must be a string')
  7058. }
  7059. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7060. throw new TypeError('Unknown encoding: ' + encoding)
  7061. }
  7062. } else if (typeof val === 'number') {
  7063. val = val & 255
  7064. }
  7065. // Invalid ranges are not set to a default, so can range check early.
  7066. if (start < 0 || this.length < start || this.length < end) {
  7067. throw new RangeError('Out of range index')
  7068. }
  7069. if (end <= start) {
  7070. return this
  7071. }
  7072. start = start >>> 0
  7073. end = end === undefined ? this.length : end >>> 0
  7074. if (!val) val = 0
  7075. var i
  7076. if (typeof val === 'number') {
  7077. for (i = start; i < end; ++i) {
  7078. this[i] = val
  7079. }
  7080. } else {
  7081. var bytes = Buffer.isBuffer(val)
  7082. ? val
  7083. : utf8ToBytes(new Buffer(val, encoding).toString())
  7084. var len = bytes.length
  7085. for (i = 0; i < end - start; ++i) {
  7086. this[i + start] = bytes[i % len]
  7087. }
  7088. }
  7089. return this
  7090. }
  7091. // HELPER FUNCTIONS
  7092. // ================
  7093. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7094. function base64clean (str) {
  7095. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7096. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7097. // Node converts strings with length < 2 to ''
  7098. if (str.length < 2) return ''
  7099. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7100. while (str.length % 4 !== 0) {
  7101. str = str + '='
  7102. }
  7103. return str
  7104. }
  7105. function stringtrim (str) {
  7106. if (str.trim) return str.trim()
  7107. return str.replace(/^\s+|\s+$/g, '')
  7108. }
  7109. function toHex (n) {
  7110. if (n < 16) return '0' + n.toString(16)
  7111. return n.toString(16)
  7112. }
  7113. function utf8ToBytes (string, units) {
  7114. units = units || Infinity
  7115. var codePoint
  7116. var length = string.length
  7117. var leadSurrogate = null
  7118. var bytes = []
  7119. for (var i = 0; i < length; ++i) {
  7120. codePoint = string.charCodeAt(i)
  7121. // is surrogate component
  7122. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7123. // last char was a lead
  7124. if (!leadSurrogate) {
  7125. // no lead yet
  7126. if (codePoint > 0xDBFF) {
  7127. // unexpected trail
  7128. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7129. continue
  7130. } else if (i + 1 === length) {
  7131. // unpaired lead
  7132. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7133. continue
  7134. }
  7135. // valid lead
  7136. leadSurrogate = codePoint
  7137. continue
  7138. }
  7139. // 2 leads in a row
  7140. if (codePoint < 0xDC00) {
  7141. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7142. leadSurrogate = codePoint
  7143. continue
  7144. }
  7145. // valid surrogate pair
  7146. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7147. } else if (leadSurrogate) {
  7148. // valid bmp char, but last char was a lead
  7149. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7150. }
  7151. leadSurrogate = null
  7152. // encode utf8
  7153. if (codePoint < 0x80) {
  7154. if ((units -= 1) < 0) break
  7155. bytes.push(codePoint)
  7156. } else if (codePoint < 0x800) {
  7157. if ((units -= 2) < 0) break
  7158. bytes.push(
  7159. codePoint >> 0x6 | 0xC0,
  7160. codePoint & 0x3F | 0x80
  7161. )
  7162. } else if (codePoint < 0x10000) {
  7163. if ((units -= 3) < 0) break
  7164. bytes.push(
  7165. codePoint >> 0xC | 0xE0,
  7166. codePoint >> 0x6 & 0x3F | 0x80,
  7167. codePoint & 0x3F | 0x80
  7168. )
  7169. } else if (codePoint < 0x110000) {
  7170. if ((units -= 4) < 0) break
  7171. bytes.push(
  7172. codePoint >> 0x12 | 0xF0,
  7173. codePoint >> 0xC & 0x3F | 0x80,
  7174. codePoint >> 0x6 & 0x3F | 0x80,
  7175. codePoint & 0x3F | 0x80
  7176. )
  7177. } else {
  7178. throw new Error('Invalid code point')
  7179. }
  7180. }
  7181. return bytes
  7182. }
  7183. function asciiToBytes (str) {
  7184. var byteArray = []
  7185. for (var i = 0; i < str.length; ++i) {
  7186. // Node's code seems to be doing this and not & 0x7F..
  7187. byteArray.push(str.charCodeAt(i) & 0xFF)
  7188. }
  7189. return byteArray
  7190. }
  7191. function utf16leToBytes (str, units) {
  7192. var c, hi, lo
  7193. var byteArray = []
  7194. for (var i = 0; i < str.length; ++i) {
  7195. if ((units -= 2) < 0) break
  7196. c = str.charCodeAt(i)
  7197. hi = c >> 8
  7198. lo = c % 256
  7199. byteArray.push(lo)
  7200. byteArray.push(hi)
  7201. }
  7202. return byteArray
  7203. }
  7204. function base64ToBytes (str) {
  7205. return base64.toByteArray(base64clean(str))
  7206. }
  7207. function blitBuffer (src, dst, offset, length) {
  7208. for (var i = 0; i < length; ++i) {
  7209. if ((i + offset >= dst.length) || (i >= src.length)) break
  7210. dst[i + offset] = src[i]
  7211. }
  7212. return i
  7213. }
  7214. function isnan (val) {
  7215. return val !== val // eslint-disable-line no-self-compare
  7216. }
  7217. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7218. /***/ }),
  7219. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7220. /*!**************************************************!*\
  7221. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7222. \**************************************************/
  7223. /*! no static exports found */
  7224. /***/ (function(module, exports, __webpack_require__) {
  7225. /*!
  7226. * clipboard.js v2.0.4
  7227. * https://zenorocha.github.io/clipboard.js
  7228. *
  7229. * Licensed MIT © Zeno Rocha
  7230. */
  7231. (function webpackUniversalModuleDefinition(root, factory) {
  7232. if(true)
  7233. module.exports = factory();
  7234. else {}
  7235. })(this, function() {
  7236. return /******/ (function(modules) { // webpackBootstrap
  7237. /******/ // The module cache
  7238. /******/ var installedModules = {};
  7239. /******/
  7240. /******/ // The require function
  7241. /******/ function __webpack_require__(moduleId) {
  7242. /******/
  7243. /******/ // Check if module is in cache
  7244. /******/ if(installedModules[moduleId]) {
  7245. /******/ return installedModules[moduleId].exports;
  7246. /******/ }
  7247. /******/ // Create a new module (and put it into the cache)
  7248. /******/ var module = installedModules[moduleId] = {
  7249. /******/ i: moduleId,
  7250. /******/ l: false,
  7251. /******/ exports: {}
  7252. /******/ };
  7253. /******/
  7254. /******/ // Execute the module function
  7255. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7256. /******/
  7257. /******/ // Flag the module as loaded
  7258. /******/ module.l = true;
  7259. /******/
  7260. /******/ // Return the exports of the module
  7261. /******/ return module.exports;
  7262. /******/ }
  7263. /******/
  7264. /******/
  7265. /******/ // expose the modules object (__webpack_modules__)
  7266. /******/ __webpack_require__.m = modules;
  7267. /******/
  7268. /******/ // expose the module cache
  7269. /******/ __webpack_require__.c = installedModules;
  7270. /******/
  7271. /******/ // define getter function for harmony exports
  7272. /******/ __webpack_require__.d = function(exports, name, getter) {
  7273. /******/ if(!__webpack_require__.o(exports, name)) {
  7274. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7275. /******/ }
  7276. /******/ };
  7277. /******/
  7278. /******/ // define __esModule on exports
  7279. /******/ __webpack_require__.r = function(exports) {
  7280. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7281. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7282. /******/ }
  7283. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7284. /******/ };
  7285. /******/
  7286. /******/ // create a fake namespace object
  7287. /******/ // mode & 1: value is a module id, require it
  7288. /******/ // mode & 2: merge all properties of value into the ns
  7289. /******/ // mode & 4: return value when already ns object
  7290. /******/ // mode & 8|1: behave like require
  7291. /******/ __webpack_require__.t = function(value, mode) {
  7292. /******/ if(mode & 1) value = __webpack_require__(value);
  7293. /******/ if(mode & 8) return value;
  7294. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7295. /******/ var ns = Object.create(null);
  7296. /******/ __webpack_require__.r(ns);
  7297. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7298. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7299. /******/ return ns;
  7300. /******/ };
  7301. /******/
  7302. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7303. /******/ __webpack_require__.n = function(module) {
  7304. /******/ var getter = module && module.__esModule ?
  7305. /******/ function getDefault() { return module['default']; } :
  7306. /******/ function getModuleExports() { return module; };
  7307. /******/ __webpack_require__.d(getter, 'a', getter);
  7308. /******/ return getter;
  7309. /******/ };
  7310. /******/
  7311. /******/ // Object.prototype.hasOwnProperty.call
  7312. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7313. /******/
  7314. /******/ // __webpack_public_path__
  7315. /******/ __webpack_require__.p = "";
  7316. /******/
  7317. /******/
  7318. /******/ // Load entry module and return exports
  7319. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7320. /******/ })
  7321. /************************************************************************/
  7322. /******/ ([
  7323. /* 0 */
  7324. /***/ (function(module, exports, __webpack_require__) {
  7325. "use strict";
  7326. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7327. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7328. var _clipboardAction = __webpack_require__(1);
  7329. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7330. var _tinyEmitter = __webpack_require__(3);
  7331. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7332. var _goodListener = __webpack_require__(4);
  7333. var _goodListener2 = _interopRequireDefault(_goodListener);
  7334. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7335. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7336. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7337. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7338. /**
  7339. * Base class which takes one or more elements, adds event listeners to them,
  7340. * and instantiates a new `ClipboardAction` on each click.
  7341. */
  7342. var Clipboard = function (_Emitter) {
  7343. _inherits(Clipboard, _Emitter);
  7344. /**
  7345. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7346. * @param {Object} options
  7347. */
  7348. function Clipboard(trigger, options) {
  7349. _classCallCheck(this, Clipboard);
  7350. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7351. _this.resolveOptions(options);
  7352. _this.listenClick(trigger);
  7353. return _this;
  7354. }
  7355. /**
  7356. * Defines if attributes would be resolved using internal setter functions
  7357. * or custom functions that were passed in the constructor.
  7358. * @param {Object} options
  7359. */
  7360. _createClass(Clipboard, [{
  7361. key: 'resolveOptions',
  7362. value: function resolveOptions() {
  7363. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7364. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7365. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7366. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7367. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7368. }
  7369. /**
  7370. * Adds a click event listener to the passed trigger.
  7371. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7372. */
  7373. }, {
  7374. key: 'listenClick',
  7375. value: function listenClick(trigger) {
  7376. var _this2 = this;
  7377. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7378. return _this2.onClick(e);
  7379. });
  7380. }
  7381. /**
  7382. * Defines a new `ClipboardAction` on each click event.
  7383. * @param {Event} e
  7384. */
  7385. }, {
  7386. key: 'onClick',
  7387. value: function onClick(e) {
  7388. var trigger = e.delegateTarget || e.currentTarget;
  7389. if (this.clipboardAction) {
  7390. this.clipboardAction = null;
  7391. }
  7392. this.clipboardAction = new _clipboardAction2.default({
  7393. action: this.action(trigger),
  7394. target: this.target(trigger),
  7395. text: this.text(trigger),
  7396. container: this.container,
  7397. trigger: trigger,
  7398. emitter: this
  7399. });
  7400. }
  7401. /**
  7402. * Default `action` lookup function.
  7403. * @param {Element} trigger
  7404. */
  7405. }, {
  7406. key: 'defaultAction',
  7407. value: function defaultAction(trigger) {
  7408. return getAttributeValue('action', trigger);
  7409. }
  7410. /**
  7411. * Default `target` lookup function.
  7412. * @param {Element} trigger
  7413. */
  7414. }, {
  7415. key: 'defaultTarget',
  7416. value: function defaultTarget(trigger) {
  7417. var selector = getAttributeValue('target', trigger);
  7418. if (selector) {
  7419. return document.querySelector(selector);
  7420. }
  7421. }
  7422. /**
  7423. * Returns the support of the given action, or all actions if no action is
  7424. * given.
  7425. * @param {String} [action]
  7426. */
  7427. }, {
  7428. key: 'defaultText',
  7429. /**
  7430. * Default `text` lookup function.
  7431. * @param {Element} trigger
  7432. */
  7433. value: function defaultText(trigger) {
  7434. return getAttributeValue('text', trigger);
  7435. }
  7436. /**
  7437. * Destroy lifecycle.
  7438. */
  7439. }, {
  7440. key: 'destroy',
  7441. value: function destroy() {
  7442. this.listener.destroy();
  7443. if (this.clipboardAction) {
  7444. this.clipboardAction.destroy();
  7445. this.clipboardAction = null;
  7446. }
  7447. }
  7448. }], [{
  7449. key: 'isSupported',
  7450. value: function isSupported() {
  7451. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7452. var actions = typeof action === 'string' ? [action] : action;
  7453. var support = !!document.queryCommandSupported;
  7454. actions.forEach(function (action) {
  7455. support = support && !!document.queryCommandSupported(action);
  7456. });
  7457. return support;
  7458. }
  7459. }]);
  7460. return Clipboard;
  7461. }(_tinyEmitter2.default);
  7462. /**
  7463. * Helper function to retrieve attribute value.
  7464. * @param {String} suffix
  7465. * @param {Element} element
  7466. */
  7467. function getAttributeValue(suffix, element) {
  7468. var attribute = 'data-clipboard-' + suffix;
  7469. if (!element.hasAttribute(attribute)) {
  7470. return;
  7471. }
  7472. return element.getAttribute(attribute);
  7473. }
  7474. module.exports = Clipboard;
  7475. /***/ }),
  7476. /* 1 */
  7477. /***/ (function(module, exports, __webpack_require__) {
  7478. "use strict";
  7479. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7480. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7481. var _select = __webpack_require__(2);
  7482. var _select2 = _interopRequireDefault(_select);
  7483. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7484. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7485. /**
  7486. * Inner class which performs selection from either `text` or `target`
  7487. * properties and then executes copy or cut operations.
  7488. */
  7489. var ClipboardAction = function () {
  7490. /**
  7491. * @param {Object} options
  7492. */
  7493. function ClipboardAction(options) {
  7494. _classCallCheck(this, ClipboardAction);
  7495. this.resolveOptions(options);
  7496. this.initSelection();
  7497. }
  7498. /**
  7499. * Defines base properties passed from constructor.
  7500. * @param {Object} options
  7501. */
  7502. _createClass(ClipboardAction, [{
  7503. key: 'resolveOptions',
  7504. value: function resolveOptions() {
  7505. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7506. this.action = options.action;
  7507. this.container = options.container;
  7508. this.emitter = options.emitter;
  7509. this.target = options.target;
  7510. this.text = options.text;
  7511. this.trigger = options.trigger;
  7512. this.selectedText = '';
  7513. }
  7514. /**
  7515. * Decides which selection strategy is going to be applied based
  7516. * on the existence of `text` and `target` properties.
  7517. */
  7518. }, {
  7519. key: 'initSelection',
  7520. value: function initSelection() {
  7521. if (this.text) {
  7522. this.selectFake();
  7523. } else if (this.target) {
  7524. this.selectTarget();
  7525. }
  7526. }
  7527. /**
  7528. * Creates a fake textarea element, sets its value from `text` property,
  7529. * and makes a selection on it.
  7530. */
  7531. }, {
  7532. key: 'selectFake',
  7533. value: function selectFake() {
  7534. var _this = this;
  7535. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7536. this.removeFake();
  7537. this.fakeHandlerCallback = function () {
  7538. return _this.removeFake();
  7539. };
  7540. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7541. this.fakeElem = document.createElement('textarea');
  7542. // Prevent zooming on iOS
  7543. this.fakeElem.style.fontSize = '12pt';
  7544. // Reset box model
  7545. this.fakeElem.style.border = '0';
  7546. this.fakeElem.style.padding = '0';
  7547. this.fakeElem.style.margin = '0';
  7548. // Move element out of screen horizontally
  7549. this.fakeElem.style.position = 'absolute';
  7550. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7551. // Move element to the same position vertically
  7552. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7553. this.fakeElem.style.top = yPosition + 'px';
  7554. this.fakeElem.setAttribute('readonly', '');
  7555. this.fakeElem.value = this.text;
  7556. this.container.appendChild(this.fakeElem);
  7557. this.selectedText = (0, _select2.default)(this.fakeElem);
  7558. this.copyText();
  7559. }
  7560. /**
  7561. * Only removes the fake element after another click event, that way
  7562. * a user can hit `Ctrl+C` to copy because selection still exists.
  7563. */
  7564. }, {
  7565. key: 'removeFake',
  7566. value: function removeFake() {
  7567. if (this.fakeHandler) {
  7568. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7569. this.fakeHandler = null;
  7570. this.fakeHandlerCallback = null;
  7571. }
  7572. if (this.fakeElem) {
  7573. this.container.removeChild(this.fakeElem);
  7574. this.fakeElem = null;
  7575. }
  7576. }
  7577. /**
  7578. * Selects the content from element passed on `target` property.
  7579. */
  7580. }, {
  7581. key: 'selectTarget',
  7582. value: function selectTarget() {
  7583. this.selectedText = (0, _select2.default)(this.target);
  7584. this.copyText();
  7585. }
  7586. /**
  7587. * Executes the copy operation based on the current selection.
  7588. */
  7589. }, {
  7590. key: 'copyText',
  7591. value: function copyText() {
  7592. var succeeded = void 0;
  7593. try {
  7594. succeeded = document.execCommand(this.action);
  7595. } catch (err) {
  7596. succeeded = false;
  7597. }
  7598. this.handleResult(succeeded);
  7599. }
  7600. /**
  7601. * Fires an event based on the copy operation result.
  7602. * @param {Boolean} succeeded
  7603. */
  7604. }, {
  7605. key: 'handleResult',
  7606. value: function handleResult(succeeded) {
  7607. this.emitter.emit(succeeded ? 'success' : 'error', {
  7608. action: this.action,
  7609. text: this.selectedText,
  7610. trigger: this.trigger,
  7611. clearSelection: this.clearSelection.bind(this)
  7612. });
  7613. }
  7614. /**
  7615. * Moves focus away from `target` and back to the trigger, removes current selection.
  7616. */
  7617. }, {
  7618. key: 'clearSelection',
  7619. value: function clearSelection() {
  7620. if (this.trigger) {
  7621. this.trigger.focus();
  7622. }
  7623. window.getSelection().removeAllRanges();
  7624. }
  7625. /**
  7626. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7627. * @param {String} action
  7628. */
  7629. }, {
  7630. key: 'destroy',
  7631. /**
  7632. * Destroy lifecycle.
  7633. */
  7634. value: function destroy() {
  7635. this.removeFake();
  7636. }
  7637. }, {
  7638. key: 'action',
  7639. set: function set() {
  7640. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7641. this._action = action;
  7642. if (this._action !== 'copy' && this._action !== 'cut') {
  7643. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7644. }
  7645. }
  7646. /**
  7647. * Gets the `action` property.
  7648. * @return {String}
  7649. */
  7650. ,
  7651. get: function get() {
  7652. return this._action;
  7653. }
  7654. /**
  7655. * Sets the `target` property using an element
  7656. * that will be have its content copied.
  7657. * @param {Element} target
  7658. */
  7659. }, {
  7660. key: 'target',
  7661. set: function set(target) {
  7662. if (target !== undefined) {
  7663. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7664. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7665. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7666. }
  7667. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7668. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7669. }
  7670. this._target = target;
  7671. } else {
  7672. throw new Error('Invalid "target" value, use a valid Element');
  7673. }
  7674. }
  7675. }
  7676. /**
  7677. * Gets the `target` property.
  7678. * @return {String|HTMLElement}
  7679. */
  7680. ,
  7681. get: function get() {
  7682. return this._target;
  7683. }
  7684. }]);
  7685. return ClipboardAction;
  7686. }();
  7687. module.exports = ClipboardAction;
  7688. /***/ }),
  7689. /* 2 */
  7690. /***/ (function(module, exports) {
  7691. function select(element) {
  7692. var selectedText;
  7693. if (element.nodeName === 'SELECT') {
  7694. element.focus();
  7695. selectedText = element.value;
  7696. }
  7697. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7698. var isReadOnly = element.hasAttribute('readonly');
  7699. if (!isReadOnly) {
  7700. element.setAttribute('readonly', '');
  7701. }
  7702. element.select();
  7703. element.setSelectionRange(0, element.value.length);
  7704. if (!isReadOnly) {
  7705. element.removeAttribute('readonly');
  7706. }
  7707. selectedText = element.value;
  7708. }
  7709. else {
  7710. if (element.hasAttribute('contenteditable')) {
  7711. element.focus();
  7712. }
  7713. var selection = window.getSelection();
  7714. var range = document.createRange();
  7715. range.selectNodeContents(element);
  7716. selection.removeAllRanges();
  7717. selection.addRange(range);
  7718. selectedText = selection.toString();
  7719. }
  7720. return selectedText;
  7721. }
  7722. module.exports = select;
  7723. /***/ }),
  7724. /* 3 */
  7725. /***/ (function(module, exports) {
  7726. function E () {
  7727. // Keep this empty so it's easier to inherit from
  7728. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7729. }
  7730. E.prototype = {
  7731. on: function (name, callback, ctx) {
  7732. var e = this.e || (this.e = {});
  7733. (e[name] || (e[name] = [])).push({
  7734. fn: callback,
  7735. ctx: ctx
  7736. });
  7737. return this;
  7738. },
  7739. once: function (name, callback, ctx) {
  7740. var self = this;
  7741. function listener () {
  7742. self.off(name, listener);
  7743. callback.apply(ctx, arguments);
  7744. };
  7745. listener._ = callback
  7746. return this.on(name, listener, ctx);
  7747. },
  7748. emit: function (name) {
  7749. var data = [].slice.call(arguments, 1);
  7750. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7751. var i = 0;
  7752. var len = evtArr.length;
  7753. for (i; i < len; i++) {
  7754. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7755. }
  7756. return this;
  7757. },
  7758. off: function (name, callback) {
  7759. var e = this.e || (this.e = {});
  7760. var evts = e[name];
  7761. var liveEvents = [];
  7762. if (evts && callback) {
  7763. for (var i = 0, len = evts.length; i < len; i++) {
  7764. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7765. liveEvents.push(evts[i]);
  7766. }
  7767. }
  7768. // Remove event from queue to prevent memory leak
  7769. // Suggested by https://github.com/lazd
  7770. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7771. (liveEvents.length)
  7772. ? e[name] = liveEvents
  7773. : delete e[name];
  7774. return this;
  7775. }
  7776. };
  7777. module.exports = E;
  7778. /***/ }),
  7779. /* 4 */
  7780. /***/ (function(module, exports, __webpack_require__) {
  7781. var is = __webpack_require__(5);
  7782. var delegate = __webpack_require__(6);
  7783. /**
  7784. * Validates all params and calls the right
  7785. * listener function based on its target type.
  7786. *
  7787. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7788. * @param {String} type
  7789. * @param {Function} callback
  7790. * @return {Object}
  7791. */
  7792. function listen(target, type, callback) {
  7793. if (!target && !type && !callback) {
  7794. throw new Error('Missing required arguments');
  7795. }
  7796. if (!is.string(type)) {
  7797. throw new TypeError('Second argument must be a String');
  7798. }
  7799. if (!is.fn(callback)) {
  7800. throw new TypeError('Third argument must be a Function');
  7801. }
  7802. if (is.node(target)) {
  7803. return listenNode(target, type, callback);
  7804. }
  7805. else if (is.nodeList(target)) {
  7806. return listenNodeList(target, type, callback);
  7807. }
  7808. else if (is.string(target)) {
  7809. return listenSelector(target, type, callback);
  7810. }
  7811. else {
  7812. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7813. }
  7814. }
  7815. /**
  7816. * Adds an event listener to a HTML element
  7817. * and returns a remove listener function.
  7818. *
  7819. * @param {HTMLElement} node
  7820. * @param {String} type
  7821. * @param {Function} callback
  7822. * @return {Object}
  7823. */
  7824. function listenNode(node, type, callback) {
  7825. node.addEventListener(type, callback);
  7826. return {
  7827. destroy: function() {
  7828. node.removeEventListener(type, callback);
  7829. }
  7830. }
  7831. }
  7832. /**
  7833. * Add an event listener to a list of HTML elements
  7834. * and returns a remove listener function.
  7835. *
  7836. * @param {NodeList|HTMLCollection} nodeList
  7837. * @param {String} type
  7838. * @param {Function} callback
  7839. * @return {Object}
  7840. */
  7841. function listenNodeList(nodeList, type, callback) {
  7842. Array.prototype.forEach.call(nodeList, function(node) {
  7843. node.addEventListener(type, callback);
  7844. });
  7845. return {
  7846. destroy: function() {
  7847. Array.prototype.forEach.call(nodeList, function(node) {
  7848. node.removeEventListener(type, callback);
  7849. });
  7850. }
  7851. }
  7852. }
  7853. /**
  7854. * Add an event listener to a selector
  7855. * and returns a remove listener function.
  7856. *
  7857. * @param {String} selector
  7858. * @param {String} type
  7859. * @param {Function} callback
  7860. * @return {Object}
  7861. */
  7862. function listenSelector(selector, type, callback) {
  7863. return delegate(document.body, selector, type, callback);
  7864. }
  7865. module.exports = listen;
  7866. /***/ }),
  7867. /* 5 */
  7868. /***/ (function(module, exports) {
  7869. /**
  7870. * Check if argument is a HTML element.
  7871. *
  7872. * @param {Object} value
  7873. * @return {Boolean}
  7874. */
  7875. exports.node = function(value) {
  7876. return value !== undefined
  7877. && value instanceof HTMLElement
  7878. && value.nodeType === 1;
  7879. };
  7880. /**
  7881. * Check if argument is a list of HTML elements.
  7882. *
  7883. * @param {Object} value
  7884. * @return {Boolean}
  7885. */
  7886. exports.nodeList = function(value) {
  7887. var type = Object.prototype.toString.call(value);
  7888. return value !== undefined
  7889. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  7890. && ('length' in value)
  7891. && (value.length === 0 || exports.node(value[0]));
  7892. };
  7893. /**
  7894. * Check if argument is a string.
  7895. *
  7896. * @param {Object} value
  7897. * @return {Boolean}
  7898. */
  7899. exports.string = function(value) {
  7900. return typeof value === 'string'
  7901. || value instanceof String;
  7902. };
  7903. /**
  7904. * Check if argument is a function.
  7905. *
  7906. * @param {Object} value
  7907. * @return {Boolean}
  7908. */
  7909. exports.fn = function(value) {
  7910. var type = Object.prototype.toString.call(value);
  7911. return type === '[object Function]';
  7912. };
  7913. /***/ }),
  7914. /* 6 */
  7915. /***/ (function(module, exports, __webpack_require__) {
  7916. var closest = __webpack_require__(7);
  7917. /**
  7918. * Delegates event to a selector.
  7919. *
  7920. * @param {Element} element
  7921. * @param {String} selector
  7922. * @param {String} type
  7923. * @param {Function} callback
  7924. * @param {Boolean} useCapture
  7925. * @return {Object}
  7926. */
  7927. function _delegate(element, selector, type, callback, useCapture) {
  7928. var listenerFn = listener.apply(this, arguments);
  7929. element.addEventListener(type, listenerFn, useCapture);
  7930. return {
  7931. destroy: function() {
  7932. element.removeEventListener(type, listenerFn, useCapture);
  7933. }
  7934. }
  7935. }
  7936. /**
  7937. * Delegates event to a selector.
  7938. *
  7939. * @param {Element|String|Array} [elements]
  7940. * @param {String} selector
  7941. * @param {String} type
  7942. * @param {Function} callback
  7943. * @param {Boolean} useCapture
  7944. * @return {Object}
  7945. */
  7946. function delegate(elements, selector, type, callback, useCapture) {
  7947. // Handle the regular Element usage
  7948. if (typeof elements.addEventListener === 'function') {
  7949. return _delegate.apply(null, arguments);
  7950. }
  7951. // Handle Element-less usage, it defaults to global delegation
  7952. if (typeof type === 'function') {
  7953. // Use `document` as the first parameter, then apply arguments
  7954. // This is a short way to .unshift `arguments` without running into deoptimizations
  7955. return _delegate.bind(null, document).apply(null, arguments);
  7956. }
  7957. // Handle Selector-based usage
  7958. if (typeof elements === 'string') {
  7959. elements = document.querySelectorAll(elements);
  7960. }
  7961. // Handle Array-like based usage
  7962. return Array.prototype.map.call(elements, function (element) {
  7963. return _delegate(element, selector, type, callback, useCapture);
  7964. });
  7965. }
  7966. /**
  7967. * Finds closest match and invokes callback.
  7968. *
  7969. * @param {Element} element
  7970. * @param {String} selector
  7971. * @param {String} type
  7972. * @param {Function} callback
  7973. * @return {Function}
  7974. */
  7975. function listener(element, selector, type, callback) {
  7976. return function(e) {
  7977. e.delegateTarget = closest(e.target, selector);
  7978. if (e.delegateTarget) {
  7979. callback.call(element, e);
  7980. }
  7981. }
  7982. }
  7983. module.exports = delegate;
  7984. /***/ }),
  7985. /* 7 */
  7986. /***/ (function(module, exports) {
  7987. var DOCUMENT_NODE_TYPE = 9;
  7988. /**
  7989. * A polyfill for Element.matches()
  7990. */
  7991. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  7992. var proto = Element.prototype;
  7993. proto.matches = proto.matchesSelector ||
  7994. proto.mozMatchesSelector ||
  7995. proto.msMatchesSelector ||
  7996. proto.oMatchesSelector ||
  7997. proto.webkitMatchesSelector;
  7998. }
  7999. /**
  8000. * Finds the closest parent that matches a selector.
  8001. *
  8002. * @param {Element} element
  8003. * @param {String} selector
  8004. * @return {Function}
  8005. */
  8006. function closest (element, selector) {
  8007. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8008. if (typeof element.matches === 'function' &&
  8009. element.matches(selector)) {
  8010. return element;
  8011. }
  8012. element = element.parentNode;
  8013. }
  8014. }
  8015. module.exports = closest;
  8016. /***/ })
  8017. /******/ ]);
  8018. });
  8019. /***/ }),
  8020. /***/ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  8021. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  8022. !*** ./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  8023. \********************************************************************************************************************************************************************************************************************************************************************************************/
  8024. /*! no static exports found */
  8025. /***/ (function(module, exports, __webpack_require__) {
  8026. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  8027. // imports
  8028. // module
  8029. exports.push([module.i, "\n.full-height[data-v-1ae8ae93] {\n height: 100vh;\n}\n.flex-center[data-v-1ae8ae93] {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n.position-ref[data-v-1ae8ae93] {\n position: relative;\n}\n.top-right[data-v-1ae8ae93] {\n position: absolute;\n right: 10px;\n top: 18px;\n}\n.content[data-v-1ae8ae93] {\n text-align: center;\n}\n.title[data-v-1ae8ae93] {\n font-size: 60px;\n}\n.links > a[data-v-1ae8ae93] {\n color: #636b6f;\n padding: 0 25px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: .1rem;\n text-decoration: none;\n text-transform: uppercase;\n}\n.m-b-md[data-v-1ae8ae93] {\n margin-bottom: 30px;\n color: #000000;\n}\n", ""]);
  8030. // exports
  8031. /***/ }),
  8032. /***/ "./node_modules/css-loader/lib/css-base.js":
  8033. /*!*************************************************!*\
  8034. !*** ./node_modules/css-loader/lib/css-base.js ***!
  8035. \*************************************************/
  8036. /*! no static exports found */
  8037. /***/ (function(module, exports) {
  8038. /*
  8039. MIT License http://www.opensource.org/licenses/mit-license.php
  8040. Author Tobias Koppers @sokra
  8041. */
  8042. // css base code, injected by the css-loader
  8043. module.exports = function(useSourceMap) {
  8044. var list = [];
  8045. // return the list of modules as css string
  8046. list.toString = function toString() {
  8047. return this.map(function (item) {
  8048. var content = cssWithMappingToString(item, useSourceMap);
  8049. if(item[2]) {
  8050. return "@media " + item[2] + "{" + content + "}";
  8051. } else {
  8052. return content;
  8053. }
  8054. }).join("");
  8055. };
  8056. // import a list of modules into the list
  8057. list.i = function(modules, mediaQuery) {
  8058. if(typeof modules === "string")
  8059. modules = [[null, modules, ""]];
  8060. var alreadyImportedModules = {};
  8061. for(var i = 0; i < this.length; i++) {
  8062. var id = this[i][0];
  8063. if(typeof id === "number")
  8064. alreadyImportedModules[id] = true;
  8065. }
  8066. for(i = 0; i < modules.length; i++) {
  8067. var item = modules[i];
  8068. // skip already imported module
  8069. // this implementation is not 100% perfect for weird media query combinations
  8070. // when a module is imported multiple times with different media queries.
  8071. // I hope this will never occur (Hey this way we have smaller bundles)
  8072. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  8073. if(mediaQuery && !item[2]) {
  8074. item[2] = mediaQuery;
  8075. } else if(mediaQuery) {
  8076. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  8077. }
  8078. list.push(item);
  8079. }
  8080. }
  8081. };
  8082. return list;
  8083. };
  8084. function cssWithMappingToString(item, useSourceMap) {
  8085. var content = item[1] || '';
  8086. var cssMapping = item[3];
  8087. if (!cssMapping) {
  8088. return content;
  8089. }
  8090. if (useSourceMap && typeof btoa === 'function') {
  8091. var sourceMapping = toComment(cssMapping);
  8092. var sourceURLs = cssMapping.sources.map(function (source) {
  8093. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  8094. });
  8095. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  8096. }
  8097. return [content].join('\n');
  8098. }
  8099. // Adapted from convert-source-map (MIT)
  8100. function toComment(sourceMap) {
  8101. // eslint-disable-next-line no-undef
  8102. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  8103. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  8104. return '/*# ' + data + ' */';
  8105. }
  8106. /***/ }),
  8107. /***/ "./node_modules/ieee754/index.js":
  8108. /*!***************************************!*\
  8109. !*** ./node_modules/ieee754/index.js ***!
  8110. \***************************************/
  8111. /*! no static exports found */
  8112. /***/ (function(module, exports) {
  8113. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8114. var e, m
  8115. var eLen = (nBytes * 8) - mLen - 1
  8116. var eMax = (1 << eLen) - 1
  8117. var eBias = eMax >> 1
  8118. var nBits = -7
  8119. var i = isLE ? (nBytes - 1) : 0
  8120. var d = isLE ? -1 : 1
  8121. var s = buffer[offset + i]
  8122. i += d
  8123. e = s & ((1 << (-nBits)) - 1)
  8124. s >>= (-nBits)
  8125. nBits += eLen
  8126. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8127. m = e & ((1 << (-nBits)) - 1)
  8128. e >>= (-nBits)
  8129. nBits += mLen
  8130. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8131. if (e === 0) {
  8132. e = 1 - eBias
  8133. } else if (e === eMax) {
  8134. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8135. } else {
  8136. m = m + Math.pow(2, mLen)
  8137. e = e - eBias
  8138. }
  8139. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8140. }
  8141. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8142. var e, m, c
  8143. var eLen = (nBytes * 8) - mLen - 1
  8144. var eMax = (1 << eLen) - 1
  8145. var eBias = eMax >> 1
  8146. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8147. var i = isLE ? 0 : (nBytes - 1)
  8148. var d = isLE ? 1 : -1
  8149. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8150. value = Math.abs(value)
  8151. if (isNaN(value) || value === Infinity) {
  8152. m = isNaN(value) ? 1 : 0
  8153. e = eMax
  8154. } else {
  8155. e = Math.floor(Math.log(value) / Math.LN2)
  8156. if (value * (c = Math.pow(2, -e)) < 1) {
  8157. e--
  8158. c *= 2
  8159. }
  8160. if (e + eBias >= 1) {
  8161. value += rt / c
  8162. } else {
  8163. value += rt * Math.pow(2, 1 - eBias)
  8164. }
  8165. if (value * c >= 2) {
  8166. e++
  8167. c /= 2
  8168. }
  8169. if (e + eBias >= eMax) {
  8170. m = 0
  8171. e = eMax
  8172. } else if (e + eBias >= 1) {
  8173. m = ((value * c) - 1) * Math.pow(2, mLen)
  8174. e = e + eBias
  8175. } else {
  8176. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8177. e = 0
  8178. }
  8179. }
  8180. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8181. e = (e << mLen) | m
  8182. eLen += mLen
  8183. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8184. buffer[offset + i - d] |= s * 128
  8185. }
  8186. /***/ }),
  8187. /***/ "./node_modules/isarray/index.js":
  8188. /*!***************************************!*\
  8189. !*** ./node_modules/isarray/index.js ***!
  8190. \***************************************/
  8191. /*! no static exports found */
  8192. /***/ (function(module, exports) {
  8193. var toString = {}.toString;
  8194. module.exports = Array.isArray || function (arr) {
  8195. return toString.call(arr) == '[object Array]';
  8196. };
  8197. /***/ }),
  8198. /***/ "./node_modules/jquery/dist/jquery.js":
  8199. /*!********************************************!*\
  8200. !*** ./node_modules/jquery/dist/jquery.js ***!
  8201. \********************************************/
  8202. /*! no static exports found */
  8203. /***/ (function(module, exports, __webpack_require__) {
  8204. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8205. * jQuery JavaScript Library v3.4.1
  8206. * https://jquery.com/
  8207. *
  8208. * Includes Sizzle.js
  8209. * https://sizzlejs.com/
  8210. *
  8211. * Copyright JS Foundation and other contributors
  8212. * Released under the MIT license
  8213. * https://jquery.org/license
  8214. *
  8215. * Date: 2019-05-01T21:04Z
  8216. */
  8217. ( function( global, factory ) {
  8218. "use strict";
  8219. if ( true && typeof module.exports === "object" ) {
  8220. // For CommonJS and CommonJS-like environments where a proper `window`
  8221. // is present, execute the factory and get jQuery.
  8222. // For environments that do not have a `window` with a `document`
  8223. // (such as Node.js), expose a factory as module.exports.
  8224. // This accentuates the need for the creation of a real `window`.
  8225. // e.g. var jQuery = require("jquery")(window);
  8226. // See ticket #14549 for more info.
  8227. module.exports = global.document ?
  8228. factory( global, true ) :
  8229. function( w ) {
  8230. if ( !w.document ) {
  8231. throw new Error( "jQuery requires a window with a document" );
  8232. }
  8233. return factory( w );
  8234. };
  8235. } else {
  8236. factory( global );
  8237. }
  8238. // Pass this if window is not defined yet
  8239. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8240. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8241. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8242. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8243. // enough that all such attempts are guarded in a try block.
  8244. "use strict";
  8245. var arr = [];
  8246. var document = window.document;
  8247. var getProto = Object.getPrototypeOf;
  8248. var slice = arr.slice;
  8249. var concat = arr.concat;
  8250. var push = arr.push;
  8251. var indexOf = arr.indexOf;
  8252. var class2type = {};
  8253. var toString = class2type.toString;
  8254. var hasOwn = class2type.hasOwnProperty;
  8255. var fnToString = hasOwn.toString;
  8256. var ObjectFunctionString = fnToString.call( Object );
  8257. var support = {};
  8258. var isFunction = function isFunction( obj ) {
  8259. // Support: Chrome <=57, Firefox <=52
  8260. // In some browsers, typeof returns "function" for HTML <object> elements
  8261. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8262. // We don't want to classify *any* DOM node as a function.
  8263. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8264. };
  8265. var isWindow = function isWindow( obj ) {
  8266. return obj != null && obj === obj.window;
  8267. };
  8268. var preservedScriptAttributes = {
  8269. type: true,
  8270. src: true,
  8271. nonce: true,
  8272. noModule: true
  8273. };
  8274. function DOMEval( code, node, doc ) {
  8275. doc = doc || document;
  8276. var i, val,
  8277. script = doc.createElement( "script" );
  8278. script.text = code;
  8279. if ( node ) {
  8280. for ( i in preservedScriptAttributes ) {
  8281. // Support: Firefox 64+, Edge 18+
  8282. // Some browsers don't support the "nonce" property on scripts.
  8283. // On the other hand, just using `getAttribute` is not enough as
  8284. // the `nonce` attribute is reset to an empty string whenever it
  8285. // becomes browsing-context connected.
  8286. // See https://github.com/whatwg/html/issues/2369
  8287. // See https://html.spec.whatwg.org/#nonce-attributes
  8288. // The `node.getAttribute` check was added for the sake of
  8289. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8290. // via an object.
  8291. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8292. if ( val ) {
  8293. script.setAttribute( i, val );
  8294. }
  8295. }
  8296. }
  8297. doc.head.appendChild( script ).parentNode.removeChild( script );
  8298. }
  8299. function toType( obj ) {
  8300. if ( obj == null ) {
  8301. return obj + "";
  8302. }
  8303. // Support: Android <=2.3 only (functionish RegExp)
  8304. return typeof obj === "object" || typeof obj === "function" ?
  8305. class2type[ toString.call( obj ) ] || "object" :
  8306. typeof obj;
  8307. }
  8308. /* global Symbol */
  8309. // Defining this global in .eslintrc.json would create a danger of using the global
  8310. // unguarded in another place, it seems safer to define global only for this module
  8311. var
  8312. version = "3.4.1",
  8313. // Define a local copy of jQuery
  8314. jQuery = function( selector, context ) {
  8315. // The jQuery object is actually just the init constructor 'enhanced'
  8316. // Need init if jQuery is called (just allow error to be thrown if not included)
  8317. return new jQuery.fn.init( selector, context );
  8318. },
  8319. // Support: Android <=4.0 only
  8320. // Make sure we trim BOM and NBSP
  8321. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8322. jQuery.fn = jQuery.prototype = {
  8323. // The current version of jQuery being used
  8324. jquery: version,
  8325. constructor: jQuery,
  8326. // The default length of a jQuery object is 0
  8327. length: 0,
  8328. toArray: function() {
  8329. return slice.call( this );
  8330. },
  8331. // Get the Nth element in the matched element set OR
  8332. // Get the whole matched element set as a clean array
  8333. get: function( num ) {
  8334. // Return all the elements in a clean array
  8335. if ( num == null ) {
  8336. return slice.call( this );
  8337. }
  8338. // Return just the one element from the set
  8339. return num < 0 ? this[ num + this.length ] : this[ num ];
  8340. },
  8341. // Take an array of elements and push it onto the stack
  8342. // (returning the new matched element set)
  8343. pushStack: function( elems ) {
  8344. // Build a new jQuery matched element set
  8345. var ret = jQuery.merge( this.constructor(), elems );
  8346. // Add the old object onto the stack (as a reference)
  8347. ret.prevObject = this;
  8348. // Return the newly-formed element set
  8349. return ret;
  8350. },
  8351. // Execute a callback for every element in the matched set.
  8352. each: function( callback ) {
  8353. return jQuery.each( this, callback );
  8354. },
  8355. map: function( callback ) {
  8356. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8357. return callback.call( elem, i, elem );
  8358. } ) );
  8359. },
  8360. slice: function() {
  8361. return this.pushStack( slice.apply( this, arguments ) );
  8362. },
  8363. first: function() {
  8364. return this.eq( 0 );
  8365. },
  8366. last: function() {
  8367. return this.eq( -1 );
  8368. },
  8369. eq: function( i ) {
  8370. var len = this.length,
  8371. j = +i + ( i < 0 ? len : 0 );
  8372. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8373. },
  8374. end: function() {
  8375. return this.prevObject || this.constructor();
  8376. },
  8377. // For internal use only.
  8378. // Behaves like an Array's method, not like a jQuery method.
  8379. push: push,
  8380. sort: arr.sort,
  8381. splice: arr.splice
  8382. };
  8383. jQuery.extend = jQuery.fn.extend = function() {
  8384. var options, name, src, copy, copyIsArray, clone,
  8385. target = arguments[ 0 ] || {},
  8386. i = 1,
  8387. length = arguments.length,
  8388. deep = false;
  8389. // Handle a deep copy situation
  8390. if ( typeof target === "boolean" ) {
  8391. deep = target;
  8392. // Skip the boolean and the target
  8393. target = arguments[ i ] || {};
  8394. i++;
  8395. }
  8396. // Handle case when target is a string or something (possible in deep copy)
  8397. if ( typeof target !== "object" && !isFunction( target ) ) {
  8398. target = {};
  8399. }
  8400. // Extend jQuery itself if only one argument is passed
  8401. if ( i === length ) {
  8402. target = this;
  8403. i--;
  8404. }
  8405. for ( ; i < length; i++ ) {
  8406. // Only deal with non-null/undefined values
  8407. if ( ( options = arguments[ i ] ) != null ) {
  8408. // Extend the base object
  8409. for ( name in options ) {
  8410. copy = options[ name ];
  8411. // Prevent Object.prototype pollution
  8412. // Prevent never-ending loop
  8413. if ( name === "__proto__" || target === copy ) {
  8414. continue;
  8415. }
  8416. // Recurse if we're merging plain objects or arrays
  8417. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8418. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8419. src = target[ name ];
  8420. // Ensure proper type for the source value
  8421. if ( copyIsArray && !Array.isArray( src ) ) {
  8422. clone = [];
  8423. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8424. clone = {};
  8425. } else {
  8426. clone = src;
  8427. }
  8428. copyIsArray = false;
  8429. // Never move original objects, clone them
  8430. target[ name ] = jQuery.extend( deep, clone, copy );
  8431. // Don't bring in undefined values
  8432. } else if ( copy !== undefined ) {
  8433. target[ name ] = copy;
  8434. }
  8435. }
  8436. }
  8437. }
  8438. // Return the modified object
  8439. return target;
  8440. };
  8441. jQuery.extend( {
  8442. // Unique for each copy of jQuery on the page
  8443. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8444. // Assume jQuery is ready without the ready module
  8445. isReady: true,
  8446. error: function( msg ) {
  8447. throw new Error( msg );
  8448. },
  8449. noop: function() {},
  8450. isPlainObject: function( obj ) {
  8451. var proto, Ctor;
  8452. // Detect obvious negatives
  8453. // Use toString instead of jQuery.type to catch host objects
  8454. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8455. return false;
  8456. }
  8457. proto = getProto( obj );
  8458. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8459. if ( !proto ) {
  8460. return true;
  8461. }
  8462. // Objects with prototype are plain iff they were constructed by a global Object function
  8463. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8464. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8465. },
  8466. isEmptyObject: function( obj ) {
  8467. var name;
  8468. for ( name in obj ) {
  8469. return false;
  8470. }
  8471. return true;
  8472. },
  8473. // Evaluates a script in a global context
  8474. globalEval: function( code, options ) {
  8475. DOMEval( code, { nonce: options && options.nonce } );
  8476. },
  8477. each: function( obj, callback ) {
  8478. var length, i = 0;
  8479. if ( isArrayLike( obj ) ) {
  8480. length = obj.length;
  8481. for ( ; i < length; i++ ) {
  8482. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8483. break;
  8484. }
  8485. }
  8486. } else {
  8487. for ( i in obj ) {
  8488. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8489. break;
  8490. }
  8491. }
  8492. }
  8493. return obj;
  8494. },
  8495. // Support: Android <=4.0 only
  8496. trim: function( text ) {
  8497. return text == null ?
  8498. "" :
  8499. ( text + "" ).replace( rtrim, "" );
  8500. },
  8501. // results is for internal usage only
  8502. makeArray: function( arr, results ) {
  8503. var ret = results || [];
  8504. if ( arr != null ) {
  8505. if ( isArrayLike( Object( arr ) ) ) {
  8506. jQuery.merge( ret,
  8507. typeof arr === "string" ?
  8508. [ arr ] : arr
  8509. );
  8510. } else {
  8511. push.call( ret, arr );
  8512. }
  8513. }
  8514. return ret;
  8515. },
  8516. inArray: function( elem, arr, i ) {
  8517. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8518. },
  8519. // Support: Android <=4.0 only, PhantomJS 1 only
  8520. // push.apply(_, arraylike) throws on ancient WebKit
  8521. merge: function( first, second ) {
  8522. var len = +second.length,
  8523. j = 0,
  8524. i = first.length;
  8525. for ( ; j < len; j++ ) {
  8526. first[ i++ ] = second[ j ];
  8527. }
  8528. first.length = i;
  8529. return first;
  8530. },
  8531. grep: function( elems, callback, invert ) {
  8532. var callbackInverse,
  8533. matches = [],
  8534. i = 0,
  8535. length = elems.length,
  8536. callbackExpect = !invert;
  8537. // Go through the array, only saving the items
  8538. // that pass the validator function
  8539. for ( ; i < length; i++ ) {
  8540. callbackInverse = !callback( elems[ i ], i );
  8541. if ( callbackInverse !== callbackExpect ) {
  8542. matches.push( elems[ i ] );
  8543. }
  8544. }
  8545. return matches;
  8546. },
  8547. // arg is for internal usage only
  8548. map: function( elems, callback, arg ) {
  8549. var length, value,
  8550. i = 0,
  8551. ret = [];
  8552. // Go through the array, translating each of the items to their new values
  8553. if ( isArrayLike( elems ) ) {
  8554. length = elems.length;
  8555. for ( ; i < length; i++ ) {
  8556. value = callback( elems[ i ], i, arg );
  8557. if ( value != null ) {
  8558. ret.push( value );
  8559. }
  8560. }
  8561. // Go through every key on the object,
  8562. } else {
  8563. for ( i in elems ) {
  8564. value = callback( elems[ i ], i, arg );
  8565. if ( value != null ) {
  8566. ret.push( value );
  8567. }
  8568. }
  8569. }
  8570. // Flatten any nested arrays
  8571. return concat.apply( [], ret );
  8572. },
  8573. // A global GUID counter for objects
  8574. guid: 1,
  8575. // jQuery.support is not used in Core but other projects attach their
  8576. // properties to it so it needs to exist.
  8577. support: support
  8578. } );
  8579. if ( typeof Symbol === "function" ) {
  8580. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8581. }
  8582. // Populate the class2type map
  8583. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8584. function( i, name ) {
  8585. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8586. } );
  8587. function isArrayLike( obj ) {
  8588. // Support: real iOS 8.2 only (not reproducible in simulator)
  8589. // `in` check used to prevent JIT error (gh-2145)
  8590. // hasOwn isn't used here due to false negatives
  8591. // regarding Nodelist length in IE
  8592. var length = !!obj && "length" in obj && obj.length,
  8593. type = toType( obj );
  8594. if ( isFunction( obj ) || isWindow( obj ) ) {
  8595. return false;
  8596. }
  8597. return type === "array" || length === 0 ||
  8598. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8599. }
  8600. var Sizzle =
  8601. /*!
  8602. * Sizzle CSS Selector Engine v2.3.4
  8603. * https://sizzlejs.com/
  8604. *
  8605. * Copyright JS Foundation and other contributors
  8606. * Released under the MIT license
  8607. * https://js.foundation/
  8608. *
  8609. * Date: 2019-04-08
  8610. */
  8611. (function( window ) {
  8612. var i,
  8613. support,
  8614. Expr,
  8615. getText,
  8616. isXML,
  8617. tokenize,
  8618. compile,
  8619. select,
  8620. outermostContext,
  8621. sortInput,
  8622. hasDuplicate,
  8623. // Local document vars
  8624. setDocument,
  8625. document,
  8626. docElem,
  8627. documentIsHTML,
  8628. rbuggyQSA,
  8629. rbuggyMatches,
  8630. matches,
  8631. contains,
  8632. // Instance-specific data
  8633. expando = "sizzle" + 1 * new Date(),
  8634. preferredDoc = window.document,
  8635. dirruns = 0,
  8636. done = 0,
  8637. classCache = createCache(),
  8638. tokenCache = createCache(),
  8639. compilerCache = createCache(),
  8640. nonnativeSelectorCache = createCache(),
  8641. sortOrder = function( a, b ) {
  8642. if ( a === b ) {
  8643. hasDuplicate = true;
  8644. }
  8645. return 0;
  8646. },
  8647. // Instance methods
  8648. hasOwn = ({}).hasOwnProperty,
  8649. arr = [],
  8650. pop = arr.pop,
  8651. push_native = arr.push,
  8652. push = arr.push,
  8653. slice = arr.slice,
  8654. // Use a stripped-down indexOf as it's faster than native
  8655. // https://jsperf.com/thor-indexof-vs-for/5
  8656. indexOf = function( list, elem ) {
  8657. var i = 0,
  8658. len = list.length;
  8659. for ( ; i < len; i++ ) {
  8660. if ( list[i] === elem ) {
  8661. return i;
  8662. }
  8663. }
  8664. return -1;
  8665. },
  8666. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8667. // Regular expressions
  8668. // http://www.w3.org/TR/css3-selectors/#whitespace
  8669. whitespace = "[\\x20\\t\\r\\n\\f]",
  8670. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8671. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8672. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8673. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8674. // Operator (capture 2)
  8675. "*([*^$|!~]?=)" + whitespace +
  8676. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8677. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8678. "*\\]",
  8679. pseudos = ":(" + identifier + ")(?:\\((" +
  8680. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8681. // 1. quoted (capture 3; capture 4 or capture 5)
  8682. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8683. // 2. simple (capture 6)
  8684. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8685. // 3. anything else (capture 2)
  8686. ".*" +
  8687. ")\\)|)",
  8688. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8689. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8690. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8691. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8692. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8693. rdescend = new RegExp( whitespace + "|>" ),
  8694. rpseudo = new RegExp( pseudos ),
  8695. ridentifier = new RegExp( "^" + identifier + "$" ),
  8696. matchExpr = {
  8697. "ID": new RegExp( "^#(" + identifier + ")" ),
  8698. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8699. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8700. "ATTR": new RegExp( "^" + attributes ),
  8701. "PSEUDO": new RegExp( "^" + pseudos ),
  8702. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8703. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8704. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8705. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8706. // For use in libraries implementing .is()
  8707. // We use this for POS matching in `select`
  8708. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8709. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8710. },
  8711. rhtml = /HTML$/i,
  8712. rinputs = /^(?:input|select|textarea|button)$/i,
  8713. rheader = /^h\d$/i,
  8714. rnative = /^[^{]+\{\s*\[native \w/,
  8715. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8716. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8717. rsibling = /[+~]/,
  8718. // CSS escapes
  8719. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8720. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8721. funescape = function( _, escaped, escapedWhitespace ) {
  8722. var high = "0x" + escaped - 0x10000;
  8723. // NaN means non-codepoint
  8724. // Support: Firefox<24
  8725. // Workaround erroneous numeric interpretation of +"0x"
  8726. return high !== high || escapedWhitespace ?
  8727. escaped :
  8728. high < 0 ?
  8729. // BMP codepoint
  8730. String.fromCharCode( high + 0x10000 ) :
  8731. // Supplemental Plane codepoint (surrogate pair)
  8732. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8733. },
  8734. // CSS string/identifier serialization
  8735. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8736. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8737. fcssescape = function( ch, asCodePoint ) {
  8738. if ( asCodePoint ) {
  8739. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8740. if ( ch === "\0" ) {
  8741. return "\uFFFD";
  8742. }
  8743. // Control characters and (dependent upon position) numbers get escaped as code points
  8744. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8745. }
  8746. // Other potentially-special ASCII characters get backslash-escaped
  8747. return "\\" + ch;
  8748. },
  8749. // Used for iframes
  8750. // See setDocument()
  8751. // Removing the function wrapper causes a "Permission Denied"
  8752. // error in IE
  8753. unloadHandler = function() {
  8754. setDocument();
  8755. },
  8756. inDisabledFieldset = addCombinator(
  8757. function( elem ) {
  8758. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8759. },
  8760. { dir: "parentNode", next: "legend" }
  8761. );
  8762. // Optimize for push.apply( _, NodeList )
  8763. try {
  8764. push.apply(
  8765. (arr = slice.call( preferredDoc.childNodes )),
  8766. preferredDoc.childNodes
  8767. );
  8768. // Support: Android<4.0
  8769. // Detect silently failing push.apply
  8770. arr[ preferredDoc.childNodes.length ].nodeType;
  8771. } catch ( e ) {
  8772. push = { apply: arr.length ?
  8773. // Leverage slice if possible
  8774. function( target, els ) {
  8775. push_native.apply( target, slice.call(els) );
  8776. } :
  8777. // Support: IE<9
  8778. // Otherwise append directly
  8779. function( target, els ) {
  8780. var j = target.length,
  8781. i = 0;
  8782. // Can't trust NodeList.length
  8783. while ( (target[j++] = els[i++]) ) {}
  8784. target.length = j - 1;
  8785. }
  8786. };
  8787. }
  8788. function Sizzle( selector, context, results, seed ) {
  8789. var m, i, elem, nid, match, groups, newSelector,
  8790. newContext = context && context.ownerDocument,
  8791. // nodeType defaults to 9, since context defaults to document
  8792. nodeType = context ? context.nodeType : 9;
  8793. results = results || [];
  8794. // Return early from calls with invalid selector or context
  8795. if ( typeof selector !== "string" || !selector ||
  8796. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8797. return results;
  8798. }
  8799. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8800. if ( !seed ) {
  8801. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8802. setDocument( context );
  8803. }
  8804. context = context || document;
  8805. if ( documentIsHTML ) {
  8806. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8807. // (excepting DocumentFragment context, where the methods don't exist)
  8808. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8809. // ID selector
  8810. if ( (m = match[1]) ) {
  8811. // Document context
  8812. if ( nodeType === 9 ) {
  8813. if ( (elem = context.getElementById( m )) ) {
  8814. // Support: IE, Opera, Webkit
  8815. // TODO: identify versions
  8816. // getElementById can match elements by name instead of ID
  8817. if ( elem.id === m ) {
  8818. results.push( elem );
  8819. return results;
  8820. }
  8821. } else {
  8822. return results;
  8823. }
  8824. // Element context
  8825. } else {
  8826. // Support: IE, Opera, Webkit
  8827. // TODO: identify versions
  8828. // getElementById can match elements by name instead of ID
  8829. if ( newContext && (elem = newContext.getElementById( m )) &&
  8830. contains( context, elem ) &&
  8831. elem.id === m ) {
  8832. results.push( elem );
  8833. return results;
  8834. }
  8835. }
  8836. // Type selector
  8837. } else if ( match[2] ) {
  8838. push.apply( results, context.getElementsByTagName( selector ) );
  8839. return results;
  8840. // Class selector
  8841. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8842. context.getElementsByClassName ) {
  8843. push.apply( results, context.getElementsByClassName( m ) );
  8844. return results;
  8845. }
  8846. }
  8847. // Take advantage of querySelectorAll
  8848. if ( support.qsa &&
  8849. !nonnativeSelectorCache[ selector + " " ] &&
  8850. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8851. // Support: IE 8 only
  8852. // Exclude object elements
  8853. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8854. newSelector = selector;
  8855. newContext = context;
  8856. // qSA considers elements outside a scoping root when evaluating child or
  8857. // descendant combinators, which is not what we want.
  8858. // In such cases, we work around the behavior by prefixing every selector in the
  8859. // list with an ID selector referencing the scope context.
  8860. // Thanks to Andrew Dupont for this technique.
  8861. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8862. // Capture the context ID, setting it first if necessary
  8863. if ( (nid = context.getAttribute( "id" )) ) {
  8864. nid = nid.replace( rcssescape, fcssescape );
  8865. } else {
  8866. context.setAttribute( "id", (nid = expando) );
  8867. }
  8868. // Prefix every selector in the list
  8869. groups = tokenize( selector );
  8870. i = groups.length;
  8871. while ( i-- ) {
  8872. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8873. }
  8874. newSelector = groups.join( "," );
  8875. // Expand context for sibling selectors
  8876. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8877. context;
  8878. }
  8879. try {
  8880. push.apply( results,
  8881. newContext.querySelectorAll( newSelector )
  8882. );
  8883. return results;
  8884. } catch ( qsaError ) {
  8885. nonnativeSelectorCache( selector, true );
  8886. } finally {
  8887. if ( nid === expando ) {
  8888. context.removeAttribute( "id" );
  8889. }
  8890. }
  8891. }
  8892. }
  8893. }
  8894. // All others
  8895. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8896. }
  8897. /**
  8898. * Create key-value caches of limited size
  8899. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8900. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8901. * deleting the oldest entry
  8902. */
  8903. function createCache() {
  8904. var keys = [];
  8905. function cache( key, value ) {
  8906. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8907. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8908. // Only keep the most recent entries
  8909. delete cache[ keys.shift() ];
  8910. }
  8911. return (cache[ key + " " ] = value);
  8912. }
  8913. return cache;
  8914. }
  8915. /**
  8916. * Mark a function for special use by Sizzle
  8917. * @param {Function} fn The function to mark
  8918. */
  8919. function markFunction( fn ) {
  8920. fn[ expando ] = true;
  8921. return fn;
  8922. }
  8923. /**
  8924. * Support testing using an element
  8925. * @param {Function} fn Passed the created element and returns a boolean result
  8926. */
  8927. function assert( fn ) {
  8928. var el = document.createElement("fieldset");
  8929. try {
  8930. return !!fn( el );
  8931. } catch (e) {
  8932. return false;
  8933. } finally {
  8934. // Remove from its parent by default
  8935. if ( el.parentNode ) {
  8936. el.parentNode.removeChild( el );
  8937. }
  8938. // release memory in IE
  8939. el = null;
  8940. }
  8941. }
  8942. /**
  8943. * Adds the same handler for all of the specified attrs
  8944. * @param {String} attrs Pipe-separated list of attributes
  8945. * @param {Function} handler The method that will be applied
  8946. */
  8947. function addHandle( attrs, handler ) {
  8948. var arr = attrs.split("|"),
  8949. i = arr.length;
  8950. while ( i-- ) {
  8951. Expr.attrHandle[ arr[i] ] = handler;
  8952. }
  8953. }
  8954. /**
  8955. * Checks document order of two siblings
  8956. * @param {Element} a
  8957. * @param {Element} b
  8958. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  8959. */
  8960. function siblingCheck( a, b ) {
  8961. var cur = b && a,
  8962. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  8963. a.sourceIndex - b.sourceIndex;
  8964. // Use IE sourceIndex if available on both nodes
  8965. if ( diff ) {
  8966. return diff;
  8967. }
  8968. // Check if b follows a
  8969. if ( cur ) {
  8970. while ( (cur = cur.nextSibling) ) {
  8971. if ( cur === b ) {
  8972. return -1;
  8973. }
  8974. }
  8975. }
  8976. return a ? 1 : -1;
  8977. }
  8978. /**
  8979. * Returns a function to use in pseudos for input types
  8980. * @param {String} type
  8981. */
  8982. function createInputPseudo( type ) {
  8983. return function( elem ) {
  8984. var name = elem.nodeName.toLowerCase();
  8985. return name === "input" && elem.type === type;
  8986. };
  8987. }
  8988. /**
  8989. * Returns a function to use in pseudos for buttons
  8990. * @param {String} type
  8991. */
  8992. function createButtonPseudo( type ) {
  8993. return function( elem ) {
  8994. var name = elem.nodeName.toLowerCase();
  8995. return (name === "input" || name === "button") && elem.type === type;
  8996. };
  8997. }
  8998. /**
  8999. * Returns a function to use in pseudos for :enabled/:disabled
  9000. * @param {Boolean} disabled true for :disabled; false for :enabled
  9001. */
  9002. function createDisabledPseudo( disabled ) {
  9003. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9004. return function( elem ) {
  9005. // Only certain elements can match :enabled or :disabled
  9006. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9007. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9008. if ( "form" in elem ) {
  9009. // Check for inherited disabledness on relevant non-disabled elements:
  9010. // * listed form-associated elements in a disabled fieldset
  9011. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9012. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9013. // * option elements in a disabled optgroup
  9014. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9015. // All such elements have a "form" property.
  9016. if ( elem.parentNode && elem.disabled === false ) {
  9017. // Option elements defer to a parent optgroup if present
  9018. if ( "label" in elem ) {
  9019. if ( "label" in elem.parentNode ) {
  9020. return elem.parentNode.disabled === disabled;
  9021. } else {
  9022. return elem.disabled === disabled;
  9023. }
  9024. }
  9025. // Support: IE 6 - 11
  9026. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9027. return elem.isDisabled === disabled ||
  9028. // Where there is no isDisabled, check manually
  9029. /* jshint -W018 */
  9030. elem.isDisabled !== !disabled &&
  9031. inDisabledFieldset( elem ) === disabled;
  9032. }
  9033. return elem.disabled === disabled;
  9034. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9035. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9036. // even exist on them, let alone have a boolean value.
  9037. } else if ( "label" in elem ) {
  9038. return elem.disabled === disabled;
  9039. }
  9040. // Remaining elements are neither :enabled nor :disabled
  9041. return false;
  9042. };
  9043. }
  9044. /**
  9045. * Returns a function to use in pseudos for positionals
  9046. * @param {Function} fn
  9047. */
  9048. function createPositionalPseudo( fn ) {
  9049. return markFunction(function( argument ) {
  9050. argument = +argument;
  9051. return markFunction(function( seed, matches ) {
  9052. var j,
  9053. matchIndexes = fn( [], seed.length, argument ),
  9054. i = matchIndexes.length;
  9055. // Match elements found at the specified indexes
  9056. while ( i-- ) {
  9057. if ( seed[ (j = matchIndexes[i]) ] ) {
  9058. seed[j] = !(matches[j] = seed[j]);
  9059. }
  9060. }
  9061. });
  9062. });
  9063. }
  9064. /**
  9065. * Checks a node for validity as a Sizzle context
  9066. * @param {Element|Object=} context
  9067. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9068. */
  9069. function testContext( context ) {
  9070. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9071. }
  9072. // Expose support vars for convenience
  9073. support = Sizzle.support = {};
  9074. /**
  9075. * Detects XML nodes
  9076. * @param {Element|Object} elem An element or a document
  9077. * @returns {Boolean} True iff elem is a non-HTML XML node
  9078. */
  9079. isXML = Sizzle.isXML = function( elem ) {
  9080. var namespace = elem.namespaceURI,
  9081. docElem = (elem.ownerDocument || elem).documentElement;
  9082. // Support: IE <=8
  9083. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9084. // https://bugs.jquery.com/ticket/4833
  9085. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9086. };
  9087. /**
  9088. * Sets document-related variables once based on the current document
  9089. * @param {Element|Object} [doc] An element or document object to use to set the document
  9090. * @returns {Object} Returns the current document
  9091. */
  9092. setDocument = Sizzle.setDocument = function( node ) {
  9093. var hasCompare, subWindow,
  9094. doc = node ? node.ownerDocument || node : preferredDoc;
  9095. // Return early if doc is invalid or already selected
  9096. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9097. return document;
  9098. }
  9099. // Update global variables
  9100. document = doc;
  9101. docElem = document.documentElement;
  9102. documentIsHTML = !isXML( document );
  9103. // Support: IE 9-11, Edge
  9104. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9105. if ( preferredDoc !== document &&
  9106. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9107. // Support: IE 11, Edge
  9108. if ( subWindow.addEventListener ) {
  9109. subWindow.addEventListener( "unload", unloadHandler, false );
  9110. // Support: IE 9 - 10 only
  9111. } else if ( subWindow.attachEvent ) {
  9112. subWindow.attachEvent( "onunload", unloadHandler );
  9113. }
  9114. }
  9115. /* Attributes
  9116. ---------------------------------------------------------------------- */
  9117. // Support: IE<8
  9118. // Verify that getAttribute really returns attributes and not properties
  9119. // (excepting IE8 booleans)
  9120. support.attributes = assert(function( el ) {
  9121. el.className = "i";
  9122. return !el.getAttribute("className");
  9123. });
  9124. /* getElement(s)By*
  9125. ---------------------------------------------------------------------- */
  9126. // Check if getElementsByTagName("*") returns only elements
  9127. support.getElementsByTagName = assert(function( el ) {
  9128. el.appendChild( document.createComment("") );
  9129. return !el.getElementsByTagName("*").length;
  9130. });
  9131. // Support: IE<9
  9132. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9133. // Support: IE<10
  9134. // Check if getElementById returns elements by name
  9135. // The broken getElementById methods don't pick up programmatically-set names,
  9136. // so use a roundabout getElementsByName test
  9137. support.getById = assert(function( el ) {
  9138. docElem.appendChild( el ).id = expando;
  9139. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9140. });
  9141. // ID filter and find
  9142. if ( support.getById ) {
  9143. Expr.filter["ID"] = function( id ) {
  9144. var attrId = id.replace( runescape, funescape );
  9145. return function( elem ) {
  9146. return elem.getAttribute("id") === attrId;
  9147. };
  9148. };
  9149. Expr.find["ID"] = function( id, context ) {
  9150. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9151. var elem = context.getElementById( id );
  9152. return elem ? [ elem ] : [];
  9153. }
  9154. };
  9155. } else {
  9156. Expr.filter["ID"] = function( id ) {
  9157. var attrId = id.replace( runescape, funescape );
  9158. return function( elem ) {
  9159. var node = typeof elem.getAttributeNode !== "undefined" &&
  9160. elem.getAttributeNode("id");
  9161. return node && node.value === attrId;
  9162. };
  9163. };
  9164. // Support: IE 6 - 7 only
  9165. // getElementById is not reliable as a find shortcut
  9166. Expr.find["ID"] = function( id, context ) {
  9167. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9168. var node, i, elems,
  9169. elem = context.getElementById( id );
  9170. if ( elem ) {
  9171. // Verify the id attribute
  9172. node = elem.getAttributeNode("id");
  9173. if ( node && node.value === id ) {
  9174. return [ elem ];
  9175. }
  9176. // Fall back on getElementsByName
  9177. elems = context.getElementsByName( id );
  9178. i = 0;
  9179. while ( (elem = elems[i++]) ) {
  9180. node = elem.getAttributeNode("id");
  9181. if ( node && node.value === id ) {
  9182. return [ elem ];
  9183. }
  9184. }
  9185. }
  9186. return [];
  9187. }
  9188. };
  9189. }
  9190. // Tag
  9191. Expr.find["TAG"] = support.getElementsByTagName ?
  9192. function( tag, context ) {
  9193. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9194. return context.getElementsByTagName( tag );
  9195. // DocumentFragment nodes don't have gEBTN
  9196. } else if ( support.qsa ) {
  9197. return context.querySelectorAll( tag );
  9198. }
  9199. } :
  9200. function( tag, context ) {
  9201. var elem,
  9202. tmp = [],
  9203. i = 0,
  9204. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9205. results = context.getElementsByTagName( tag );
  9206. // Filter out possible comments
  9207. if ( tag === "*" ) {
  9208. while ( (elem = results[i++]) ) {
  9209. if ( elem.nodeType === 1 ) {
  9210. tmp.push( elem );
  9211. }
  9212. }
  9213. return tmp;
  9214. }
  9215. return results;
  9216. };
  9217. // Class
  9218. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9219. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9220. return context.getElementsByClassName( className );
  9221. }
  9222. };
  9223. /* QSA/matchesSelector
  9224. ---------------------------------------------------------------------- */
  9225. // QSA and matchesSelector support
  9226. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9227. rbuggyMatches = [];
  9228. // qSa(:focus) reports false when true (Chrome 21)
  9229. // We allow this because of a bug in IE8/9 that throws an error
  9230. // whenever `document.activeElement` is accessed on an iframe
  9231. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9232. // See https://bugs.jquery.com/ticket/13378
  9233. rbuggyQSA = [];
  9234. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9235. // Build QSA regex
  9236. // Regex strategy adopted from Diego Perini
  9237. assert(function( el ) {
  9238. // Select is set to empty string on purpose
  9239. // This is to test IE's treatment of not explicitly
  9240. // setting a boolean content attribute,
  9241. // since its presence should be enough
  9242. // https://bugs.jquery.com/ticket/12359
  9243. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9244. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9245. "<option selected=''></option></select>";
  9246. // Support: IE8, Opera 11-12.16
  9247. // Nothing should be selected when empty strings follow ^= or $= or *=
  9248. // The test attribute must be unknown in Opera but "safe" for WinRT
  9249. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9250. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9251. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9252. }
  9253. // Support: IE8
  9254. // Boolean attributes and "value" are not treated correctly
  9255. if ( !el.querySelectorAll("[selected]").length ) {
  9256. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9257. }
  9258. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9259. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9260. rbuggyQSA.push("~=");
  9261. }
  9262. // Webkit/Opera - :checked should return selected option elements
  9263. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9264. // IE8 throws error here and will not see later tests
  9265. if ( !el.querySelectorAll(":checked").length ) {
  9266. rbuggyQSA.push(":checked");
  9267. }
  9268. // Support: Safari 8+, iOS 8+
  9269. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9270. // In-page `selector#id sibling-combinator selector` fails
  9271. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9272. rbuggyQSA.push(".#.+[+~]");
  9273. }
  9274. });
  9275. assert(function( el ) {
  9276. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9277. "<select disabled='disabled'><option/></select>";
  9278. // Support: Windows 8 Native Apps
  9279. // The type and name attributes are restricted during .innerHTML assignment
  9280. var input = document.createElement("input");
  9281. input.setAttribute( "type", "hidden" );
  9282. el.appendChild( input ).setAttribute( "name", "D" );
  9283. // Support: IE8
  9284. // Enforce case-sensitivity of name attribute
  9285. if ( el.querySelectorAll("[name=d]").length ) {
  9286. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9287. }
  9288. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9289. // IE8 throws error here and will not see later tests
  9290. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9291. rbuggyQSA.push( ":enabled", ":disabled" );
  9292. }
  9293. // Support: IE9-11+
  9294. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9295. docElem.appendChild( el ).disabled = true;
  9296. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9297. rbuggyQSA.push( ":enabled", ":disabled" );
  9298. }
  9299. // Opera 10-11 does not throw on post-comma invalid pseudos
  9300. el.querySelectorAll("*,:x");
  9301. rbuggyQSA.push(",.*:");
  9302. });
  9303. }
  9304. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9305. docElem.webkitMatchesSelector ||
  9306. docElem.mozMatchesSelector ||
  9307. docElem.oMatchesSelector ||
  9308. docElem.msMatchesSelector) )) ) {
  9309. assert(function( el ) {
  9310. // Check to see if it's possible to do matchesSelector
  9311. // on a disconnected node (IE 9)
  9312. support.disconnectedMatch = matches.call( el, "*" );
  9313. // This should fail with an exception
  9314. // Gecko does not error, returns false instead
  9315. matches.call( el, "[s!='']:x" );
  9316. rbuggyMatches.push( "!=", pseudos );
  9317. });
  9318. }
  9319. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9320. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9321. /* Contains
  9322. ---------------------------------------------------------------------- */
  9323. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9324. // Element contains another
  9325. // Purposefully self-exclusive
  9326. // As in, an element does not contain itself
  9327. contains = hasCompare || rnative.test( docElem.contains ) ?
  9328. function( a, b ) {
  9329. var adown = a.nodeType === 9 ? a.documentElement : a,
  9330. bup = b && b.parentNode;
  9331. return a === bup || !!( bup && bup.nodeType === 1 && (
  9332. adown.contains ?
  9333. adown.contains( bup ) :
  9334. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9335. ));
  9336. } :
  9337. function( a, b ) {
  9338. if ( b ) {
  9339. while ( (b = b.parentNode) ) {
  9340. if ( b === a ) {
  9341. return true;
  9342. }
  9343. }
  9344. }
  9345. return false;
  9346. };
  9347. /* Sorting
  9348. ---------------------------------------------------------------------- */
  9349. // Document order sorting
  9350. sortOrder = hasCompare ?
  9351. function( a, b ) {
  9352. // Flag for duplicate removal
  9353. if ( a === b ) {
  9354. hasDuplicate = true;
  9355. return 0;
  9356. }
  9357. // Sort on method existence if only one input has compareDocumentPosition
  9358. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9359. if ( compare ) {
  9360. return compare;
  9361. }
  9362. // Calculate position if both inputs belong to the same document
  9363. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9364. a.compareDocumentPosition( b ) :
  9365. // Otherwise we know they are disconnected
  9366. 1;
  9367. // Disconnected nodes
  9368. if ( compare & 1 ||
  9369. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9370. // Choose the first element that is related to our preferred document
  9371. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9372. return -1;
  9373. }
  9374. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9375. return 1;
  9376. }
  9377. // Maintain original order
  9378. return sortInput ?
  9379. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9380. 0;
  9381. }
  9382. return compare & 4 ? -1 : 1;
  9383. } :
  9384. function( a, b ) {
  9385. // Exit early if the nodes are identical
  9386. if ( a === b ) {
  9387. hasDuplicate = true;
  9388. return 0;
  9389. }
  9390. var cur,
  9391. i = 0,
  9392. aup = a.parentNode,
  9393. bup = b.parentNode,
  9394. ap = [ a ],
  9395. bp = [ b ];
  9396. // Parentless nodes are either documents or disconnected
  9397. if ( !aup || !bup ) {
  9398. return a === document ? -1 :
  9399. b === document ? 1 :
  9400. aup ? -1 :
  9401. bup ? 1 :
  9402. sortInput ?
  9403. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9404. 0;
  9405. // If the nodes are siblings, we can do a quick check
  9406. } else if ( aup === bup ) {
  9407. return siblingCheck( a, b );
  9408. }
  9409. // Otherwise we need full lists of their ancestors for comparison
  9410. cur = a;
  9411. while ( (cur = cur.parentNode) ) {
  9412. ap.unshift( cur );
  9413. }
  9414. cur = b;
  9415. while ( (cur = cur.parentNode) ) {
  9416. bp.unshift( cur );
  9417. }
  9418. // Walk down the tree looking for a discrepancy
  9419. while ( ap[i] === bp[i] ) {
  9420. i++;
  9421. }
  9422. return i ?
  9423. // Do a sibling check if the nodes have a common ancestor
  9424. siblingCheck( ap[i], bp[i] ) :
  9425. // Otherwise nodes in our document sort first
  9426. ap[i] === preferredDoc ? -1 :
  9427. bp[i] === preferredDoc ? 1 :
  9428. 0;
  9429. };
  9430. return document;
  9431. };
  9432. Sizzle.matches = function( expr, elements ) {
  9433. return Sizzle( expr, null, null, elements );
  9434. };
  9435. Sizzle.matchesSelector = function( elem, expr ) {
  9436. // Set document vars if needed
  9437. if ( ( elem.ownerDocument || elem ) !== document ) {
  9438. setDocument( elem );
  9439. }
  9440. if ( support.matchesSelector && documentIsHTML &&
  9441. !nonnativeSelectorCache[ expr + " " ] &&
  9442. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9443. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9444. try {
  9445. var ret = matches.call( elem, expr );
  9446. // IE 9's matchesSelector returns false on disconnected nodes
  9447. if ( ret || support.disconnectedMatch ||
  9448. // As well, disconnected nodes are said to be in a document
  9449. // fragment in IE 9
  9450. elem.document && elem.document.nodeType !== 11 ) {
  9451. return ret;
  9452. }
  9453. } catch (e) {
  9454. nonnativeSelectorCache( expr, true );
  9455. }
  9456. }
  9457. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9458. };
  9459. Sizzle.contains = function( context, elem ) {
  9460. // Set document vars if needed
  9461. if ( ( context.ownerDocument || context ) !== document ) {
  9462. setDocument( context );
  9463. }
  9464. return contains( context, elem );
  9465. };
  9466. Sizzle.attr = function( elem, name ) {
  9467. // Set document vars if needed
  9468. if ( ( elem.ownerDocument || elem ) !== document ) {
  9469. setDocument( elem );
  9470. }
  9471. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9472. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9473. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9474. fn( elem, name, !documentIsHTML ) :
  9475. undefined;
  9476. return val !== undefined ?
  9477. val :
  9478. support.attributes || !documentIsHTML ?
  9479. elem.getAttribute( name ) :
  9480. (val = elem.getAttributeNode(name)) && val.specified ?
  9481. val.value :
  9482. null;
  9483. };
  9484. Sizzle.escape = function( sel ) {
  9485. return (sel + "").replace( rcssescape, fcssescape );
  9486. };
  9487. Sizzle.error = function( msg ) {
  9488. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9489. };
  9490. /**
  9491. * Document sorting and removing duplicates
  9492. * @param {ArrayLike} results
  9493. */
  9494. Sizzle.uniqueSort = function( results ) {
  9495. var elem,
  9496. duplicates = [],
  9497. j = 0,
  9498. i = 0;
  9499. // Unless we *know* we can detect duplicates, assume their presence
  9500. hasDuplicate = !support.detectDuplicates;
  9501. sortInput = !support.sortStable && results.slice( 0 );
  9502. results.sort( sortOrder );
  9503. if ( hasDuplicate ) {
  9504. while ( (elem = results[i++]) ) {
  9505. if ( elem === results[ i ] ) {
  9506. j = duplicates.push( i );
  9507. }
  9508. }
  9509. while ( j-- ) {
  9510. results.splice( duplicates[ j ], 1 );
  9511. }
  9512. }
  9513. // Clear input after sorting to release objects
  9514. // See https://github.com/jquery/sizzle/pull/225
  9515. sortInput = null;
  9516. return results;
  9517. };
  9518. /**
  9519. * Utility function for retrieving the text value of an array of DOM nodes
  9520. * @param {Array|Element} elem
  9521. */
  9522. getText = Sizzle.getText = function( elem ) {
  9523. var node,
  9524. ret = "",
  9525. i = 0,
  9526. nodeType = elem.nodeType;
  9527. if ( !nodeType ) {
  9528. // If no nodeType, this is expected to be an array
  9529. while ( (node = elem[i++]) ) {
  9530. // Do not traverse comment nodes
  9531. ret += getText( node );
  9532. }
  9533. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9534. // Use textContent for elements
  9535. // innerText usage removed for consistency of new lines (jQuery #11153)
  9536. if ( typeof elem.textContent === "string" ) {
  9537. return elem.textContent;
  9538. } else {
  9539. // Traverse its children
  9540. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9541. ret += getText( elem );
  9542. }
  9543. }
  9544. } else if ( nodeType === 3 || nodeType === 4 ) {
  9545. return elem.nodeValue;
  9546. }
  9547. // Do not include comment or processing instruction nodes
  9548. return ret;
  9549. };
  9550. Expr = Sizzle.selectors = {
  9551. // Can be adjusted by the user
  9552. cacheLength: 50,
  9553. createPseudo: markFunction,
  9554. match: matchExpr,
  9555. attrHandle: {},
  9556. find: {},
  9557. relative: {
  9558. ">": { dir: "parentNode", first: true },
  9559. " ": { dir: "parentNode" },
  9560. "+": { dir: "previousSibling", first: true },
  9561. "~": { dir: "previousSibling" }
  9562. },
  9563. preFilter: {
  9564. "ATTR": function( match ) {
  9565. match[1] = match[1].replace( runescape, funescape );
  9566. // Move the given value to match[3] whether quoted or unquoted
  9567. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9568. if ( match[2] === "~=" ) {
  9569. match[3] = " " + match[3] + " ";
  9570. }
  9571. return match.slice( 0, 4 );
  9572. },
  9573. "CHILD": function( match ) {
  9574. /* matches from matchExpr["CHILD"]
  9575. 1 type (only|nth|...)
  9576. 2 what (child|of-type)
  9577. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9578. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9579. 5 sign of xn-component
  9580. 6 x of xn-component
  9581. 7 sign of y-component
  9582. 8 y of y-component
  9583. */
  9584. match[1] = match[1].toLowerCase();
  9585. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9586. // nth-* requires argument
  9587. if ( !match[3] ) {
  9588. Sizzle.error( match[0] );
  9589. }
  9590. // numeric x and y parameters for Expr.filter.CHILD
  9591. // remember that false/true cast respectively to 0/1
  9592. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9593. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9594. // other types prohibit arguments
  9595. } else if ( match[3] ) {
  9596. Sizzle.error( match[0] );
  9597. }
  9598. return match;
  9599. },
  9600. "PSEUDO": function( match ) {
  9601. var excess,
  9602. unquoted = !match[6] && match[2];
  9603. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9604. return null;
  9605. }
  9606. // Accept quoted arguments as-is
  9607. if ( match[3] ) {
  9608. match[2] = match[4] || match[5] || "";
  9609. // Strip excess characters from unquoted arguments
  9610. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9611. // Get excess from tokenize (recursively)
  9612. (excess = tokenize( unquoted, true )) &&
  9613. // advance to the next closing parenthesis
  9614. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9615. // excess is a negative index
  9616. match[0] = match[0].slice( 0, excess );
  9617. match[2] = unquoted.slice( 0, excess );
  9618. }
  9619. // Return only captures needed by the pseudo filter method (type and argument)
  9620. return match.slice( 0, 3 );
  9621. }
  9622. },
  9623. filter: {
  9624. "TAG": function( nodeNameSelector ) {
  9625. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9626. return nodeNameSelector === "*" ?
  9627. function() { return true; } :
  9628. function( elem ) {
  9629. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9630. };
  9631. },
  9632. "CLASS": function( className ) {
  9633. var pattern = classCache[ className + " " ];
  9634. return pattern ||
  9635. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9636. classCache( className, function( elem ) {
  9637. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9638. });
  9639. },
  9640. "ATTR": function( name, operator, check ) {
  9641. return function( elem ) {
  9642. var result = Sizzle.attr( elem, name );
  9643. if ( result == null ) {
  9644. return operator === "!=";
  9645. }
  9646. if ( !operator ) {
  9647. return true;
  9648. }
  9649. result += "";
  9650. return operator === "=" ? result === check :
  9651. operator === "!=" ? result !== check :
  9652. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9653. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9654. operator === "$=" ? check && result.slice( -check.length ) === check :
  9655. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9656. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9657. false;
  9658. };
  9659. },
  9660. "CHILD": function( type, what, argument, first, last ) {
  9661. var simple = type.slice( 0, 3 ) !== "nth",
  9662. forward = type.slice( -4 ) !== "last",
  9663. ofType = what === "of-type";
  9664. return first === 1 && last === 0 ?
  9665. // Shortcut for :nth-*(n)
  9666. function( elem ) {
  9667. return !!elem.parentNode;
  9668. } :
  9669. function( elem, context, xml ) {
  9670. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9671. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9672. parent = elem.parentNode,
  9673. name = ofType && elem.nodeName.toLowerCase(),
  9674. useCache = !xml && !ofType,
  9675. diff = false;
  9676. if ( parent ) {
  9677. // :(first|last|only)-(child|of-type)
  9678. if ( simple ) {
  9679. while ( dir ) {
  9680. node = elem;
  9681. while ( (node = node[ dir ]) ) {
  9682. if ( ofType ?
  9683. node.nodeName.toLowerCase() === name :
  9684. node.nodeType === 1 ) {
  9685. return false;
  9686. }
  9687. }
  9688. // Reverse direction for :only-* (if we haven't yet done so)
  9689. start = dir = type === "only" && !start && "nextSibling";
  9690. }
  9691. return true;
  9692. }
  9693. start = [ forward ? parent.firstChild : parent.lastChild ];
  9694. // non-xml :nth-child(...) stores cache data on `parent`
  9695. if ( forward && useCache ) {
  9696. // Seek `elem` from a previously-cached index
  9697. // ...in a gzip-friendly way
  9698. node = parent;
  9699. outerCache = node[ expando ] || (node[ expando ] = {});
  9700. // Support: IE <9 only
  9701. // Defend against cloned attroperties (jQuery gh-1709)
  9702. uniqueCache = outerCache[ node.uniqueID ] ||
  9703. (outerCache[ node.uniqueID ] = {});
  9704. cache = uniqueCache[ type ] || [];
  9705. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9706. diff = nodeIndex && cache[ 2 ];
  9707. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9708. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9709. // Fallback to seeking `elem` from the start
  9710. (diff = nodeIndex = 0) || start.pop()) ) {
  9711. // When found, cache indexes on `parent` and break
  9712. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9713. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9714. break;
  9715. }
  9716. }
  9717. } else {
  9718. // Use previously-cached element index if available
  9719. if ( useCache ) {
  9720. // ...in a gzip-friendly way
  9721. node = elem;
  9722. outerCache = node[ expando ] || (node[ expando ] = {});
  9723. // Support: IE <9 only
  9724. // Defend against cloned attroperties (jQuery gh-1709)
  9725. uniqueCache = outerCache[ node.uniqueID ] ||
  9726. (outerCache[ node.uniqueID ] = {});
  9727. cache = uniqueCache[ type ] || [];
  9728. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9729. diff = nodeIndex;
  9730. }
  9731. // xml :nth-child(...)
  9732. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9733. if ( diff === false ) {
  9734. // Use the same loop as above to seek `elem` from the start
  9735. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9736. (diff = nodeIndex = 0) || start.pop()) ) {
  9737. if ( ( ofType ?
  9738. node.nodeName.toLowerCase() === name :
  9739. node.nodeType === 1 ) &&
  9740. ++diff ) {
  9741. // Cache the index of each encountered element
  9742. if ( useCache ) {
  9743. outerCache = node[ expando ] || (node[ expando ] = {});
  9744. // Support: IE <9 only
  9745. // Defend against cloned attroperties (jQuery gh-1709)
  9746. uniqueCache = outerCache[ node.uniqueID ] ||
  9747. (outerCache[ node.uniqueID ] = {});
  9748. uniqueCache[ type ] = [ dirruns, diff ];
  9749. }
  9750. if ( node === elem ) {
  9751. break;
  9752. }
  9753. }
  9754. }
  9755. }
  9756. }
  9757. // Incorporate the offset, then check against cycle size
  9758. diff -= last;
  9759. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9760. }
  9761. };
  9762. },
  9763. "PSEUDO": function( pseudo, argument ) {
  9764. // pseudo-class names are case-insensitive
  9765. // http://www.w3.org/TR/selectors/#pseudo-classes
  9766. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9767. // Remember that setFilters inherits from pseudos
  9768. var args,
  9769. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9770. Sizzle.error( "unsupported pseudo: " + pseudo );
  9771. // The user may use createPseudo to indicate that
  9772. // arguments are needed to create the filter function
  9773. // just as Sizzle does
  9774. if ( fn[ expando ] ) {
  9775. return fn( argument );
  9776. }
  9777. // But maintain support for old signatures
  9778. if ( fn.length > 1 ) {
  9779. args = [ pseudo, pseudo, "", argument ];
  9780. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9781. markFunction(function( seed, matches ) {
  9782. var idx,
  9783. matched = fn( seed, argument ),
  9784. i = matched.length;
  9785. while ( i-- ) {
  9786. idx = indexOf( seed, matched[i] );
  9787. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9788. }
  9789. }) :
  9790. function( elem ) {
  9791. return fn( elem, 0, args );
  9792. };
  9793. }
  9794. return fn;
  9795. }
  9796. },
  9797. pseudos: {
  9798. // Potentially complex pseudos
  9799. "not": markFunction(function( selector ) {
  9800. // Trim the selector passed to compile
  9801. // to avoid treating leading and trailing
  9802. // spaces as combinators
  9803. var input = [],
  9804. results = [],
  9805. matcher = compile( selector.replace( rtrim, "$1" ) );
  9806. return matcher[ expando ] ?
  9807. markFunction(function( seed, matches, context, xml ) {
  9808. var elem,
  9809. unmatched = matcher( seed, null, xml, [] ),
  9810. i = seed.length;
  9811. // Match elements unmatched by `matcher`
  9812. while ( i-- ) {
  9813. if ( (elem = unmatched[i]) ) {
  9814. seed[i] = !(matches[i] = elem);
  9815. }
  9816. }
  9817. }) :
  9818. function( elem, context, xml ) {
  9819. input[0] = elem;
  9820. matcher( input, null, xml, results );
  9821. // Don't keep the element (issue #299)
  9822. input[0] = null;
  9823. return !results.pop();
  9824. };
  9825. }),
  9826. "has": markFunction(function( selector ) {
  9827. return function( elem ) {
  9828. return Sizzle( selector, elem ).length > 0;
  9829. };
  9830. }),
  9831. "contains": markFunction(function( text ) {
  9832. text = text.replace( runescape, funescape );
  9833. return function( elem ) {
  9834. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9835. };
  9836. }),
  9837. // "Whether an element is represented by a :lang() selector
  9838. // is based solely on the element's language value
  9839. // being equal to the identifier C,
  9840. // or beginning with the identifier C immediately followed by "-".
  9841. // The matching of C against the element's language value is performed case-insensitively.
  9842. // The identifier C does not have to be a valid language name."
  9843. // http://www.w3.org/TR/selectors/#lang-pseudo
  9844. "lang": markFunction( function( lang ) {
  9845. // lang value must be a valid identifier
  9846. if ( !ridentifier.test(lang || "") ) {
  9847. Sizzle.error( "unsupported lang: " + lang );
  9848. }
  9849. lang = lang.replace( runescape, funescape ).toLowerCase();
  9850. return function( elem ) {
  9851. var elemLang;
  9852. do {
  9853. if ( (elemLang = documentIsHTML ?
  9854. elem.lang :
  9855. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9856. elemLang = elemLang.toLowerCase();
  9857. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9858. }
  9859. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9860. return false;
  9861. };
  9862. }),
  9863. // Miscellaneous
  9864. "target": function( elem ) {
  9865. var hash = window.location && window.location.hash;
  9866. return hash && hash.slice( 1 ) === elem.id;
  9867. },
  9868. "root": function( elem ) {
  9869. return elem === docElem;
  9870. },
  9871. "focus": function( elem ) {
  9872. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9873. },
  9874. // Boolean properties
  9875. "enabled": createDisabledPseudo( false ),
  9876. "disabled": createDisabledPseudo( true ),
  9877. "checked": function( elem ) {
  9878. // In CSS3, :checked should return both checked and selected elements
  9879. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9880. var nodeName = elem.nodeName.toLowerCase();
  9881. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9882. },
  9883. "selected": function( elem ) {
  9884. // Accessing this property makes selected-by-default
  9885. // options in Safari work properly
  9886. if ( elem.parentNode ) {
  9887. elem.parentNode.selectedIndex;
  9888. }
  9889. return elem.selected === true;
  9890. },
  9891. // Contents
  9892. "empty": function( elem ) {
  9893. // http://www.w3.org/TR/selectors/#empty-pseudo
  9894. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9895. // but not by others (comment: 8; processing instruction: 7; etc.)
  9896. // nodeType < 6 works because attributes (2) do not appear as children
  9897. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9898. if ( elem.nodeType < 6 ) {
  9899. return false;
  9900. }
  9901. }
  9902. return true;
  9903. },
  9904. "parent": function( elem ) {
  9905. return !Expr.pseudos["empty"]( elem );
  9906. },
  9907. // Element/input types
  9908. "header": function( elem ) {
  9909. return rheader.test( elem.nodeName );
  9910. },
  9911. "input": function( elem ) {
  9912. return rinputs.test( elem.nodeName );
  9913. },
  9914. "button": function( elem ) {
  9915. var name = elem.nodeName.toLowerCase();
  9916. return name === "input" && elem.type === "button" || name === "button";
  9917. },
  9918. "text": function( elem ) {
  9919. var attr;
  9920. return elem.nodeName.toLowerCase() === "input" &&
  9921. elem.type === "text" &&
  9922. // Support: IE<8
  9923. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9924. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9925. },
  9926. // Position-in-collection
  9927. "first": createPositionalPseudo(function() {
  9928. return [ 0 ];
  9929. }),
  9930. "last": createPositionalPseudo(function( matchIndexes, length ) {
  9931. return [ length - 1 ];
  9932. }),
  9933. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9934. return [ argument < 0 ? argument + length : argument ];
  9935. }),
  9936. "even": createPositionalPseudo(function( matchIndexes, length ) {
  9937. var i = 0;
  9938. for ( ; i < length; i += 2 ) {
  9939. matchIndexes.push( i );
  9940. }
  9941. return matchIndexes;
  9942. }),
  9943. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  9944. var i = 1;
  9945. for ( ; i < length; i += 2 ) {
  9946. matchIndexes.push( i );
  9947. }
  9948. return matchIndexes;
  9949. }),
  9950. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9951. var i = argument < 0 ?
  9952. argument + length :
  9953. argument > length ?
  9954. length :
  9955. argument;
  9956. for ( ; --i >= 0; ) {
  9957. matchIndexes.push( i );
  9958. }
  9959. return matchIndexes;
  9960. }),
  9961. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9962. var i = argument < 0 ? argument + length : argument;
  9963. for ( ; ++i < length; ) {
  9964. matchIndexes.push( i );
  9965. }
  9966. return matchIndexes;
  9967. })
  9968. }
  9969. };
  9970. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  9971. // Add button/input type pseudos
  9972. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  9973. Expr.pseudos[ i ] = createInputPseudo( i );
  9974. }
  9975. for ( i in { submit: true, reset: true } ) {
  9976. Expr.pseudos[ i ] = createButtonPseudo( i );
  9977. }
  9978. // Easy API for creating new setFilters
  9979. function setFilters() {}
  9980. setFilters.prototype = Expr.filters = Expr.pseudos;
  9981. Expr.setFilters = new setFilters();
  9982. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  9983. var matched, match, tokens, type,
  9984. soFar, groups, preFilters,
  9985. cached = tokenCache[ selector + " " ];
  9986. if ( cached ) {
  9987. return parseOnly ? 0 : cached.slice( 0 );
  9988. }
  9989. soFar = selector;
  9990. groups = [];
  9991. preFilters = Expr.preFilter;
  9992. while ( soFar ) {
  9993. // Comma and first run
  9994. if ( !matched || (match = rcomma.exec( soFar )) ) {
  9995. if ( match ) {
  9996. // Don't consume trailing commas as valid
  9997. soFar = soFar.slice( match[0].length ) || soFar;
  9998. }
  9999. groups.push( (tokens = []) );
  10000. }
  10001. matched = false;
  10002. // Combinators
  10003. if ( (match = rcombinators.exec( soFar )) ) {
  10004. matched = match.shift();
  10005. tokens.push({
  10006. value: matched,
  10007. // Cast descendant combinators to space
  10008. type: match[0].replace( rtrim, " " )
  10009. });
  10010. soFar = soFar.slice( matched.length );
  10011. }
  10012. // Filters
  10013. for ( type in Expr.filter ) {
  10014. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10015. (match = preFilters[ type ]( match ))) ) {
  10016. matched = match.shift();
  10017. tokens.push({
  10018. value: matched,
  10019. type: type,
  10020. matches: match
  10021. });
  10022. soFar = soFar.slice( matched.length );
  10023. }
  10024. }
  10025. if ( !matched ) {
  10026. break;
  10027. }
  10028. }
  10029. // Return the length of the invalid excess
  10030. // if we're just parsing
  10031. // Otherwise, throw an error or return tokens
  10032. return parseOnly ?
  10033. soFar.length :
  10034. soFar ?
  10035. Sizzle.error( selector ) :
  10036. // Cache the tokens
  10037. tokenCache( selector, groups ).slice( 0 );
  10038. };
  10039. function toSelector( tokens ) {
  10040. var i = 0,
  10041. len = tokens.length,
  10042. selector = "";
  10043. for ( ; i < len; i++ ) {
  10044. selector += tokens[i].value;
  10045. }
  10046. return selector;
  10047. }
  10048. function addCombinator( matcher, combinator, base ) {
  10049. var dir = combinator.dir,
  10050. skip = combinator.next,
  10051. key = skip || dir,
  10052. checkNonElements = base && key === "parentNode",
  10053. doneName = done++;
  10054. return combinator.first ?
  10055. // Check against closest ancestor/preceding element
  10056. function( elem, context, xml ) {
  10057. while ( (elem = elem[ dir ]) ) {
  10058. if ( elem.nodeType === 1 || checkNonElements ) {
  10059. return matcher( elem, context, xml );
  10060. }
  10061. }
  10062. return false;
  10063. } :
  10064. // Check against all ancestor/preceding elements
  10065. function( elem, context, xml ) {
  10066. var oldCache, uniqueCache, outerCache,
  10067. newCache = [ dirruns, doneName ];
  10068. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10069. if ( xml ) {
  10070. while ( (elem = elem[ dir ]) ) {
  10071. if ( elem.nodeType === 1 || checkNonElements ) {
  10072. if ( matcher( elem, context, xml ) ) {
  10073. return true;
  10074. }
  10075. }
  10076. }
  10077. } else {
  10078. while ( (elem = elem[ dir ]) ) {
  10079. if ( elem.nodeType === 1 || checkNonElements ) {
  10080. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10081. // Support: IE <9 only
  10082. // Defend against cloned attroperties (jQuery gh-1709)
  10083. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10084. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10085. elem = elem[ dir ] || elem;
  10086. } else if ( (oldCache = uniqueCache[ key ]) &&
  10087. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10088. // Assign to newCache so results back-propagate to previous elements
  10089. return (newCache[ 2 ] = oldCache[ 2 ]);
  10090. } else {
  10091. // Reuse newcache so results back-propagate to previous elements
  10092. uniqueCache[ key ] = newCache;
  10093. // A match means we're done; a fail means we have to keep checking
  10094. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10095. return true;
  10096. }
  10097. }
  10098. }
  10099. }
  10100. }
  10101. return false;
  10102. };
  10103. }
  10104. function elementMatcher( matchers ) {
  10105. return matchers.length > 1 ?
  10106. function( elem, context, xml ) {
  10107. var i = matchers.length;
  10108. while ( i-- ) {
  10109. if ( !matchers[i]( elem, context, xml ) ) {
  10110. return false;
  10111. }
  10112. }
  10113. return true;
  10114. } :
  10115. matchers[0];
  10116. }
  10117. function multipleContexts( selector, contexts, results ) {
  10118. var i = 0,
  10119. len = contexts.length;
  10120. for ( ; i < len; i++ ) {
  10121. Sizzle( selector, contexts[i], results );
  10122. }
  10123. return results;
  10124. }
  10125. function condense( unmatched, map, filter, context, xml ) {
  10126. var elem,
  10127. newUnmatched = [],
  10128. i = 0,
  10129. len = unmatched.length,
  10130. mapped = map != null;
  10131. for ( ; i < len; i++ ) {
  10132. if ( (elem = unmatched[i]) ) {
  10133. if ( !filter || filter( elem, context, xml ) ) {
  10134. newUnmatched.push( elem );
  10135. if ( mapped ) {
  10136. map.push( i );
  10137. }
  10138. }
  10139. }
  10140. }
  10141. return newUnmatched;
  10142. }
  10143. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10144. if ( postFilter && !postFilter[ expando ] ) {
  10145. postFilter = setMatcher( postFilter );
  10146. }
  10147. if ( postFinder && !postFinder[ expando ] ) {
  10148. postFinder = setMatcher( postFinder, postSelector );
  10149. }
  10150. return markFunction(function( seed, results, context, xml ) {
  10151. var temp, i, elem,
  10152. preMap = [],
  10153. postMap = [],
  10154. preexisting = results.length,
  10155. // Get initial elements from seed or context
  10156. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10157. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10158. matcherIn = preFilter && ( seed || !selector ) ?
  10159. condense( elems, preMap, preFilter, context, xml ) :
  10160. elems,
  10161. matcherOut = matcher ?
  10162. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10163. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10164. // ...intermediate processing is necessary
  10165. [] :
  10166. // ...otherwise use results directly
  10167. results :
  10168. matcherIn;
  10169. // Find primary matches
  10170. if ( matcher ) {
  10171. matcher( matcherIn, matcherOut, context, xml );
  10172. }
  10173. // Apply postFilter
  10174. if ( postFilter ) {
  10175. temp = condense( matcherOut, postMap );
  10176. postFilter( temp, [], context, xml );
  10177. // Un-match failing elements by moving them back to matcherIn
  10178. i = temp.length;
  10179. while ( i-- ) {
  10180. if ( (elem = temp[i]) ) {
  10181. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10182. }
  10183. }
  10184. }
  10185. if ( seed ) {
  10186. if ( postFinder || preFilter ) {
  10187. if ( postFinder ) {
  10188. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10189. temp = [];
  10190. i = matcherOut.length;
  10191. while ( i-- ) {
  10192. if ( (elem = matcherOut[i]) ) {
  10193. // Restore matcherIn since elem is not yet a final match
  10194. temp.push( (matcherIn[i] = elem) );
  10195. }
  10196. }
  10197. postFinder( null, (matcherOut = []), temp, xml );
  10198. }
  10199. // Move matched elements from seed to results to keep them synchronized
  10200. i = matcherOut.length;
  10201. while ( i-- ) {
  10202. if ( (elem = matcherOut[i]) &&
  10203. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10204. seed[temp] = !(results[temp] = elem);
  10205. }
  10206. }
  10207. }
  10208. // Add elements to results, through postFinder if defined
  10209. } else {
  10210. matcherOut = condense(
  10211. matcherOut === results ?
  10212. matcherOut.splice( preexisting, matcherOut.length ) :
  10213. matcherOut
  10214. );
  10215. if ( postFinder ) {
  10216. postFinder( null, results, matcherOut, xml );
  10217. } else {
  10218. push.apply( results, matcherOut );
  10219. }
  10220. }
  10221. });
  10222. }
  10223. function matcherFromTokens( tokens ) {
  10224. var checkContext, matcher, j,
  10225. len = tokens.length,
  10226. leadingRelative = Expr.relative[ tokens[0].type ],
  10227. implicitRelative = leadingRelative || Expr.relative[" "],
  10228. i = leadingRelative ? 1 : 0,
  10229. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10230. matchContext = addCombinator( function( elem ) {
  10231. return elem === checkContext;
  10232. }, implicitRelative, true ),
  10233. matchAnyContext = addCombinator( function( elem ) {
  10234. return indexOf( checkContext, elem ) > -1;
  10235. }, implicitRelative, true ),
  10236. matchers = [ function( elem, context, xml ) {
  10237. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10238. (checkContext = context).nodeType ?
  10239. matchContext( elem, context, xml ) :
  10240. matchAnyContext( elem, context, xml ) );
  10241. // Avoid hanging onto element (issue #299)
  10242. checkContext = null;
  10243. return ret;
  10244. } ];
  10245. for ( ; i < len; i++ ) {
  10246. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10247. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10248. } else {
  10249. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10250. // Return special upon seeing a positional matcher
  10251. if ( matcher[ expando ] ) {
  10252. // Find the next relative operator (if any) for proper handling
  10253. j = ++i;
  10254. for ( ; j < len; j++ ) {
  10255. if ( Expr.relative[ tokens[j].type ] ) {
  10256. break;
  10257. }
  10258. }
  10259. return setMatcher(
  10260. i > 1 && elementMatcher( matchers ),
  10261. i > 1 && toSelector(
  10262. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10263. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10264. ).replace( rtrim, "$1" ),
  10265. matcher,
  10266. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10267. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10268. j < len && toSelector( tokens )
  10269. );
  10270. }
  10271. matchers.push( matcher );
  10272. }
  10273. }
  10274. return elementMatcher( matchers );
  10275. }
  10276. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10277. var bySet = setMatchers.length > 0,
  10278. byElement = elementMatchers.length > 0,
  10279. superMatcher = function( seed, context, xml, results, outermost ) {
  10280. var elem, j, matcher,
  10281. matchedCount = 0,
  10282. i = "0",
  10283. unmatched = seed && [],
  10284. setMatched = [],
  10285. contextBackup = outermostContext,
  10286. // We must always have either seed elements or outermost context
  10287. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10288. // Use integer dirruns iff this is the outermost matcher
  10289. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10290. len = elems.length;
  10291. if ( outermost ) {
  10292. outermostContext = context === document || context || outermost;
  10293. }
  10294. // Add elements passing elementMatchers directly to results
  10295. // Support: IE<9, Safari
  10296. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10297. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10298. if ( byElement && elem ) {
  10299. j = 0;
  10300. if ( !context && elem.ownerDocument !== document ) {
  10301. setDocument( elem );
  10302. xml = !documentIsHTML;
  10303. }
  10304. while ( (matcher = elementMatchers[j++]) ) {
  10305. if ( matcher( elem, context || document, xml) ) {
  10306. results.push( elem );
  10307. break;
  10308. }
  10309. }
  10310. if ( outermost ) {
  10311. dirruns = dirrunsUnique;
  10312. }
  10313. }
  10314. // Track unmatched elements for set filters
  10315. if ( bySet ) {
  10316. // They will have gone through all possible matchers
  10317. if ( (elem = !matcher && elem) ) {
  10318. matchedCount--;
  10319. }
  10320. // Lengthen the array for every element, matched or not
  10321. if ( seed ) {
  10322. unmatched.push( elem );
  10323. }
  10324. }
  10325. }
  10326. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10327. // makes the latter nonnegative.
  10328. matchedCount += i;
  10329. // Apply set filters to unmatched elements
  10330. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10331. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10332. // no element matchers and no seed.
  10333. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10334. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10335. // numerically zero.
  10336. if ( bySet && i !== matchedCount ) {
  10337. j = 0;
  10338. while ( (matcher = setMatchers[j++]) ) {
  10339. matcher( unmatched, setMatched, context, xml );
  10340. }
  10341. if ( seed ) {
  10342. // Reintegrate element matches to eliminate the need for sorting
  10343. if ( matchedCount > 0 ) {
  10344. while ( i-- ) {
  10345. if ( !(unmatched[i] || setMatched[i]) ) {
  10346. setMatched[i] = pop.call( results );
  10347. }
  10348. }
  10349. }
  10350. // Discard index placeholder values to get only actual matches
  10351. setMatched = condense( setMatched );
  10352. }
  10353. // Add matches to results
  10354. push.apply( results, setMatched );
  10355. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10356. if ( outermost && !seed && setMatched.length > 0 &&
  10357. ( matchedCount + setMatchers.length ) > 1 ) {
  10358. Sizzle.uniqueSort( results );
  10359. }
  10360. }
  10361. // Override manipulation of globals by nested matchers
  10362. if ( outermost ) {
  10363. dirruns = dirrunsUnique;
  10364. outermostContext = contextBackup;
  10365. }
  10366. return unmatched;
  10367. };
  10368. return bySet ?
  10369. markFunction( superMatcher ) :
  10370. superMatcher;
  10371. }
  10372. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10373. var i,
  10374. setMatchers = [],
  10375. elementMatchers = [],
  10376. cached = compilerCache[ selector + " " ];
  10377. if ( !cached ) {
  10378. // Generate a function of recursive functions that can be used to check each element
  10379. if ( !match ) {
  10380. match = tokenize( selector );
  10381. }
  10382. i = match.length;
  10383. while ( i-- ) {
  10384. cached = matcherFromTokens( match[i] );
  10385. if ( cached[ expando ] ) {
  10386. setMatchers.push( cached );
  10387. } else {
  10388. elementMatchers.push( cached );
  10389. }
  10390. }
  10391. // Cache the compiled function
  10392. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10393. // Save selector and tokenization
  10394. cached.selector = selector;
  10395. }
  10396. return cached;
  10397. };
  10398. /**
  10399. * A low-level selection function that works with Sizzle's compiled
  10400. * selector functions
  10401. * @param {String|Function} selector A selector or a pre-compiled
  10402. * selector function built with Sizzle.compile
  10403. * @param {Element} context
  10404. * @param {Array} [results]
  10405. * @param {Array} [seed] A set of elements to match against
  10406. */
  10407. select = Sizzle.select = function( selector, context, results, seed ) {
  10408. var i, tokens, token, type, find,
  10409. compiled = typeof selector === "function" && selector,
  10410. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10411. results = results || [];
  10412. // Try to minimize operations if there is only one selector in the list and no seed
  10413. // (the latter of which guarantees us context)
  10414. if ( match.length === 1 ) {
  10415. // Reduce context if the leading compound selector is an ID
  10416. tokens = match[0] = match[0].slice( 0 );
  10417. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10418. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10419. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10420. if ( !context ) {
  10421. return results;
  10422. // Precompiled matchers will still verify ancestry, so step up a level
  10423. } else if ( compiled ) {
  10424. context = context.parentNode;
  10425. }
  10426. selector = selector.slice( tokens.shift().value.length );
  10427. }
  10428. // Fetch a seed set for right-to-left matching
  10429. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10430. while ( i-- ) {
  10431. token = tokens[i];
  10432. // Abort if we hit a combinator
  10433. if ( Expr.relative[ (type = token.type) ] ) {
  10434. break;
  10435. }
  10436. if ( (find = Expr.find[ type ]) ) {
  10437. // Search, expanding context for leading sibling combinators
  10438. if ( (seed = find(
  10439. token.matches[0].replace( runescape, funescape ),
  10440. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10441. )) ) {
  10442. // If seed is empty or no tokens remain, we can return early
  10443. tokens.splice( i, 1 );
  10444. selector = seed.length && toSelector( tokens );
  10445. if ( !selector ) {
  10446. push.apply( results, seed );
  10447. return results;
  10448. }
  10449. break;
  10450. }
  10451. }
  10452. }
  10453. }
  10454. // Compile and execute a filtering function if one is not provided
  10455. // Provide `match` to avoid retokenization if we modified the selector above
  10456. ( compiled || compile( selector, match ) )(
  10457. seed,
  10458. context,
  10459. !documentIsHTML,
  10460. results,
  10461. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10462. );
  10463. return results;
  10464. };
  10465. // One-time assignments
  10466. // Sort stability
  10467. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10468. // Support: Chrome 14-35+
  10469. // Always assume duplicates if they aren't passed to the comparison function
  10470. support.detectDuplicates = !!hasDuplicate;
  10471. // Initialize against the default document
  10472. setDocument();
  10473. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10474. // Detached nodes confoundingly follow *each other*
  10475. support.sortDetached = assert(function( el ) {
  10476. // Should return 1, but returns 4 (following)
  10477. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10478. });
  10479. // Support: IE<8
  10480. // Prevent attribute/property "interpolation"
  10481. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10482. if ( !assert(function( el ) {
  10483. el.innerHTML = "<a href='#'></a>";
  10484. return el.firstChild.getAttribute("href") === "#" ;
  10485. }) ) {
  10486. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10487. if ( !isXML ) {
  10488. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10489. }
  10490. });
  10491. }
  10492. // Support: IE<9
  10493. // Use defaultValue in place of getAttribute("value")
  10494. if ( !support.attributes || !assert(function( el ) {
  10495. el.innerHTML = "<input/>";
  10496. el.firstChild.setAttribute( "value", "" );
  10497. return el.firstChild.getAttribute( "value" ) === "";
  10498. }) ) {
  10499. addHandle( "value", function( elem, name, isXML ) {
  10500. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10501. return elem.defaultValue;
  10502. }
  10503. });
  10504. }
  10505. // Support: IE<9
  10506. // Use getAttributeNode to fetch booleans when getAttribute lies
  10507. if ( !assert(function( el ) {
  10508. return el.getAttribute("disabled") == null;
  10509. }) ) {
  10510. addHandle( booleans, function( elem, name, isXML ) {
  10511. var val;
  10512. if ( !isXML ) {
  10513. return elem[ name ] === true ? name.toLowerCase() :
  10514. (val = elem.getAttributeNode( name )) && val.specified ?
  10515. val.value :
  10516. null;
  10517. }
  10518. });
  10519. }
  10520. return Sizzle;
  10521. })( window );
  10522. jQuery.find = Sizzle;
  10523. jQuery.expr = Sizzle.selectors;
  10524. // Deprecated
  10525. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10526. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10527. jQuery.text = Sizzle.getText;
  10528. jQuery.isXMLDoc = Sizzle.isXML;
  10529. jQuery.contains = Sizzle.contains;
  10530. jQuery.escapeSelector = Sizzle.escape;
  10531. var dir = function( elem, dir, until ) {
  10532. var matched = [],
  10533. truncate = until !== undefined;
  10534. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10535. if ( elem.nodeType === 1 ) {
  10536. if ( truncate && jQuery( elem ).is( until ) ) {
  10537. break;
  10538. }
  10539. matched.push( elem );
  10540. }
  10541. }
  10542. return matched;
  10543. };
  10544. var siblings = function( n, elem ) {
  10545. var matched = [];
  10546. for ( ; n; n = n.nextSibling ) {
  10547. if ( n.nodeType === 1 && n !== elem ) {
  10548. matched.push( n );
  10549. }
  10550. }
  10551. return matched;
  10552. };
  10553. var rneedsContext = jQuery.expr.match.needsContext;
  10554. function nodeName( elem, name ) {
  10555. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10556. };
  10557. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10558. // Implement the identical functionality for filter and not
  10559. function winnow( elements, qualifier, not ) {
  10560. if ( isFunction( qualifier ) ) {
  10561. return jQuery.grep( elements, function( elem, i ) {
  10562. return !!qualifier.call( elem, i, elem ) !== not;
  10563. } );
  10564. }
  10565. // Single element
  10566. if ( qualifier.nodeType ) {
  10567. return jQuery.grep( elements, function( elem ) {
  10568. return ( elem === qualifier ) !== not;
  10569. } );
  10570. }
  10571. // Arraylike of elements (jQuery, arguments, Array)
  10572. if ( typeof qualifier !== "string" ) {
  10573. return jQuery.grep( elements, function( elem ) {
  10574. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10575. } );
  10576. }
  10577. // Filtered directly for both simple and complex selectors
  10578. return jQuery.filter( qualifier, elements, not );
  10579. }
  10580. jQuery.filter = function( expr, elems, not ) {
  10581. var elem = elems[ 0 ];
  10582. if ( not ) {
  10583. expr = ":not(" + expr + ")";
  10584. }
  10585. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10586. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10587. }
  10588. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10589. return elem.nodeType === 1;
  10590. } ) );
  10591. };
  10592. jQuery.fn.extend( {
  10593. find: function( selector ) {
  10594. var i, ret,
  10595. len = this.length,
  10596. self = this;
  10597. if ( typeof selector !== "string" ) {
  10598. return this.pushStack( jQuery( selector ).filter( function() {
  10599. for ( i = 0; i < len; i++ ) {
  10600. if ( jQuery.contains( self[ i ], this ) ) {
  10601. return true;
  10602. }
  10603. }
  10604. } ) );
  10605. }
  10606. ret = this.pushStack( [] );
  10607. for ( i = 0; i < len; i++ ) {
  10608. jQuery.find( selector, self[ i ], ret );
  10609. }
  10610. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10611. },
  10612. filter: function( selector ) {
  10613. return this.pushStack( winnow( this, selector || [], false ) );
  10614. },
  10615. not: function( selector ) {
  10616. return this.pushStack( winnow( this, selector || [], true ) );
  10617. },
  10618. is: function( selector ) {
  10619. return !!winnow(
  10620. this,
  10621. // If this is a positional/relative selector, check membership in the returned set
  10622. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10623. typeof selector === "string" && rneedsContext.test( selector ) ?
  10624. jQuery( selector ) :
  10625. selector || [],
  10626. false
  10627. ).length;
  10628. }
  10629. } );
  10630. // Initialize a jQuery object
  10631. // A central reference to the root jQuery(document)
  10632. var rootjQuery,
  10633. // A simple way to check for HTML strings
  10634. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10635. // Strict HTML recognition (#11290: must start with <)
  10636. // Shortcut simple #id case for speed
  10637. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10638. init = jQuery.fn.init = function( selector, context, root ) {
  10639. var match, elem;
  10640. // HANDLE: $(""), $(null), $(undefined), $(false)
  10641. if ( !selector ) {
  10642. return this;
  10643. }
  10644. // Method init() accepts an alternate rootjQuery
  10645. // so migrate can support jQuery.sub (gh-2101)
  10646. root = root || rootjQuery;
  10647. // Handle HTML strings
  10648. if ( typeof selector === "string" ) {
  10649. if ( selector[ 0 ] === "<" &&
  10650. selector[ selector.length - 1 ] === ">" &&
  10651. selector.length >= 3 ) {
  10652. // Assume that strings that start and end with <> are HTML and skip the regex check
  10653. match = [ null, selector, null ];
  10654. } else {
  10655. match = rquickExpr.exec( selector );
  10656. }
  10657. // Match html or make sure no context is specified for #id
  10658. if ( match && ( match[ 1 ] || !context ) ) {
  10659. // HANDLE: $(html) -> $(array)
  10660. if ( match[ 1 ] ) {
  10661. context = context instanceof jQuery ? context[ 0 ] : context;
  10662. // Option to run scripts is true for back-compat
  10663. // Intentionally let the error be thrown if parseHTML is not present
  10664. jQuery.merge( this, jQuery.parseHTML(
  10665. match[ 1 ],
  10666. context && context.nodeType ? context.ownerDocument || context : document,
  10667. true
  10668. ) );
  10669. // HANDLE: $(html, props)
  10670. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10671. for ( match in context ) {
  10672. // Properties of context are called as methods if possible
  10673. if ( isFunction( this[ match ] ) ) {
  10674. this[ match ]( context[ match ] );
  10675. // ...and otherwise set as attributes
  10676. } else {
  10677. this.attr( match, context[ match ] );
  10678. }
  10679. }
  10680. }
  10681. return this;
  10682. // HANDLE: $(#id)
  10683. } else {
  10684. elem = document.getElementById( match[ 2 ] );
  10685. if ( elem ) {
  10686. // Inject the element directly into the jQuery object
  10687. this[ 0 ] = elem;
  10688. this.length = 1;
  10689. }
  10690. return this;
  10691. }
  10692. // HANDLE: $(expr, $(...))
  10693. } else if ( !context || context.jquery ) {
  10694. return ( context || root ).find( selector );
  10695. // HANDLE: $(expr, context)
  10696. // (which is just equivalent to: $(context).find(expr)
  10697. } else {
  10698. return this.constructor( context ).find( selector );
  10699. }
  10700. // HANDLE: $(DOMElement)
  10701. } else if ( selector.nodeType ) {
  10702. this[ 0 ] = selector;
  10703. this.length = 1;
  10704. return this;
  10705. // HANDLE: $(function)
  10706. // Shortcut for document ready
  10707. } else if ( isFunction( selector ) ) {
  10708. return root.ready !== undefined ?
  10709. root.ready( selector ) :
  10710. // Execute immediately if ready is not present
  10711. selector( jQuery );
  10712. }
  10713. return jQuery.makeArray( selector, this );
  10714. };
  10715. // Give the init function the jQuery prototype for later instantiation
  10716. init.prototype = jQuery.fn;
  10717. // Initialize central reference
  10718. rootjQuery = jQuery( document );
  10719. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10720. // Methods guaranteed to produce a unique set when starting from a unique set
  10721. guaranteedUnique = {
  10722. children: true,
  10723. contents: true,
  10724. next: true,
  10725. prev: true
  10726. };
  10727. jQuery.fn.extend( {
  10728. has: function( target ) {
  10729. var targets = jQuery( target, this ),
  10730. l = targets.length;
  10731. return this.filter( function() {
  10732. var i = 0;
  10733. for ( ; i < l; i++ ) {
  10734. if ( jQuery.contains( this, targets[ i ] ) ) {
  10735. return true;
  10736. }
  10737. }
  10738. } );
  10739. },
  10740. closest: function( selectors, context ) {
  10741. var cur,
  10742. i = 0,
  10743. l = this.length,
  10744. matched = [],
  10745. targets = typeof selectors !== "string" && jQuery( selectors );
  10746. // Positional selectors never match, since there's no _selection_ context
  10747. if ( !rneedsContext.test( selectors ) ) {
  10748. for ( ; i < l; i++ ) {
  10749. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10750. // Always skip document fragments
  10751. if ( cur.nodeType < 11 && ( targets ?
  10752. targets.index( cur ) > -1 :
  10753. // Don't pass non-elements to Sizzle
  10754. cur.nodeType === 1 &&
  10755. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10756. matched.push( cur );
  10757. break;
  10758. }
  10759. }
  10760. }
  10761. }
  10762. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10763. },
  10764. // Determine the position of an element within the set
  10765. index: function( elem ) {
  10766. // No argument, return index in parent
  10767. if ( !elem ) {
  10768. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10769. }
  10770. // Index in selector
  10771. if ( typeof elem === "string" ) {
  10772. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10773. }
  10774. // Locate the position of the desired element
  10775. return indexOf.call( this,
  10776. // If it receives a jQuery object, the first element is used
  10777. elem.jquery ? elem[ 0 ] : elem
  10778. );
  10779. },
  10780. add: function( selector, context ) {
  10781. return this.pushStack(
  10782. jQuery.uniqueSort(
  10783. jQuery.merge( this.get(), jQuery( selector, context ) )
  10784. )
  10785. );
  10786. },
  10787. addBack: function( selector ) {
  10788. return this.add( selector == null ?
  10789. this.prevObject : this.prevObject.filter( selector )
  10790. );
  10791. }
  10792. } );
  10793. function sibling( cur, dir ) {
  10794. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10795. return cur;
  10796. }
  10797. jQuery.each( {
  10798. parent: function( elem ) {
  10799. var parent = elem.parentNode;
  10800. return parent && parent.nodeType !== 11 ? parent : null;
  10801. },
  10802. parents: function( elem ) {
  10803. return dir( elem, "parentNode" );
  10804. },
  10805. parentsUntil: function( elem, i, until ) {
  10806. return dir( elem, "parentNode", until );
  10807. },
  10808. next: function( elem ) {
  10809. return sibling( elem, "nextSibling" );
  10810. },
  10811. prev: function( elem ) {
  10812. return sibling( elem, "previousSibling" );
  10813. },
  10814. nextAll: function( elem ) {
  10815. return dir( elem, "nextSibling" );
  10816. },
  10817. prevAll: function( elem ) {
  10818. return dir( elem, "previousSibling" );
  10819. },
  10820. nextUntil: function( elem, i, until ) {
  10821. return dir( elem, "nextSibling", until );
  10822. },
  10823. prevUntil: function( elem, i, until ) {
  10824. return dir( elem, "previousSibling", until );
  10825. },
  10826. siblings: function( elem ) {
  10827. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10828. },
  10829. children: function( elem ) {
  10830. return siblings( elem.firstChild );
  10831. },
  10832. contents: function( elem ) {
  10833. if ( typeof elem.contentDocument !== "undefined" ) {
  10834. return elem.contentDocument;
  10835. }
  10836. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10837. // Treat the template element as a regular one in browsers that
  10838. // don't support it.
  10839. if ( nodeName( elem, "template" ) ) {
  10840. elem = elem.content || elem;
  10841. }
  10842. return jQuery.merge( [], elem.childNodes );
  10843. }
  10844. }, function( name, fn ) {
  10845. jQuery.fn[ name ] = function( until, selector ) {
  10846. var matched = jQuery.map( this, fn, until );
  10847. if ( name.slice( -5 ) !== "Until" ) {
  10848. selector = until;
  10849. }
  10850. if ( selector && typeof selector === "string" ) {
  10851. matched = jQuery.filter( selector, matched );
  10852. }
  10853. if ( this.length > 1 ) {
  10854. // Remove duplicates
  10855. if ( !guaranteedUnique[ name ] ) {
  10856. jQuery.uniqueSort( matched );
  10857. }
  10858. // Reverse order for parents* and prev-derivatives
  10859. if ( rparentsprev.test( name ) ) {
  10860. matched.reverse();
  10861. }
  10862. }
  10863. return this.pushStack( matched );
  10864. };
  10865. } );
  10866. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10867. // Convert String-formatted options into Object-formatted ones
  10868. function createOptions( options ) {
  10869. var object = {};
  10870. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10871. object[ flag ] = true;
  10872. } );
  10873. return object;
  10874. }
  10875. /*
  10876. * Create a callback list using the following parameters:
  10877. *
  10878. * options: an optional list of space-separated options that will change how
  10879. * the callback list behaves or a more traditional option object
  10880. *
  10881. * By default a callback list will act like an event callback list and can be
  10882. * "fired" multiple times.
  10883. *
  10884. * Possible options:
  10885. *
  10886. * once: will ensure the callback list can only be fired once (like a Deferred)
  10887. *
  10888. * memory: will keep track of previous values and will call any callback added
  10889. * after the list has been fired right away with the latest "memorized"
  10890. * values (like a Deferred)
  10891. *
  10892. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10893. *
  10894. * stopOnFalse: interrupt callings when a callback returns false
  10895. *
  10896. */
  10897. jQuery.Callbacks = function( options ) {
  10898. // Convert options from String-formatted to Object-formatted if needed
  10899. // (we check in cache first)
  10900. options = typeof options === "string" ?
  10901. createOptions( options ) :
  10902. jQuery.extend( {}, options );
  10903. var // Flag to know if list is currently firing
  10904. firing,
  10905. // Last fire value for non-forgettable lists
  10906. memory,
  10907. // Flag to know if list was already fired
  10908. fired,
  10909. // Flag to prevent firing
  10910. locked,
  10911. // Actual callback list
  10912. list = [],
  10913. // Queue of execution data for repeatable lists
  10914. queue = [],
  10915. // Index of currently firing callback (modified by add/remove as needed)
  10916. firingIndex = -1,
  10917. // Fire callbacks
  10918. fire = function() {
  10919. // Enforce single-firing
  10920. locked = locked || options.once;
  10921. // Execute callbacks for all pending executions,
  10922. // respecting firingIndex overrides and runtime changes
  10923. fired = firing = true;
  10924. for ( ; queue.length; firingIndex = -1 ) {
  10925. memory = queue.shift();
  10926. while ( ++firingIndex < list.length ) {
  10927. // Run callback and check for early termination
  10928. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  10929. options.stopOnFalse ) {
  10930. // Jump to end and forget the data so .add doesn't re-fire
  10931. firingIndex = list.length;
  10932. memory = false;
  10933. }
  10934. }
  10935. }
  10936. // Forget the data if we're done with it
  10937. if ( !options.memory ) {
  10938. memory = false;
  10939. }
  10940. firing = false;
  10941. // Clean up if we're done firing for good
  10942. if ( locked ) {
  10943. // Keep an empty list if we have data for future add calls
  10944. if ( memory ) {
  10945. list = [];
  10946. // Otherwise, this object is spent
  10947. } else {
  10948. list = "";
  10949. }
  10950. }
  10951. },
  10952. // Actual Callbacks object
  10953. self = {
  10954. // Add a callback or a collection of callbacks to the list
  10955. add: function() {
  10956. if ( list ) {
  10957. // If we have memory from a past run, we should fire after adding
  10958. if ( memory && !firing ) {
  10959. firingIndex = list.length - 1;
  10960. queue.push( memory );
  10961. }
  10962. ( function add( args ) {
  10963. jQuery.each( args, function( _, arg ) {
  10964. if ( isFunction( arg ) ) {
  10965. if ( !options.unique || !self.has( arg ) ) {
  10966. list.push( arg );
  10967. }
  10968. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  10969. // Inspect recursively
  10970. add( arg );
  10971. }
  10972. } );
  10973. } )( arguments );
  10974. if ( memory && !firing ) {
  10975. fire();
  10976. }
  10977. }
  10978. return this;
  10979. },
  10980. // Remove a callback from the list
  10981. remove: function() {
  10982. jQuery.each( arguments, function( _, arg ) {
  10983. var index;
  10984. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  10985. list.splice( index, 1 );
  10986. // Handle firing indexes
  10987. if ( index <= firingIndex ) {
  10988. firingIndex--;
  10989. }
  10990. }
  10991. } );
  10992. return this;
  10993. },
  10994. // Check if a given callback is in the list.
  10995. // If no argument is given, return whether or not list has callbacks attached.
  10996. has: function( fn ) {
  10997. return fn ?
  10998. jQuery.inArray( fn, list ) > -1 :
  10999. list.length > 0;
  11000. },
  11001. // Remove all callbacks from the list
  11002. empty: function() {
  11003. if ( list ) {
  11004. list = [];
  11005. }
  11006. return this;
  11007. },
  11008. // Disable .fire and .add
  11009. // Abort any current/pending executions
  11010. // Clear all callbacks and values
  11011. disable: function() {
  11012. locked = queue = [];
  11013. list = memory = "";
  11014. return this;
  11015. },
  11016. disabled: function() {
  11017. return !list;
  11018. },
  11019. // Disable .fire
  11020. // Also disable .add unless we have memory (since it would have no effect)
  11021. // Abort any pending executions
  11022. lock: function() {
  11023. locked = queue = [];
  11024. if ( !memory && !firing ) {
  11025. list = memory = "";
  11026. }
  11027. return this;
  11028. },
  11029. locked: function() {
  11030. return !!locked;
  11031. },
  11032. // Call all callbacks with the given context and arguments
  11033. fireWith: function( context, args ) {
  11034. if ( !locked ) {
  11035. args = args || [];
  11036. args = [ context, args.slice ? args.slice() : args ];
  11037. queue.push( args );
  11038. if ( !firing ) {
  11039. fire();
  11040. }
  11041. }
  11042. return this;
  11043. },
  11044. // Call all the callbacks with the given arguments
  11045. fire: function() {
  11046. self.fireWith( this, arguments );
  11047. return this;
  11048. },
  11049. // To know if the callbacks have already been called at least once
  11050. fired: function() {
  11051. return !!fired;
  11052. }
  11053. };
  11054. return self;
  11055. };
  11056. function Identity( v ) {
  11057. return v;
  11058. }
  11059. function Thrower( ex ) {
  11060. throw ex;
  11061. }
  11062. function adoptValue( value, resolve, reject, noValue ) {
  11063. var method;
  11064. try {
  11065. // Check for promise aspect first to privilege synchronous behavior
  11066. if ( value && isFunction( ( method = value.promise ) ) ) {
  11067. method.call( value ).done( resolve ).fail( reject );
  11068. // Other thenables
  11069. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11070. method.call( value, resolve, reject );
  11071. // Other non-thenables
  11072. } else {
  11073. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11074. // * false: [ value ].slice( 0 ) => resolve( value )
  11075. // * true: [ value ].slice( 1 ) => resolve()
  11076. resolve.apply( undefined, [ value ].slice( noValue ) );
  11077. }
  11078. // For Promises/A+, convert exceptions into rejections
  11079. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11080. // Deferred#then to conditionally suppress rejection.
  11081. } catch ( value ) {
  11082. // Support: Android 4.0 only
  11083. // Strict mode functions invoked without .call/.apply get global-object context
  11084. reject.apply( undefined, [ value ] );
  11085. }
  11086. }
  11087. jQuery.extend( {
  11088. Deferred: function( func ) {
  11089. var tuples = [
  11090. // action, add listener, callbacks,
  11091. // ... .then handlers, argument index, [final state]
  11092. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11093. jQuery.Callbacks( "memory" ), 2 ],
  11094. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11095. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11096. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11097. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11098. ],
  11099. state = "pending",
  11100. promise = {
  11101. state: function() {
  11102. return state;
  11103. },
  11104. always: function() {
  11105. deferred.done( arguments ).fail( arguments );
  11106. return this;
  11107. },
  11108. "catch": function( fn ) {
  11109. return promise.then( null, fn );
  11110. },
  11111. // Keep pipe for back-compat
  11112. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11113. var fns = arguments;
  11114. return jQuery.Deferred( function( newDefer ) {
  11115. jQuery.each( tuples, function( i, tuple ) {
  11116. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11117. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11118. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11119. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11120. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11121. deferred[ tuple[ 1 ] ]( function() {
  11122. var returned = fn && fn.apply( this, arguments );
  11123. if ( returned && isFunction( returned.promise ) ) {
  11124. returned.promise()
  11125. .progress( newDefer.notify )
  11126. .done( newDefer.resolve )
  11127. .fail( newDefer.reject );
  11128. } else {
  11129. newDefer[ tuple[ 0 ] + "With" ](
  11130. this,
  11131. fn ? [ returned ] : arguments
  11132. );
  11133. }
  11134. } );
  11135. } );
  11136. fns = null;
  11137. } ).promise();
  11138. },
  11139. then: function( onFulfilled, onRejected, onProgress ) {
  11140. var maxDepth = 0;
  11141. function resolve( depth, deferred, handler, special ) {
  11142. return function() {
  11143. var that = this,
  11144. args = arguments,
  11145. mightThrow = function() {
  11146. var returned, then;
  11147. // Support: Promises/A+ section 2.3.3.3.3
  11148. // https://promisesaplus.com/#point-59
  11149. // Ignore double-resolution attempts
  11150. if ( depth < maxDepth ) {
  11151. return;
  11152. }
  11153. returned = handler.apply( that, args );
  11154. // Support: Promises/A+ section 2.3.1
  11155. // https://promisesaplus.com/#point-48
  11156. if ( returned === deferred.promise() ) {
  11157. throw new TypeError( "Thenable self-resolution" );
  11158. }
  11159. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11160. // https://promisesaplus.com/#point-54
  11161. // https://promisesaplus.com/#point-75
  11162. // Retrieve `then` only once
  11163. then = returned &&
  11164. // Support: Promises/A+ section 2.3.4
  11165. // https://promisesaplus.com/#point-64
  11166. // Only check objects and functions for thenability
  11167. ( typeof returned === "object" ||
  11168. typeof returned === "function" ) &&
  11169. returned.then;
  11170. // Handle a returned thenable
  11171. if ( isFunction( then ) ) {
  11172. // Special processors (notify) just wait for resolution
  11173. if ( special ) {
  11174. then.call(
  11175. returned,
  11176. resolve( maxDepth, deferred, Identity, special ),
  11177. resolve( maxDepth, deferred, Thrower, special )
  11178. );
  11179. // Normal processors (resolve) also hook into progress
  11180. } else {
  11181. // ...and disregard older resolution values
  11182. maxDepth++;
  11183. then.call(
  11184. returned,
  11185. resolve( maxDepth, deferred, Identity, special ),
  11186. resolve( maxDepth, deferred, Thrower, special ),
  11187. resolve( maxDepth, deferred, Identity,
  11188. deferred.notifyWith )
  11189. );
  11190. }
  11191. // Handle all other returned values
  11192. } else {
  11193. // Only substitute handlers pass on context
  11194. // and multiple values (non-spec behavior)
  11195. if ( handler !== Identity ) {
  11196. that = undefined;
  11197. args = [ returned ];
  11198. }
  11199. // Process the value(s)
  11200. // Default process is resolve
  11201. ( special || deferred.resolveWith )( that, args );
  11202. }
  11203. },
  11204. // Only normal processors (resolve) catch and reject exceptions
  11205. process = special ?
  11206. mightThrow :
  11207. function() {
  11208. try {
  11209. mightThrow();
  11210. } catch ( e ) {
  11211. if ( jQuery.Deferred.exceptionHook ) {
  11212. jQuery.Deferred.exceptionHook( e,
  11213. process.stackTrace );
  11214. }
  11215. // Support: Promises/A+ section 2.3.3.3.4.1
  11216. // https://promisesaplus.com/#point-61
  11217. // Ignore post-resolution exceptions
  11218. if ( depth + 1 >= maxDepth ) {
  11219. // Only substitute handlers pass on context
  11220. // and multiple values (non-spec behavior)
  11221. if ( handler !== Thrower ) {
  11222. that = undefined;
  11223. args = [ e ];
  11224. }
  11225. deferred.rejectWith( that, args );
  11226. }
  11227. }
  11228. };
  11229. // Support: Promises/A+ section 2.3.3.3.1
  11230. // https://promisesaplus.com/#point-57
  11231. // Re-resolve promises immediately to dodge false rejection from
  11232. // subsequent errors
  11233. if ( depth ) {
  11234. process();
  11235. } else {
  11236. // Call an optional hook to record the stack, in case of exception
  11237. // since it's otherwise lost when execution goes async
  11238. if ( jQuery.Deferred.getStackHook ) {
  11239. process.stackTrace = jQuery.Deferred.getStackHook();
  11240. }
  11241. window.setTimeout( process );
  11242. }
  11243. };
  11244. }
  11245. return jQuery.Deferred( function( newDefer ) {
  11246. // progress_handlers.add( ... )
  11247. tuples[ 0 ][ 3 ].add(
  11248. resolve(
  11249. 0,
  11250. newDefer,
  11251. isFunction( onProgress ) ?
  11252. onProgress :
  11253. Identity,
  11254. newDefer.notifyWith
  11255. )
  11256. );
  11257. // fulfilled_handlers.add( ... )
  11258. tuples[ 1 ][ 3 ].add(
  11259. resolve(
  11260. 0,
  11261. newDefer,
  11262. isFunction( onFulfilled ) ?
  11263. onFulfilled :
  11264. Identity
  11265. )
  11266. );
  11267. // rejected_handlers.add( ... )
  11268. tuples[ 2 ][ 3 ].add(
  11269. resolve(
  11270. 0,
  11271. newDefer,
  11272. isFunction( onRejected ) ?
  11273. onRejected :
  11274. Thrower
  11275. )
  11276. );
  11277. } ).promise();
  11278. },
  11279. // Get a promise for this deferred
  11280. // If obj is provided, the promise aspect is added to the object
  11281. promise: function( obj ) {
  11282. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11283. }
  11284. },
  11285. deferred = {};
  11286. // Add list-specific methods
  11287. jQuery.each( tuples, function( i, tuple ) {
  11288. var list = tuple[ 2 ],
  11289. stateString = tuple[ 5 ];
  11290. // promise.progress = list.add
  11291. // promise.done = list.add
  11292. // promise.fail = list.add
  11293. promise[ tuple[ 1 ] ] = list.add;
  11294. // Handle state
  11295. if ( stateString ) {
  11296. list.add(
  11297. function() {
  11298. // state = "resolved" (i.e., fulfilled)
  11299. // state = "rejected"
  11300. state = stateString;
  11301. },
  11302. // rejected_callbacks.disable
  11303. // fulfilled_callbacks.disable
  11304. tuples[ 3 - i ][ 2 ].disable,
  11305. // rejected_handlers.disable
  11306. // fulfilled_handlers.disable
  11307. tuples[ 3 - i ][ 3 ].disable,
  11308. // progress_callbacks.lock
  11309. tuples[ 0 ][ 2 ].lock,
  11310. // progress_handlers.lock
  11311. tuples[ 0 ][ 3 ].lock
  11312. );
  11313. }
  11314. // progress_handlers.fire
  11315. // fulfilled_handlers.fire
  11316. // rejected_handlers.fire
  11317. list.add( tuple[ 3 ].fire );
  11318. // deferred.notify = function() { deferred.notifyWith(...) }
  11319. // deferred.resolve = function() { deferred.resolveWith(...) }
  11320. // deferred.reject = function() { deferred.rejectWith(...) }
  11321. deferred[ tuple[ 0 ] ] = function() {
  11322. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11323. return this;
  11324. };
  11325. // deferred.notifyWith = list.fireWith
  11326. // deferred.resolveWith = list.fireWith
  11327. // deferred.rejectWith = list.fireWith
  11328. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11329. } );
  11330. // Make the deferred a promise
  11331. promise.promise( deferred );
  11332. // Call given func if any
  11333. if ( func ) {
  11334. func.call( deferred, deferred );
  11335. }
  11336. // All done!
  11337. return deferred;
  11338. },
  11339. // Deferred helper
  11340. when: function( singleValue ) {
  11341. var
  11342. // count of uncompleted subordinates
  11343. remaining = arguments.length,
  11344. // count of unprocessed arguments
  11345. i = remaining,
  11346. // subordinate fulfillment data
  11347. resolveContexts = Array( i ),
  11348. resolveValues = slice.call( arguments ),
  11349. // the master Deferred
  11350. master = jQuery.Deferred(),
  11351. // subordinate callback factory
  11352. updateFunc = function( i ) {
  11353. return function( value ) {
  11354. resolveContexts[ i ] = this;
  11355. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11356. if ( !( --remaining ) ) {
  11357. master.resolveWith( resolveContexts, resolveValues );
  11358. }
  11359. };
  11360. };
  11361. // Single- and empty arguments are adopted like Promise.resolve
  11362. if ( remaining <= 1 ) {
  11363. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11364. !remaining );
  11365. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11366. if ( master.state() === "pending" ||
  11367. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11368. return master.then();
  11369. }
  11370. }
  11371. // Multiple arguments are aggregated like Promise.all array elements
  11372. while ( i-- ) {
  11373. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11374. }
  11375. return master.promise();
  11376. }
  11377. } );
  11378. // These usually indicate a programmer mistake during development,
  11379. // warn about them ASAP rather than swallowing them by default.
  11380. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11381. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11382. // Support: IE 8 - 9 only
  11383. // Console exists when dev tools are open, which can happen at any time
  11384. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11385. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11386. }
  11387. };
  11388. jQuery.readyException = function( error ) {
  11389. window.setTimeout( function() {
  11390. throw error;
  11391. } );
  11392. };
  11393. // The deferred used on DOM ready
  11394. var readyList = jQuery.Deferred();
  11395. jQuery.fn.ready = function( fn ) {
  11396. readyList
  11397. .then( fn )
  11398. // Wrap jQuery.readyException in a function so that the lookup
  11399. // happens at the time of error handling instead of callback
  11400. // registration.
  11401. .catch( function( error ) {
  11402. jQuery.readyException( error );
  11403. } );
  11404. return this;
  11405. };
  11406. jQuery.extend( {
  11407. // Is the DOM ready to be used? Set to true once it occurs.
  11408. isReady: false,
  11409. // A counter to track how many items to wait for before
  11410. // the ready event fires. See #6781
  11411. readyWait: 1,
  11412. // Handle when the DOM is ready
  11413. ready: function( wait ) {
  11414. // Abort if there are pending holds or we're already ready
  11415. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11416. return;
  11417. }
  11418. // Remember that the DOM is ready
  11419. jQuery.isReady = true;
  11420. // If a normal DOM Ready event fired, decrement, and wait if need be
  11421. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11422. return;
  11423. }
  11424. // If there are functions bound, to execute
  11425. readyList.resolveWith( document, [ jQuery ] );
  11426. }
  11427. } );
  11428. jQuery.ready.then = readyList.then;
  11429. // The ready event handler and self cleanup method
  11430. function completed() {
  11431. document.removeEventListener( "DOMContentLoaded", completed );
  11432. window.removeEventListener( "load", completed );
  11433. jQuery.ready();
  11434. }
  11435. // Catch cases where $(document).ready() is called
  11436. // after the browser event has already occurred.
  11437. // Support: IE <=9 - 10 only
  11438. // Older IE sometimes signals "interactive" too soon
  11439. if ( document.readyState === "complete" ||
  11440. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11441. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11442. window.setTimeout( jQuery.ready );
  11443. } else {
  11444. // Use the handy event callback
  11445. document.addEventListener( "DOMContentLoaded", completed );
  11446. // A fallback to window.onload, that will always work
  11447. window.addEventListener( "load", completed );
  11448. }
  11449. // Multifunctional method to get and set values of a collection
  11450. // The value/s can optionally be executed if it's a function
  11451. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11452. var i = 0,
  11453. len = elems.length,
  11454. bulk = key == null;
  11455. // Sets many values
  11456. if ( toType( key ) === "object" ) {
  11457. chainable = true;
  11458. for ( i in key ) {
  11459. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11460. }
  11461. // Sets one value
  11462. } else if ( value !== undefined ) {
  11463. chainable = true;
  11464. if ( !isFunction( value ) ) {
  11465. raw = true;
  11466. }
  11467. if ( bulk ) {
  11468. // Bulk operations run against the entire set
  11469. if ( raw ) {
  11470. fn.call( elems, value );
  11471. fn = null;
  11472. // ...except when executing function values
  11473. } else {
  11474. bulk = fn;
  11475. fn = function( elem, key, value ) {
  11476. return bulk.call( jQuery( elem ), value );
  11477. };
  11478. }
  11479. }
  11480. if ( fn ) {
  11481. for ( ; i < len; i++ ) {
  11482. fn(
  11483. elems[ i ], key, raw ?
  11484. value :
  11485. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11486. );
  11487. }
  11488. }
  11489. }
  11490. if ( chainable ) {
  11491. return elems;
  11492. }
  11493. // Gets
  11494. if ( bulk ) {
  11495. return fn.call( elems );
  11496. }
  11497. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11498. };
  11499. // Matches dashed string for camelizing
  11500. var rmsPrefix = /^-ms-/,
  11501. rdashAlpha = /-([a-z])/g;
  11502. // Used by camelCase as callback to replace()
  11503. function fcamelCase( all, letter ) {
  11504. return letter.toUpperCase();
  11505. }
  11506. // Convert dashed to camelCase; used by the css and data modules
  11507. // Support: IE <=9 - 11, Edge 12 - 15
  11508. // Microsoft forgot to hump their vendor prefix (#9572)
  11509. function camelCase( string ) {
  11510. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11511. }
  11512. var acceptData = function( owner ) {
  11513. // Accepts only:
  11514. // - Node
  11515. // - Node.ELEMENT_NODE
  11516. // - Node.DOCUMENT_NODE
  11517. // - Object
  11518. // - Any
  11519. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11520. };
  11521. function Data() {
  11522. this.expando = jQuery.expando + Data.uid++;
  11523. }
  11524. Data.uid = 1;
  11525. Data.prototype = {
  11526. cache: function( owner ) {
  11527. // Check if the owner object already has a cache
  11528. var value = owner[ this.expando ];
  11529. // If not, create one
  11530. if ( !value ) {
  11531. value = {};
  11532. // We can accept data for non-element nodes in modern browsers,
  11533. // but we should not, see #8335.
  11534. // Always return an empty object.
  11535. if ( acceptData( owner ) ) {
  11536. // If it is a node unlikely to be stringify-ed or looped over
  11537. // use plain assignment
  11538. if ( owner.nodeType ) {
  11539. owner[ this.expando ] = value;
  11540. // Otherwise secure it in a non-enumerable property
  11541. // configurable must be true to allow the property to be
  11542. // deleted when data is removed
  11543. } else {
  11544. Object.defineProperty( owner, this.expando, {
  11545. value: value,
  11546. configurable: true
  11547. } );
  11548. }
  11549. }
  11550. }
  11551. return value;
  11552. },
  11553. set: function( owner, data, value ) {
  11554. var prop,
  11555. cache = this.cache( owner );
  11556. // Handle: [ owner, key, value ] args
  11557. // Always use camelCase key (gh-2257)
  11558. if ( typeof data === "string" ) {
  11559. cache[ camelCase( data ) ] = value;
  11560. // Handle: [ owner, { properties } ] args
  11561. } else {
  11562. // Copy the properties one-by-one to the cache object
  11563. for ( prop in data ) {
  11564. cache[ camelCase( prop ) ] = data[ prop ];
  11565. }
  11566. }
  11567. return cache;
  11568. },
  11569. get: function( owner, key ) {
  11570. return key === undefined ?
  11571. this.cache( owner ) :
  11572. // Always use camelCase key (gh-2257)
  11573. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11574. },
  11575. access: function( owner, key, value ) {
  11576. // In cases where either:
  11577. //
  11578. // 1. No key was specified
  11579. // 2. A string key was specified, but no value provided
  11580. //
  11581. // Take the "read" path and allow the get method to determine
  11582. // which value to return, respectively either:
  11583. //
  11584. // 1. The entire cache object
  11585. // 2. The data stored at the key
  11586. //
  11587. if ( key === undefined ||
  11588. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11589. return this.get( owner, key );
  11590. }
  11591. // When the key is not a string, or both a key and value
  11592. // are specified, set or extend (existing objects) with either:
  11593. //
  11594. // 1. An object of properties
  11595. // 2. A key and value
  11596. //
  11597. this.set( owner, key, value );
  11598. // Since the "set" path can have two possible entry points
  11599. // return the expected data based on which path was taken[*]
  11600. return value !== undefined ? value : key;
  11601. },
  11602. remove: function( owner, key ) {
  11603. var i,
  11604. cache = owner[ this.expando ];
  11605. if ( cache === undefined ) {
  11606. return;
  11607. }
  11608. if ( key !== undefined ) {
  11609. // Support array or space separated string of keys
  11610. if ( Array.isArray( key ) ) {
  11611. // If key is an array of keys...
  11612. // We always set camelCase keys, so remove that.
  11613. key = key.map( camelCase );
  11614. } else {
  11615. key = camelCase( key );
  11616. // If a key with the spaces exists, use it.
  11617. // Otherwise, create an array by matching non-whitespace
  11618. key = key in cache ?
  11619. [ key ] :
  11620. ( key.match( rnothtmlwhite ) || [] );
  11621. }
  11622. i = key.length;
  11623. while ( i-- ) {
  11624. delete cache[ key[ i ] ];
  11625. }
  11626. }
  11627. // Remove the expando if there's no more data
  11628. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11629. // Support: Chrome <=35 - 45
  11630. // Webkit & Blink performance suffers when deleting properties
  11631. // from DOM nodes, so set to undefined instead
  11632. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11633. if ( owner.nodeType ) {
  11634. owner[ this.expando ] = undefined;
  11635. } else {
  11636. delete owner[ this.expando ];
  11637. }
  11638. }
  11639. },
  11640. hasData: function( owner ) {
  11641. var cache = owner[ this.expando ];
  11642. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11643. }
  11644. };
  11645. var dataPriv = new Data();
  11646. var dataUser = new Data();
  11647. // Implementation Summary
  11648. //
  11649. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11650. // 2. Improve the module's maintainability by reducing the storage
  11651. // paths to a single mechanism.
  11652. // 3. Use the same single mechanism to support "private" and "user" data.
  11653. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11654. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11655. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11656. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11657. rmultiDash = /[A-Z]/g;
  11658. function getData( data ) {
  11659. if ( data === "true" ) {
  11660. return true;
  11661. }
  11662. if ( data === "false" ) {
  11663. return false;
  11664. }
  11665. if ( data === "null" ) {
  11666. return null;
  11667. }
  11668. // Only convert to a number if it doesn't change the string
  11669. if ( data === +data + "" ) {
  11670. return +data;
  11671. }
  11672. if ( rbrace.test( data ) ) {
  11673. return JSON.parse( data );
  11674. }
  11675. return data;
  11676. }
  11677. function dataAttr( elem, key, data ) {
  11678. var name;
  11679. // If nothing was found internally, try to fetch any
  11680. // data from the HTML5 data-* attribute
  11681. if ( data === undefined && elem.nodeType === 1 ) {
  11682. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11683. data = elem.getAttribute( name );
  11684. if ( typeof data === "string" ) {
  11685. try {
  11686. data = getData( data );
  11687. } catch ( e ) {}
  11688. // Make sure we set the data so it isn't changed later
  11689. dataUser.set( elem, key, data );
  11690. } else {
  11691. data = undefined;
  11692. }
  11693. }
  11694. return data;
  11695. }
  11696. jQuery.extend( {
  11697. hasData: function( elem ) {
  11698. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11699. },
  11700. data: function( elem, name, data ) {
  11701. return dataUser.access( elem, name, data );
  11702. },
  11703. removeData: function( elem, name ) {
  11704. dataUser.remove( elem, name );
  11705. },
  11706. // TODO: Now that all calls to _data and _removeData have been replaced
  11707. // with direct calls to dataPriv methods, these can be deprecated.
  11708. _data: function( elem, name, data ) {
  11709. return dataPriv.access( elem, name, data );
  11710. },
  11711. _removeData: function( elem, name ) {
  11712. dataPriv.remove( elem, name );
  11713. }
  11714. } );
  11715. jQuery.fn.extend( {
  11716. data: function( key, value ) {
  11717. var i, name, data,
  11718. elem = this[ 0 ],
  11719. attrs = elem && elem.attributes;
  11720. // Gets all values
  11721. if ( key === undefined ) {
  11722. if ( this.length ) {
  11723. data = dataUser.get( elem );
  11724. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11725. i = attrs.length;
  11726. while ( i-- ) {
  11727. // Support: IE 11 only
  11728. // The attrs elements can be null (#14894)
  11729. if ( attrs[ i ] ) {
  11730. name = attrs[ i ].name;
  11731. if ( name.indexOf( "data-" ) === 0 ) {
  11732. name = camelCase( name.slice( 5 ) );
  11733. dataAttr( elem, name, data[ name ] );
  11734. }
  11735. }
  11736. }
  11737. dataPriv.set( elem, "hasDataAttrs", true );
  11738. }
  11739. }
  11740. return data;
  11741. }
  11742. // Sets multiple values
  11743. if ( typeof key === "object" ) {
  11744. return this.each( function() {
  11745. dataUser.set( this, key );
  11746. } );
  11747. }
  11748. return access( this, function( value ) {
  11749. var data;
  11750. // The calling jQuery object (element matches) is not empty
  11751. // (and therefore has an element appears at this[ 0 ]) and the
  11752. // `value` parameter was not undefined. An empty jQuery object
  11753. // will result in `undefined` for elem = this[ 0 ] which will
  11754. // throw an exception if an attempt to read a data cache is made.
  11755. if ( elem && value === undefined ) {
  11756. // Attempt to get data from the cache
  11757. // The key will always be camelCased in Data
  11758. data = dataUser.get( elem, key );
  11759. if ( data !== undefined ) {
  11760. return data;
  11761. }
  11762. // Attempt to "discover" the data in
  11763. // HTML5 custom data-* attrs
  11764. data = dataAttr( elem, key );
  11765. if ( data !== undefined ) {
  11766. return data;
  11767. }
  11768. // We tried really hard, but the data doesn't exist.
  11769. return;
  11770. }
  11771. // Set the data...
  11772. this.each( function() {
  11773. // We always store the camelCased key
  11774. dataUser.set( this, key, value );
  11775. } );
  11776. }, null, value, arguments.length > 1, null, true );
  11777. },
  11778. removeData: function( key ) {
  11779. return this.each( function() {
  11780. dataUser.remove( this, key );
  11781. } );
  11782. }
  11783. } );
  11784. jQuery.extend( {
  11785. queue: function( elem, type, data ) {
  11786. var queue;
  11787. if ( elem ) {
  11788. type = ( type || "fx" ) + "queue";
  11789. queue = dataPriv.get( elem, type );
  11790. // Speed up dequeue by getting out quickly if this is just a lookup
  11791. if ( data ) {
  11792. if ( !queue || Array.isArray( data ) ) {
  11793. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11794. } else {
  11795. queue.push( data );
  11796. }
  11797. }
  11798. return queue || [];
  11799. }
  11800. },
  11801. dequeue: function( elem, type ) {
  11802. type = type || "fx";
  11803. var queue = jQuery.queue( elem, type ),
  11804. startLength = queue.length,
  11805. fn = queue.shift(),
  11806. hooks = jQuery._queueHooks( elem, type ),
  11807. next = function() {
  11808. jQuery.dequeue( elem, type );
  11809. };
  11810. // If the fx queue is dequeued, always remove the progress sentinel
  11811. if ( fn === "inprogress" ) {
  11812. fn = queue.shift();
  11813. startLength--;
  11814. }
  11815. if ( fn ) {
  11816. // Add a progress sentinel to prevent the fx queue from being
  11817. // automatically dequeued
  11818. if ( type === "fx" ) {
  11819. queue.unshift( "inprogress" );
  11820. }
  11821. // Clear up the last queue stop function
  11822. delete hooks.stop;
  11823. fn.call( elem, next, hooks );
  11824. }
  11825. if ( !startLength && hooks ) {
  11826. hooks.empty.fire();
  11827. }
  11828. },
  11829. // Not public - generate a queueHooks object, or return the current one
  11830. _queueHooks: function( elem, type ) {
  11831. var key = type + "queueHooks";
  11832. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11833. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11834. dataPriv.remove( elem, [ type + "queue", key ] );
  11835. } )
  11836. } );
  11837. }
  11838. } );
  11839. jQuery.fn.extend( {
  11840. queue: function( type, data ) {
  11841. var setter = 2;
  11842. if ( typeof type !== "string" ) {
  11843. data = type;
  11844. type = "fx";
  11845. setter--;
  11846. }
  11847. if ( arguments.length < setter ) {
  11848. return jQuery.queue( this[ 0 ], type );
  11849. }
  11850. return data === undefined ?
  11851. this :
  11852. this.each( function() {
  11853. var queue = jQuery.queue( this, type, data );
  11854. // Ensure a hooks for this queue
  11855. jQuery._queueHooks( this, type );
  11856. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11857. jQuery.dequeue( this, type );
  11858. }
  11859. } );
  11860. },
  11861. dequeue: function( type ) {
  11862. return this.each( function() {
  11863. jQuery.dequeue( this, type );
  11864. } );
  11865. },
  11866. clearQueue: function( type ) {
  11867. return this.queue( type || "fx", [] );
  11868. },
  11869. // Get a promise resolved when queues of a certain type
  11870. // are emptied (fx is the type by default)
  11871. promise: function( type, obj ) {
  11872. var tmp,
  11873. count = 1,
  11874. defer = jQuery.Deferred(),
  11875. elements = this,
  11876. i = this.length,
  11877. resolve = function() {
  11878. if ( !( --count ) ) {
  11879. defer.resolveWith( elements, [ elements ] );
  11880. }
  11881. };
  11882. if ( typeof type !== "string" ) {
  11883. obj = type;
  11884. type = undefined;
  11885. }
  11886. type = type || "fx";
  11887. while ( i-- ) {
  11888. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11889. if ( tmp && tmp.empty ) {
  11890. count++;
  11891. tmp.empty.add( resolve );
  11892. }
  11893. }
  11894. resolve();
  11895. return defer.promise( obj );
  11896. }
  11897. } );
  11898. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11899. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11900. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11901. var documentElement = document.documentElement;
  11902. var isAttached = function( elem ) {
  11903. return jQuery.contains( elem.ownerDocument, elem );
  11904. },
  11905. composed = { composed: true };
  11906. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11907. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11908. // Support: iOS 10.0-10.2 only
  11909. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11910. // leading to errors. We need to check for `getRootNode`.
  11911. if ( documentElement.getRootNode ) {
  11912. isAttached = function( elem ) {
  11913. return jQuery.contains( elem.ownerDocument, elem ) ||
  11914. elem.getRootNode( composed ) === elem.ownerDocument;
  11915. };
  11916. }
  11917. var isHiddenWithinTree = function( elem, el ) {
  11918. // isHiddenWithinTree might be called from jQuery#filter function;
  11919. // in that case, element will be second argument
  11920. elem = el || elem;
  11921. // Inline style trumps all
  11922. return elem.style.display === "none" ||
  11923. elem.style.display === "" &&
  11924. // Otherwise, check computed style
  11925. // Support: Firefox <=43 - 45
  11926. // Disconnected elements can have computed display: none, so first confirm that elem is
  11927. // in the document.
  11928. isAttached( elem ) &&
  11929. jQuery.css( elem, "display" ) === "none";
  11930. };
  11931. var swap = function( elem, options, callback, args ) {
  11932. var ret, name,
  11933. old = {};
  11934. // Remember the old values, and insert the new ones
  11935. for ( name in options ) {
  11936. old[ name ] = elem.style[ name ];
  11937. elem.style[ name ] = options[ name ];
  11938. }
  11939. ret = callback.apply( elem, args || [] );
  11940. // Revert the old values
  11941. for ( name in options ) {
  11942. elem.style[ name ] = old[ name ];
  11943. }
  11944. return ret;
  11945. };
  11946. function adjustCSS( elem, prop, valueParts, tween ) {
  11947. var adjusted, scale,
  11948. maxIterations = 20,
  11949. currentValue = tween ?
  11950. function() {
  11951. return tween.cur();
  11952. } :
  11953. function() {
  11954. return jQuery.css( elem, prop, "" );
  11955. },
  11956. initial = currentValue(),
  11957. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  11958. // Starting value computation is required for potential unit mismatches
  11959. initialInUnit = elem.nodeType &&
  11960. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  11961. rcssNum.exec( jQuery.css( elem, prop ) );
  11962. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  11963. // Support: Firefox <=54
  11964. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  11965. initial = initial / 2;
  11966. // Trust units reported by jQuery.css
  11967. unit = unit || initialInUnit[ 3 ];
  11968. // Iteratively approximate from a nonzero starting point
  11969. initialInUnit = +initial || 1;
  11970. while ( maxIterations-- ) {
  11971. // Evaluate and update our best guess (doubling guesses that zero out).
  11972. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  11973. jQuery.style( elem, prop, initialInUnit + unit );
  11974. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  11975. maxIterations = 0;
  11976. }
  11977. initialInUnit = initialInUnit / scale;
  11978. }
  11979. initialInUnit = initialInUnit * 2;
  11980. jQuery.style( elem, prop, initialInUnit + unit );
  11981. // Make sure we update the tween properties later on
  11982. valueParts = valueParts || [];
  11983. }
  11984. if ( valueParts ) {
  11985. initialInUnit = +initialInUnit || +initial || 0;
  11986. // Apply relative offset (+=/-=) if specified
  11987. adjusted = valueParts[ 1 ] ?
  11988. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  11989. +valueParts[ 2 ];
  11990. if ( tween ) {
  11991. tween.unit = unit;
  11992. tween.start = initialInUnit;
  11993. tween.end = adjusted;
  11994. }
  11995. }
  11996. return adjusted;
  11997. }
  11998. var defaultDisplayMap = {};
  11999. function getDefaultDisplay( elem ) {
  12000. var temp,
  12001. doc = elem.ownerDocument,
  12002. nodeName = elem.nodeName,
  12003. display = defaultDisplayMap[ nodeName ];
  12004. if ( display ) {
  12005. return display;
  12006. }
  12007. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12008. display = jQuery.css( temp, "display" );
  12009. temp.parentNode.removeChild( temp );
  12010. if ( display === "none" ) {
  12011. display = "block";
  12012. }
  12013. defaultDisplayMap[ nodeName ] = display;
  12014. return display;
  12015. }
  12016. function showHide( elements, show ) {
  12017. var display, elem,
  12018. values = [],
  12019. index = 0,
  12020. length = elements.length;
  12021. // Determine new display value for elements that need to change
  12022. for ( ; index < length; index++ ) {
  12023. elem = elements[ index ];
  12024. if ( !elem.style ) {
  12025. continue;
  12026. }
  12027. display = elem.style.display;
  12028. if ( show ) {
  12029. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12030. // check is required in this first loop unless we have a nonempty display value (either
  12031. // inline or about-to-be-restored)
  12032. if ( display === "none" ) {
  12033. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12034. if ( !values[ index ] ) {
  12035. elem.style.display = "";
  12036. }
  12037. }
  12038. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12039. values[ index ] = getDefaultDisplay( elem );
  12040. }
  12041. } else {
  12042. if ( display !== "none" ) {
  12043. values[ index ] = "none";
  12044. // Remember what we're overwriting
  12045. dataPriv.set( elem, "display", display );
  12046. }
  12047. }
  12048. }
  12049. // Set the display of the elements in a second loop to avoid constant reflow
  12050. for ( index = 0; index < length; index++ ) {
  12051. if ( values[ index ] != null ) {
  12052. elements[ index ].style.display = values[ index ];
  12053. }
  12054. }
  12055. return elements;
  12056. }
  12057. jQuery.fn.extend( {
  12058. show: function() {
  12059. return showHide( this, true );
  12060. },
  12061. hide: function() {
  12062. return showHide( this );
  12063. },
  12064. toggle: function( state ) {
  12065. if ( typeof state === "boolean" ) {
  12066. return state ? this.show() : this.hide();
  12067. }
  12068. return this.each( function() {
  12069. if ( isHiddenWithinTree( this ) ) {
  12070. jQuery( this ).show();
  12071. } else {
  12072. jQuery( this ).hide();
  12073. }
  12074. } );
  12075. }
  12076. } );
  12077. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12078. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12079. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12080. // We have to close these tags to support XHTML (#13200)
  12081. var wrapMap = {
  12082. // Support: IE <=9 only
  12083. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12084. // XHTML parsers do not magically insert elements in the
  12085. // same way that tag soup parsers do. So we cannot shorten
  12086. // this by omitting <tbody> or other required elements.
  12087. thead: [ 1, "<table>", "</table>" ],
  12088. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12089. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12090. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12091. _default: [ 0, "", "" ]
  12092. };
  12093. // Support: IE <=9 only
  12094. wrapMap.optgroup = wrapMap.option;
  12095. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12096. wrapMap.th = wrapMap.td;
  12097. function getAll( context, tag ) {
  12098. // Support: IE <=9 - 11 only
  12099. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12100. var ret;
  12101. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12102. ret = context.getElementsByTagName( tag || "*" );
  12103. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12104. ret = context.querySelectorAll( tag || "*" );
  12105. } else {
  12106. ret = [];
  12107. }
  12108. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12109. return jQuery.merge( [ context ], ret );
  12110. }
  12111. return ret;
  12112. }
  12113. // Mark scripts as having already been evaluated
  12114. function setGlobalEval( elems, refElements ) {
  12115. var i = 0,
  12116. l = elems.length;
  12117. for ( ; i < l; i++ ) {
  12118. dataPriv.set(
  12119. elems[ i ],
  12120. "globalEval",
  12121. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12122. );
  12123. }
  12124. }
  12125. var rhtml = /<|&#?\w+;/;
  12126. function buildFragment( elems, context, scripts, selection, ignored ) {
  12127. var elem, tmp, tag, wrap, attached, j,
  12128. fragment = context.createDocumentFragment(),
  12129. nodes = [],
  12130. i = 0,
  12131. l = elems.length;
  12132. for ( ; i < l; i++ ) {
  12133. elem = elems[ i ];
  12134. if ( elem || elem === 0 ) {
  12135. // Add nodes directly
  12136. if ( toType( elem ) === "object" ) {
  12137. // Support: Android <=4.0 only, PhantomJS 1 only
  12138. // push.apply(_, arraylike) throws on ancient WebKit
  12139. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12140. // Convert non-html into a text node
  12141. } else if ( !rhtml.test( elem ) ) {
  12142. nodes.push( context.createTextNode( elem ) );
  12143. // Convert html into DOM nodes
  12144. } else {
  12145. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12146. // Deserialize a standard representation
  12147. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12148. wrap = wrapMap[ tag ] || wrapMap._default;
  12149. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12150. // Descend through wrappers to the right content
  12151. j = wrap[ 0 ];
  12152. while ( j-- ) {
  12153. tmp = tmp.lastChild;
  12154. }
  12155. // Support: Android <=4.0 only, PhantomJS 1 only
  12156. // push.apply(_, arraylike) throws on ancient WebKit
  12157. jQuery.merge( nodes, tmp.childNodes );
  12158. // Remember the top-level container
  12159. tmp = fragment.firstChild;
  12160. // Ensure the created nodes are orphaned (#12392)
  12161. tmp.textContent = "";
  12162. }
  12163. }
  12164. }
  12165. // Remove wrapper from fragment
  12166. fragment.textContent = "";
  12167. i = 0;
  12168. while ( ( elem = nodes[ i++ ] ) ) {
  12169. // Skip elements already in the context collection (trac-4087)
  12170. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12171. if ( ignored ) {
  12172. ignored.push( elem );
  12173. }
  12174. continue;
  12175. }
  12176. attached = isAttached( elem );
  12177. // Append to fragment
  12178. tmp = getAll( fragment.appendChild( elem ), "script" );
  12179. // Preserve script evaluation history
  12180. if ( attached ) {
  12181. setGlobalEval( tmp );
  12182. }
  12183. // Capture executables
  12184. if ( scripts ) {
  12185. j = 0;
  12186. while ( ( elem = tmp[ j++ ] ) ) {
  12187. if ( rscriptType.test( elem.type || "" ) ) {
  12188. scripts.push( elem );
  12189. }
  12190. }
  12191. }
  12192. }
  12193. return fragment;
  12194. }
  12195. ( function() {
  12196. var fragment = document.createDocumentFragment(),
  12197. div = fragment.appendChild( document.createElement( "div" ) ),
  12198. input = document.createElement( "input" );
  12199. // Support: Android 4.0 - 4.3 only
  12200. // Check state lost if the name is set (#11217)
  12201. // Support: Windows Web Apps (WWA)
  12202. // `name` and `type` must use .setAttribute for WWA (#14901)
  12203. input.setAttribute( "type", "radio" );
  12204. input.setAttribute( "checked", "checked" );
  12205. input.setAttribute( "name", "t" );
  12206. div.appendChild( input );
  12207. // Support: Android <=4.1 only
  12208. // Older WebKit doesn't clone checked state correctly in fragments
  12209. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12210. // Support: IE <=11 only
  12211. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12212. div.innerHTML = "<textarea>x</textarea>";
  12213. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12214. } )();
  12215. var
  12216. rkeyEvent = /^key/,
  12217. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12218. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12219. function returnTrue() {
  12220. return true;
  12221. }
  12222. function returnFalse() {
  12223. return false;
  12224. }
  12225. // Support: IE <=9 - 11+
  12226. // focus() and blur() are asynchronous, except when they are no-op.
  12227. // So expect focus to be synchronous when the element is already active,
  12228. // and blur to be synchronous when the element is not already active.
  12229. // (focus and blur are always synchronous in other supported browsers,
  12230. // this just defines when we can count on it).
  12231. function expectSync( elem, type ) {
  12232. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12233. }
  12234. // Support: IE <=9 only
  12235. // Accessing document.activeElement can throw unexpectedly
  12236. // https://bugs.jquery.com/ticket/13393
  12237. function safeActiveElement() {
  12238. try {
  12239. return document.activeElement;
  12240. } catch ( err ) { }
  12241. }
  12242. function on( elem, types, selector, data, fn, one ) {
  12243. var origFn, type;
  12244. // Types can be a map of types/handlers
  12245. if ( typeof types === "object" ) {
  12246. // ( types-Object, selector, data )
  12247. if ( typeof selector !== "string" ) {
  12248. // ( types-Object, data )
  12249. data = data || selector;
  12250. selector = undefined;
  12251. }
  12252. for ( type in types ) {
  12253. on( elem, type, selector, data, types[ type ], one );
  12254. }
  12255. return elem;
  12256. }
  12257. if ( data == null && fn == null ) {
  12258. // ( types, fn )
  12259. fn = selector;
  12260. data = selector = undefined;
  12261. } else if ( fn == null ) {
  12262. if ( typeof selector === "string" ) {
  12263. // ( types, selector, fn )
  12264. fn = data;
  12265. data = undefined;
  12266. } else {
  12267. // ( types, data, fn )
  12268. fn = data;
  12269. data = selector;
  12270. selector = undefined;
  12271. }
  12272. }
  12273. if ( fn === false ) {
  12274. fn = returnFalse;
  12275. } else if ( !fn ) {
  12276. return elem;
  12277. }
  12278. if ( one === 1 ) {
  12279. origFn = fn;
  12280. fn = function( event ) {
  12281. // Can use an empty set, since event contains the info
  12282. jQuery().off( event );
  12283. return origFn.apply( this, arguments );
  12284. };
  12285. // Use same guid so caller can remove using origFn
  12286. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12287. }
  12288. return elem.each( function() {
  12289. jQuery.event.add( this, types, fn, data, selector );
  12290. } );
  12291. }
  12292. /*
  12293. * Helper functions for managing events -- not part of the public interface.
  12294. * Props to Dean Edwards' addEvent library for many of the ideas.
  12295. */
  12296. jQuery.event = {
  12297. global: {},
  12298. add: function( elem, types, handler, data, selector ) {
  12299. var handleObjIn, eventHandle, tmp,
  12300. events, t, handleObj,
  12301. special, handlers, type, namespaces, origType,
  12302. elemData = dataPriv.get( elem );
  12303. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12304. if ( !elemData ) {
  12305. return;
  12306. }
  12307. // Caller can pass in an object of custom data in lieu of the handler
  12308. if ( handler.handler ) {
  12309. handleObjIn = handler;
  12310. handler = handleObjIn.handler;
  12311. selector = handleObjIn.selector;
  12312. }
  12313. // Ensure that invalid selectors throw exceptions at attach time
  12314. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12315. if ( selector ) {
  12316. jQuery.find.matchesSelector( documentElement, selector );
  12317. }
  12318. // Make sure that the handler has a unique ID, used to find/remove it later
  12319. if ( !handler.guid ) {
  12320. handler.guid = jQuery.guid++;
  12321. }
  12322. // Init the element's event structure and main handler, if this is the first
  12323. if ( !( events = elemData.events ) ) {
  12324. events = elemData.events = {};
  12325. }
  12326. if ( !( eventHandle = elemData.handle ) ) {
  12327. eventHandle = elemData.handle = function( e ) {
  12328. // Discard the second event of a jQuery.event.trigger() and
  12329. // when an event is called after a page has unloaded
  12330. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12331. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12332. };
  12333. }
  12334. // Handle multiple events separated by a space
  12335. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12336. t = types.length;
  12337. while ( t-- ) {
  12338. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12339. type = origType = tmp[ 1 ];
  12340. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12341. // There *must* be a type, no attaching namespace-only handlers
  12342. if ( !type ) {
  12343. continue;
  12344. }
  12345. // If event changes its type, use the special event handlers for the changed type
  12346. special = jQuery.event.special[ type ] || {};
  12347. // If selector defined, determine special event api type, otherwise given type
  12348. type = ( selector ? special.delegateType : special.bindType ) || type;
  12349. // Update special based on newly reset type
  12350. special = jQuery.event.special[ type ] || {};
  12351. // handleObj is passed to all event handlers
  12352. handleObj = jQuery.extend( {
  12353. type: type,
  12354. origType: origType,
  12355. data: data,
  12356. handler: handler,
  12357. guid: handler.guid,
  12358. selector: selector,
  12359. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12360. namespace: namespaces.join( "." )
  12361. }, handleObjIn );
  12362. // Init the event handler queue if we're the first
  12363. if ( !( handlers = events[ type ] ) ) {
  12364. handlers = events[ type ] = [];
  12365. handlers.delegateCount = 0;
  12366. // Only use addEventListener if the special events handler returns false
  12367. if ( !special.setup ||
  12368. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12369. if ( elem.addEventListener ) {
  12370. elem.addEventListener( type, eventHandle );
  12371. }
  12372. }
  12373. }
  12374. if ( special.add ) {
  12375. special.add.call( elem, handleObj );
  12376. if ( !handleObj.handler.guid ) {
  12377. handleObj.handler.guid = handler.guid;
  12378. }
  12379. }
  12380. // Add to the element's handler list, delegates in front
  12381. if ( selector ) {
  12382. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12383. } else {
  12384. handlers.push( handleObj );
  12385. }
  12386. // Keep track of which events have ever been used, for event optimization
  12387. jQuery.event.global[ type ] = true;
  12388. }
  12389. },
  12390. // Detach an event or set of events from an element
  12391. remove: function( elem, types, handler, selector, mappedTypes ) {
  12392. var j, origCount, tmp,
  12393. events, t, handleObj,
  12394. special, handlers, type, namespaces, origType,
  12395. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12396. if ( !elemData || !( events = elemData.events ) ) {
  12397. return;
  12398. }
  12399. // Once for each type.namespace in types; type may be omitted
  12400. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12401. t = types.length;
  12402. while ( t-- ) {
  12403. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12404. type = origType = tmp[ 1 ];
  12405. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12406. // Unbind all events (on this namespace, if provided) for the element
  12407. if ( !type ) {
  12408. for ( type in events ) {
  12409. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12410. }
  12411. continue;
  12412. }
  12413. special = jQuery.event.special[ type ] || {};
  12414. type = ( selector ? special.delegateType : special.bindType ) || type;
  12415. handlers = events[ type ] || [];
  12416. tmp = tmp[ 2 ] &&
  12417. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12418. // Remove matching events
  12419. origCount = j = handlers.length;
  12420. while ( j-- ) {
  12421. handleObj = handlers[ j ];
  12422. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12423. ( !handler || handler.guid === handleObj.guid ) &&
  12424. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12425. ( !selector || selector === handleObj.selector ||
  12426. selector === "**" && handleObj.selector ) ) {
  12427. handlers.splice( j, 1 );
  12428. if ( handleObj.selector ) {
  12429. handlers.delegateCount--;
  12430. }
  12431. if ( special.remove ) {
  12432. special.remove.call( elem, handleObj );
  12433. }
  12434. }
  12435. }
  12436. // Remove generic event handler if we removed something and no more handlers exist
  12437. // (avoids potential for endless recursion during removal of special event handlers)
  12438. if ( origCount && !handlers.length ) {
  12439. if ( !special.teardown ||
  12440. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12441. jQuery.removeEvent( elem, type, elemData.handle );
  12442. }
  12443. delete events[ type ];
  12444. }
  12445. }
  12446. // Remove data and the expando if it's no longer used
  12447. if ( jQuery.isEmptyObject( events ) ) {
  12448. dataPriv.remove( elem, "handle events" );
  12449. }
  12450. },
  12451. dispatch: function( nativeEvent ) {
  12452. // Make a writable jQuery.Event from the native event object
  12453. var event = jQuery.event.fix( nativeEvent );
  12454. var i, j, ret, matched, handleObj, handlerQueue,
  12455. args = new Array( arguments.length ),
  12456. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12457. special = jQuery.event.special[ event.type ] || {};
  12458. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12459. args[ 0 ] = event;
  12460. for ( i = 1; i < arguments.length; i++ ) {
  12461. args[ i ] = arguments[ i ];
  12462. }
  12463. event.delegateTarget = this;
  12464. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12465. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12466. return;
  12467. }
  12468. // Determine handlers
  12469. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12470. // Run delegates first; they may want to stop propagation beneath us
  12471. i = 0;
  12472. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12473. event.currentTarget = matched.elem;
  12474. j = 0;
  12475. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12476. !event.isImmediatePropagationStopped() ) {
  12477. // If the event is namespaced, then each handler is only invoked if it is
  12478. // specially universal or its namespaces are a superset of the event's.
  12479. if ( !event.rnamespace || handleObj.namespace === false ||
  12480. event.rnamespace.test( handleObj.namespace ) ) {
  12481. event.handleObj = handleObj;
  12482. event.data = handleObj.data;
  12483. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12484. handleObj.handler ).apply( matched.elem, args );
  12485. if ( ret !== undefined ) {
  12486. if ( ( event.result = ret ) === false ) {
  12487. event.preventDefault();
  12488. event.stopPropagation();
  12489. }
  12490. }
  12491. }
  12492. }
  12493. }
  12494. // Call the postDispatch hook for the mapped type
  12495. if ( special.postDispatch ) {
  12496. special.postDispatch.call( this, event );
  12497. }
  12498. return event.result;
  12499. },
  12500. handlers: function( event, handlers ) {
  12501. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12502. handlerQueue = [],
  12503. delegateCount = handlers.delegateCount,
  12504. cur = event.target;
  12505. // Find delegate handlers
  12506. if ( delegateCount &&
  12507. // Support: IE <=9
  12508. // Black-hole SVG <use> instance trees (trac-13180)
  12509. cur.nodeType &&
  12510. // Support: Firefox <=42
  12511. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12512. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12513. // Support: IE 11 only
  12514. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12515. !( event.type === "click" && event.button >= 1 ) ) {
  12516. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12517. // Don't check non-elements (#13208)
  12518. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12519. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12520. matchedHandlers = [];
  12521. matchedSelectors = {};
  12522. for ( i = 0; i < delegateCount; i++ ) {
  12523. handleObj = handlers[ i ];
  12524. // Don't conflict with Object.prototype properties (#13203)
  12525. sel = handleObj.selector + " ";
  12526. if ( matchedSelectors[ sel ] === undefined ) {
  12527. matchedSelectors[ sel ] = handleObj.needsContext ?
  12528. jQuery( sel, this ).index( cur ) > -1 :
  12529. jQuery.find( sel, this, null, [ cur ] ).length;
  12530. }
  12531. if ( matchedSelectors[ sel ] ) {
  12532. matchedHandlers.push( handleObj );
  12533. }
  12534. }
  12535. if ( matchedHandlers.length ) {
  12536. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12537. }
  12538. }
  12539. }
  12540. }
  12541. // Add the remaining (directly-bound) handlers
  12542. cur = this;
  12543. if ( delegateCount < handlers.length ) {
  12544. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12545. }
  12546. return handlerQueue;
  12547. },
  12548. addProp: function( name, hook ) {
  12549. Object.defineProperty( jQuery.Event.prototype, name, {
  12550. enumerable: true,
  12551. configurable: true,
  12552. get: isFunction( hook ) ?
  12553. function() {
  12554. if ( this.originalEvent ) {
  12555. return hook( this.originalEvent );
  12556. }
  12557. } :
  12558. function() {
  12559. if ( this.originalEvent ) {
  12560. return this.originalEvent[ name ];
  12561. }
  12562. },
  12563. set: function( value ) {
  12564. Object.defineProperty( this, name, {
  12565. enumerable: true,
  12566. configurable: true,
  12567. writable: true,
  12568. value: value
  12569. } );
  12570. }
  12571. } );
  12572. },
  12573. fix: function( originalEvent ) {
  12574. return originalEvent[ jQuery.expando ] ?
  12575. originalEvent :
  12576. new jQuery.Event( originalEvent );
  12577. },
  12578. special: {
  12579. load: {
  12580. // Prevent triggered image.load events from bubbling to window.load
  12581. noBubble: true
  12582. },
  12583. click: {
  12584. // Utilize native event to ensure correct state for checkable inputs
  12585. setup: function( data ) {
  12586. // For mutual compressibility with _default, replace `this` access with a local var.
  12587. // `|| data` is dead code meant only to preserve the variable through minification.
  12588. var el = this || data;
  12589. // Claim the first handler
  12590. if ( rcheckableType.test( el.type ) &&
  12591. el.click && nodeName( el, "input" ) ) {
  12592. // dataPriv.set( el, "click", ... )
  12593. leverageNative( el, "click", returnTrue );
  12594. }
  12595. // Return false to allow normal processing in the caller
  12596. return false;
  12597. },
  12598. trigger: function( data ) {
  12599. // For mutual compressibility with _default, replace `this` access with a local var.
  12600. // `|| data` is dead code meant only to preserve the variable through minification.
  12601. var el = this || data;
  12602. // Force setup before triggering a click
  12603. if ( rcheckableType.test( el.type ) &&
  12604. el.click && nodeName( el, "input" ) ) {
  12605. leverageNative( el, "click" );
  12606. }
  12607. // Return non-false to allow normal event-path propagation
  12608. return true;
  12609. },
  12610. // For cross-browser consistency, suppress native .click() on links
  12611. // Also prevent it if we're currently inside a leveraged native-event stack
  12612. _default: function( event ) {
  12613. var target = event.target;
  12614. return rcheckableType.test( target.type ) &&
  12615. target.click && nodeName( target, "input" ) &&
  12616. dataPriv.get( target, "click" ) ||
  12617. nodeName( target, "a" );
  12618. }
  12619. },
  12620. beforeunload: {
  12621. postDispatch: function( event ) {
  12622. // Support: Firefox 20+
  12623. // Firefox doesn't alert if the returnValue field is not set.
  12624. if ( event.result !== undefined && event.originalEvent ) {
  12625. event.originalEvent.returnValue = event.result;
  12626. }
  12627. }
  12628. }
  12629. }
  12630. };
  12631. // Ensure the presence of an event listener that handles manually-triggered
  12632. // synthetic events by interrupting progress until reinvoked in response to
  12633. // *native* events that it fires directly, ensuring that state changes have
  12634. // already occurred before other listeners are invoked.
  12635. function leverageNative( el, type, expectSync ) {
  12636. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12637. if ( !expectSync ) {
  12638. if ( dataPriv.get( el, type ) === undefined ) {
  12639. jQuery.event.add( el, type, returnTrue );
  12640. }
  12641. return;
  12642. }
  12643. // Register the controller as a special universal handler for all event namespaces
  12644. dataPriv.set( el, type, false );
  12645. jQuery.event.add( el, type, {
  12646. namespace: false,
  12647. handler: function( event ) {
  12648. var notAsync, result,
  12649. saved = dataPriv.get( this, type );
  12650. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12651. // Interrupt processing of the outer synthetic .trigger()ed event
  12652. // Saved data should be false in such cases, but might be a leftover capture object
  12653. // from an async native handler (gh-4350)
  12654. if ( !saved.length ) {
  12655. // Store arguments for use when handling the inner native event
  12656. // There will always be at least one argument (an event object), so this array
  12657. // will not be confused with a leftover capture object.
  12658. saved = slice.call( arguments );
  12659. dataPriv.set( this, type, saved );
  12660. // Trigger the native event and capture its result
  12661. // Support: IE <=9 - 11+
  12662. // focus() and blur() are asynchronous
  12663. notAsync = expectSync( this, type );
  12664. this[ type ]();
  12665. result = dataPriv.get( this, type );
  12666. if ( saved !== result || notAsync ) {
  12667. dataPriv.set( this, type, false );
  12668. } else {
  12669. result = {};
  12670. }
  12671. if ( saved !== result ) {
  12672. // Cancel the outer synthetic event
  12673. event.stopImmediatePropagation();
  12674. event.preventDefault();
  12675. return result.value;
  12676. }
  12677. // If this is an inner synthetic event for an event with a bubbling surrogate
  12678. // (focus or blur), assume that the surrogate already propagated from triggering the
  12679. // native event and prevent that from happening again here.
  12680. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12681. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12682. // less bad than duplication.
  12683. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12684. event.stopPropagation();
  12685. }
  12686. // If this is a native event triggered above, everything is now in order
  12687. // Fire an inner synthetic event with the original arguments
  12688. } else if ( saved.length ) {
  12689. // ...and capture the result
  12690. dataPriv.set( this, type, {
  12691. value: jQuery.event.trigger(
  12692. // Support: IE <=9 - 11+
  12693. // Extend with the prototype to reset the above stopImmediatePropagation()
  12694. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12695. saved.slice( 1 ),
  12696. this
  12697. )
  12698. } );
  12699. // Abort handling of the native event
  12700. event.stopImmediatePropagation();
  12701. }
  12702. }
  12703. } );
  12704. }
  12705. jQuery.removeEvent = function( elem, type, handle ) {
  12706. // This "if" is needed for plain objects
  12707. if ( elem.removeEventListener ) {
  12708. elem.removeEventListener( type, handle );
  12709. }
  12710. };
  12711. jQuery.Event = function( src, props ) {
  12712. // Allow instantiation without the 'new' keyword
  12713. if ( !( this instanceof jQuery.Event ) ) {
  12714. return new jQuery.Event( src, props );
  12715. }
  12716. // Event object
  12717. if ( src && src.type ) {
  12718. this.originalEvent = src;
  12719. this.type = src.type;
  12720. // Events bubbling up the document may have been marked as prevented
  12721. // by a handler lower down the tree; reflect the correct value.
  12722. this.isDefaultPrevented = src.defaultPrevented ||
  12723. src.defaultPrevented === undefined &&
  12724. // Support: Android <=2.3 only
  12725. src.returnValue === false ?
  12726. returnTrue :
  12727. returnFalse;
  12728. // Create target properties
  12729. // Support: Safari <=6 - 7 only
  12730. // Target should not be a text node (#504, #13143)
  12731. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12732. src.target.parentNode :
  12733. src.target;
  12734. this.currentTarget = src.currentTarget;
  12735. this.relatedTarget = src.relatedTarget;
  12736. // Event type
  12737. } else {
  12738. this.type = src;
  12739. }
  12740. // Put explicitly provided properties onto the event object
  12741. if ( props ) {
  12742. jQuery.extend( this, props );
  12743. }
  12744. // Create a timestamp if incoming event doesn't have one
  12745. this.timeStamp = src && src.timeStamp || Date.now();
  12746. // Mark it as fixed
  12747. this[ jQuery.expando ] = true;
  12748. };
  12749. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12750. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12751. jQuery.Event.prototype = {
  12752. constructor: jQuery.Event,
  12753. isDefaultPrevented: returnFalse,
  12754. isPropagationStopped: returnFalse,
  12755. isImmediatePropagationStopped: returnFalse,
  12756. isSimulated: false,
  12757. preventDefault: function() {
  12758. var e = this.originalEvent;
  12759. this.isDefaultPrevented = returnTrue;
  12760. if ( e && !this.isSimulated ) {
  12761. e.preventDefault();
  12762. }
  12763. },
  12764. stopPropagation: function() {
  12765. var e = this.originalEvent;
  12766. this.isPropagationStopped = returnTrue;
  12767. if ( e && !this.isSimulated ) {
  12768. e.stopPropagation();
  12769. }
  12770. },
  12771. stopImmediatePropagation: function() {
  12772. var e = this.originalEvent;
  12773. this.isImmediatePropagationStopped = returnTrue;
  12774. if ( e && !this.isSimulated ) {
  12775. e.stopImmediatePropagation();
  12776. }
  12777. this.stopPropagation();
  12778. }
  12779. };
  12780. // Includes all common event props including KeyEvent and MouseEvent specific props
  12781. jQuery.each( {
  12782. altKey: true,
  12783. bubbles: true,
  12784. cancelable: true,
  12785. changedTouches: true,
  12786. ctrlKey: true,
  12787. detail: true,
  12788. eventPhase: true,
  12789. metaKey: true,
  12790. pageX: true,
  12791. pageY: true,
  12792. shiftKey: true,
  12793. view: true,
  12794. "char": true,
  12795. code: true,
  12796. charCode: true,
  12797. key: true,
  12798. keyCode: true,
  12799. button: true,
  12800. buttons: true,
  12801. clientX: true,
  12802. clientY: true,
  12803. offsetX: true,
  12804. offsetY: true,
  12805. pointerId: true,
  12806. pointerType: true,
  12807. screenX: true,
  12808. screenY: true,
  12809. targetTouches: true,
  12810. toElement: true,
  12811. touches: true,
  12812. which: function( event ) {
  12813. var button = event.button;
  12814. // Add which for key events
  12815. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12816. return event.charCode != null ? event.charCode : event.keyCode;
  12817. }
  12818. // Add which for click: 1 === left; 2 === middle; 3 === right
  12819. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12820. if ( button & 1 ) {
  12821. return 1;
  12822. }
  12823. if ( button & 2 ) {
  12824. return 3;
  12825. }
  12826. if ( button & 4 ) {
  12827. return 2;
  12828. }
  12829. return 0;
  12830. }
  12831. return event.which;
  12832. }
  12833. }, jQuery.event.addProp );
  12834. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12835. jQuery.event.special[ type ] = {
  12836. // Utilize native event if possible so blur/focus sequence is correct
  12837. setup: function() {
  12838. // Claim the first handler
  12839. // dataPriv.set( this, "focus", ... )
  12840. // dataPriv.set( this, "blur", ... )
  12841. leverageNative( this, type, expectSync );
  12842. // Return false to allow normal processing in the caller
  12843. return false;
  12844. },
  12845. trigger: function() {
  12846. // Force setup before trigger
  12847. leverageNative( this, type );
  12848. // Return non-false to allow normal event-path propagation
  12849. return true;
  12850. },
  12851. delegateType: delegateType
  12852. };
  12853. } );
  12854. // Create mouseenter/leave events using mouseover/out and event-time checks
  12855. // so that event delegation works in jQuery.
  12856. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12857. //
  12858. // Support: Safari 7 only
  12859. // Safari sends mouseenter too often; see:
  12860. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12861. // for the description of the bug (it existed in older Chrome versions as well).
  12862. jQuery.each( {
  12863. mouseenter: "mouseover",
  12864. mouseleave: "mouseout",
  12865. pointerenter: "pointerover",
  12866. pointerleave: "pointerout"
  12867. }, function( orig, fix ) {
  12868. jQuery.event.special[ orig ] = {
  12869. delegateType: fix,
  12870. bindType: fix,
  12871. handle: function( event ) {
  12872. var ret,
  12873. target = this,
  12874. related = event.relatedTarget,
  12875. handleObj = event.handleObj;
  12876. // For mouseenter/leave call the handler if related is outside the target.
  12877. // NB: No relatedTarget if the mouse left/entered the browser window
  12878. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12879. event.type = handleObj.origType;
  12880. ret = handleObj.handler.apply( this, arguments );
  12881. event.type = fix;
  12882. }
  12883. return ret;
  12884. }
  12885. };
  12886. } );
  12887. jQuery.fn.extend( {
  12888. on: function( types, selector, data, fn ) {
  12889. return on( this, types, selector, data, fn );
  12890. },
  12891. one: function( types, selector, data, fn ) {
  12892. return on( this, types, selector, data, fn, 1 );
  12893. },
  12894. off: function( types, selector, fn ) {
  12895. var handleObj, type;
  12896. if ( types && types.preventDefault && types.handleObj ) {
  12897. // ( event ) dispatched jQuery.Event
  12898. handleObj = types.handleObj;
  12899. jQuery( types.delegateTarget ).off(
  12900. handleObj.namespace ?
  12901. handleObj.origType + "." + handleObj.namespace :
  12902. handleObj.origType,
  12903. handleObj.selector,
  12904. handleObj.handler
  12905. );
  12906. return this;
  12907. }
  12908. if ( typeof types === "object" ) {
  12909. // ( types-object [, selector] )
  12910. for ( type in types ) {
  12911. this.off( type, selector, types[ type ] );
  12912. }
  12913. return this;
  12914. }
  12915. if ( selector === false || typeof selector === "function" ) {
  12916. // ( types [, fn] )
  12917. fn = selector;
  12918. selector = undefined;
  12919. }
  12920. if ( fn === false ) {
  12921. fn = returnFalse;
  12922. }
  12923. return this.each( function() {
  12924. jQuery.event.remove( this, types, fn, selector );
  12925. } );
  12926. }
  12927. } );
  12928. var
  12929. /* eslint-disable max-len */
  12930. // See https://github.com/eslint/eslint/issues/3229
  12931. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  12932. /* eslint-enable */
  12933. // Support: IE <=10 - 11, Edge 12 - 13 only
  12934. // In IE/Edge using regex groups here causes severe slowdowns.
  12935. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  12936. rnoInnerhtml = /<script|<style|<link/i,
  12937. // checked="checked" or checked
  12938. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  12939. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  12940. // Prefer a tbody over its parent table for containing new rows
  12941. function manipulationTarget( elem, content ) {
  12942. if ( nodeName( elem, "table" ) &&
  12943. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  12944. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  12945. }
  12946. return elem;
  12947. }
  12948. // Replace/restore the type attribute of script elements for safe DOM manipulation
  12949. function disableScript( elem ) {
  12950. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  12951. return elem;
  12952. }
  12953. function restoreScript( elem ) {
  12954. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  12955. elem.type = elem.type.slice( 5 );
  12956. } else {
  12957. elem.removeAttribute( "type" );
  12958. }
  12959. return elem;
  12960. }
  12961. function cloneCopyEvent( src, dest ) {
  12962. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  12963. if ( dest.nodeType !== 1 ) {
  12964. return;
  12965. }
  12966. // 1. Copy private data: events, handlers, etc.
  12967. if ( dataPriv.hasData( src ) ) {
  12968. pdataOld = dataPriv.access( src );
  12969. pdataCur = dataPriv.set( dest, pdataOld );
  12970. events = pdataOld.events;
  12971. if ( events ) {
  12972. delete pdataCur.handle;
  12973. pdataCur.events = {};
  12974. for ( type in events ) {
  12975. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  12976. jQuery.event.add( dest, type, events[ type ][ i ] );
  12977. }
  12978. }
  12979. }
  12980. }
  12981. // 2. Copy user data
  12982. if ( dataUser.hasData( src ) ) {
  12983. udataOld = dataUser.access( src );
  12984. udataCur = jQuery.extend( {}, udataOld );
  12985. dataUser.set( dest, udataCur );
  12986. }
  12987. }
  12988. // Fix IE bugs, see support tests
  12989. function fixInput( src, dest ) {
  12990. var nodeName = dest.nodeName.toLowerCase();
  12991. // Fails to persist the checked state of a cloned checkbox or radio button.
  12992. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  12993. dest.checked = src.checked;
  12994. // Fails to return the selected option to the default selected state when cloning options
  12995. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  12996. dest.defaultValue = src.defaultValue;
  12997. }
  12998. }
  12999. function domManip( collection, args, callback, ignored ) {
  13000. // Flatten any nested arrays
  13001. args = concat.apply( [], args );
  13002. var fragment, first, scripts, hasScripts, node, doc,
  13003. i = 0,
  13004. l = collection.length,
  13005. iNoClone = l - 1,
  13006. value = args[ 0 ],
  13007. valueIsFunction = isFunction( value );
  13008. // We can't cloneNode fragments that contain checked, in WebKit
  13009. if ( valueIsFunction ||
  13010. ( l > 1 && typeof value === "string" &&
  13011. !support.checkClone && rchecked.test( value ) ) ) {
  13012. return collection.each( function( index ) {
  13013. var self = collection.eq( index );
  13014. if ( valueIsFunction ) {
  13015. args[ 0 ] = value.call( this, index, self.html() );
  13016. }
  13017. domManip( self, args, callback, ignored );
  13018. } );
  13019. }
  13020. if ( l ) {
  13021. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13022. first = fragment.firstChild;
  13023. if ( fragment.childNodes.length === 1 ) {
  13024. fragment = first;
  13025. }
  13026. // Require either new content or an interest in ignored elements to invoke the callback
  13027. if ( first || ignored ) {
  13028. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13029. hasScripts = scripts.length;
  13030. // Use the original fragment for the last item
  13031. // instead of the first because it can end up
  13032. // being emptied incorrectly in certain situations (#8070).
  13033. for ( ; i < l; i++ ) {
  13034. node = fragment;
  13035. if ( i !== iNoClone ) {
  13036. node = jQuery.clone( node, true, true );
  13037. // Keep references to cloned scripts for later restoration
  13038. if ( hasScripts ) {
  13039. // Support: Android <=4.0 only, PhantomJS 1 only
  13040. // push.apply(_, arraylike) throws on ancient WebKit
  13041. jQuery.merge( scripts, getAll( node, "script" ) );
  13042. }
  13043. }
  13044. callback.call( collection[ i ], node, i );
  13045. }
  13046. if ( hasScripts ) {
  13047. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13048. // Reenable scripts
  13049. jQuery.map( scripts, restoreScript );
  13050. // Evaluate executable scripts on first document insertion
  13051. for ( i = 0; i < hasScripts; i++ ) {
  13052. node = scripts[ i ];
  13053. if ( rscriptType.test( node.type || "" ) &&
  13054. !dataPriv.access( node, "globalEval" ) &&
  13055. jQuery.contains( doc, node ) ) {
  13056. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13057. // Optional AJAX dependency, but won't run scripts if not present
  13058. if ( jQuery._evalUrl && !node.noModule ) {
  13059. jQuery._evalUrl( node.src, {
  13060. nonce: node.nonce || node.getAttribute( "nonce" )
  13061. } );
  13062. }
  13063. } else {
  13064. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13065. }
  13066. }
  13067. }
  13068. }
  13069. }
  13070. }
  13071. return collection;
  13072. }
  13073. function remove( elem, selector, keepData ) {
  13074. var node,
  13075. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13076. i = 0;
  13077. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13078. if ( !keepData && node.nodeType === 1 ) {
  13079. jQuery.cleanData( getAll( node ) );
  13080. }
  13081. if ( node.parentNode ) {
  13082. if ( keepData && isAttached( node ) ) {
  13083. setGlobalEval( getAll( node, "script" ) );
  13084. }
  13085. node.parentNode.removeChild( node );
  13086. }
  13087. }
  13088. return elem;
  13089. }
  13090. jQuery.extend( {
  13091. htmlPrefilter: function( html ) {
  13092. return html.replace( rxhtmlTag, "<$1></$2>" );
  13093. },
  13094. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13095. var i, l, srcElements, destElements,
  13096. clone = elem.cloneNode( true ),
  13097. inPage = isAttached( elem );
  13098. // Fix IE cloning issues
  13099. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13100. !jQuery.isXMLDoc( elem ) ) {
  13101. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13102. destElements = getAll( clone );
  13103. srcElements = getAll( elem );
  13104. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13105. fixInput( srcElements[ i ], destElements[ i ] );
  13106. }
  13107. }
  13108. // Copy the events from the original to the clone
  13109. if ( dataAndEvents ) {
  13110. if ( deepDataAndEvents ) {
  13111. srcElements = srcElements || getAll( elem );
  13112. destElements = destElements || getAll( clone );
  13113. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13114. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13115. }
  13116. } else {
  13117. cloneCopyEvent( elem, clone );
  13118. }
  13119. }
  13120. // Preserve script evaluation history
  13121. destElements = getAll( clone, "script" );
  13122. if ( destElements.length > 0 ) {
  13123. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13124. }
  13125. // Return the cloned set
  13126. return clone;
  13127. },
  13128. cleanData: function( elems ) {
  13129. var data, elem, type,
  13130. special = jQuery.event.special,
  13131. i = 0;
  13132. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13133. if ( acceptData( elem ) ) {
  13134. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13135. if ( data.events ) {
  13136. for ( type in data.events ) {
  13137. if ( special[ type ] ) {
  13138. jQuery.event.remove( elem, type );
  13139. // This is a shortcut to avoid jQuery.event.remove's overhead
  13140. } else {
  13141. jQuery.removeEvent( elem, type, data.handle );
  13142. }
  13143. }
  13144. }
  13145. // Support: Chrome <=35 - 45+
  13146. // Assign undefined instead of using delete, see Data#remove
  13147. elem[ dataPriv.expando ] = undefined;
  13148. }
  13149. if ( elem[ dataUser.expando ] ) {
  13150. // Support: Chrome <=35 - 45+
  13151. // Assign undefined instead of using delete, see Data#remove
  13152. elem[ dataUser.expando ] = undefined;
  13153. }
  13154. }
  13155. }
  13156. }
  13157. } );
  13158. jQuery.fn.extend( {
  13159. detach: function( selector ) {
  13160. return remove( this, selector, true );
  13161. },
  13162. remove: function( selector ) {
  13163. return remove( this, selector );
  13164. },
  13165. text: function( value ) {
  13166. return access( this, function( value ) {
  13167. return value === undefined ?
  13168. jQuery.text( this ) :
  13169. this.empty().each( function() {
  13170. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13171. this.textContent = value;
  13172. }
  13173. } );
  13174. }, null, value, arguments.length );
  13175. },
  13176. append: function() {
  13177. return domManip( this, arguments, function( elem ) {
  13178. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13179. var target = manipulationTarget( this, elem );
  13180. target.appendChild( elem );
  13181. }
  13182. } );
  13183. },
  13184. prepend: function() {
  13185. return domManip( this, arguments, function( elem ) {
  13186. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13187. var target = manipulationTarget( this, elem );
  13188. target.insertBefore( elem, target.firstChild );
  13189. }
  13190. } );
  13191. },
  13192. before: function() {
  13193. return domManip( this, arguments, function( elem ) {
  13194. if ( this.parentNode ) {
  13195. this.parentNode.insertBefore( elem, this );
  13196. }
  13197. } );
  13198. },
  13199. after: function() {
  13200. return domManip( this, arguments, function( elem ) {
  13201. if ( this.parentNode ) {
  13202. this.parentNode.insertBefore( elem, this.nextSibling );
  13203. }
  13204. } );
  13205. },
  13206. empty: function() {
  13207. var elem,
  13208. i = 0;
  13209. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13210. if ( elem.nodeType === 1 ) {
  13211. // Prevent memory leaks
  13212. jQuery.cleanData( getAll( elem, false ) );
  13213. // Remove any remaining nodes
  13214. elem.textContent = "";
  13215. }
  13216. }
  13217. return this;
  13218. },
  13219. clone: function( dataAndEvents, deepDataAndEvents ) {
  13220. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13221. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13222. return this.map( function() {
  13223. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13224. } );
  13225. },
  13226. html: function( value ) {
  13227. return access( this, function( value ) {
  13228. var elem = this[ 0 ] || {},
  13229. i = 0,
  13230. l = this.length;
  13231. if ( value === undefined && elem.nodeType === 1 ) {
  13232. return elem.innerHTML;
  13233. }
  13234. // See if we can take a shortcut and just use innerHTML
  13235. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13236. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13237. value = jQuery.htmlPrefilter( value );
  13238. try {
  13239. for ( ; i < l; i++ ) {
  13240. elem = this[ i ] || {};
  13241. // Remove element nodes and prevent memory leaks
  13242. if ( elem.nodeType === 1 ) {
  13243. jQuery.cleanData( getAll( elem, false ) );
  13244. elem.innerHTML = value;
  13245. }
  13246. }
  13247. elem = 0;
  13248. // If using innerHTML throws an exception, use the fallback method
  13249. } catch ( e ) {}
  13250. }
  13251. if ( elem ) {
  13252. this.empty().append( value );
  13253. }
  13254. }, null, value, arguments.length );
  13255. },
  13256. replaceWith: function() {
  13257. var ignored = [];
  13258. // Make the changes, replacing each non-ignored context element with the new content
  13259. return domManip( this, arguments, function( elem ) {
  13260. var parent = this.parentNode;
  13261. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13262. jQuery.cleanData( getAll( this ) );
  13263. if ( parent ) {
  13264. parent.replaceChild( elem, this );
  13265. }
  13266. }
  13267. // Force callback invocation
  13268. }, ignored );
  13269. }
  13270. } );
  13271. jQuery.each( {
  13272. appendTo: "append",
  13273. prependTo: "prepend",
  13274. insertBefore: "before",
  13275. insertAfter: "after",
  13276. replaceAll: "replaceWith"
  13277. }, function( name, original ) {
  13278. jQuery.fn[ name ] = function( selector ) {
  13279. var elems,
  13280. ret = [],
  13281. insert = jQuery( selector ),
  13282. last = insert.length - 1,
  13283. i = 0;
  13284. for ( ; i <= last; i++ ) {
  13285. elems = i === last ? this : this.clone( true );
  13286. jQuery( insert[ i ] )[ original ]( elems );
  13287. // Support: Android <=4.0 only, PhantomJS 1 only
  13288. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13289. push.apply( ret, elems.get() );
  13290. }
  13291. return this.pushStack( ret );
  13292. };
  13293. } );
  13294. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13295. var getStyles = function( elem ) {
  13296. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13297. // IE throws on elements created in popups
  13298. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13299. var view = elem.ownerDocument.defaultView;
  13300. if ( !view || !view.opener ) {
  13301. view = window;
  13302. }
  13303. return view.getComputedStyle( elem );
  13304. };
  13305. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13306. ( function() {
  13307. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13308. // so they're executed at the same time to save the second computation.
  13309. function computeStyleTests() {
  13310. // This is a singleton, we need to execute it only once
  13311. if ( !div ) {
  13312. return;
  13313. }
  13314. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13315. "margin-top:1px;padding:0;border:0";
  13316. div.style.cssText =
  13317. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13318. "margin:auto;border:1px;padding:1px;" +
  13319. "width:60%;top:1%";
  13320. documentElement.appendChild( container ).appendChild( div );
  13321. var divStyle = window.getComputedStyle( div );
  13322. pixelPositionVal = divStyle.top !== "1%";
  13323. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13324. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13325. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13326. // Some styles come back with percentage values, even though they shouldn't
  13327. div.style.right = "60%";
  13328. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13329. // Support: IE 9 - 11 only
  13330. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13331. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13332. // Support: IE 9 only
  13333. // Detect overflow:scroll screwiness (gh-3699)
  13334. // Support: Chrome <=64
  13335. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13336. div.style.position = "absolute";
  13337. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13338. documentElement.removeChild( container );
  13339. // Nullify the div so it wouldn't be stored in the memory and
  13340. // it will also be a sign that checks already performed
  13341. div = null;
  13342. }
  13343. function roundPixelMeasures( measure ) {
  13344. return Math.round( parseFloat( measure ) );
  13345. }
  13346. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13347. reliableMarginLeftVal,
  13348. container = document.createElement( "div" ),
  13349. div = document.createElement( "div" );
  13350. // Finish early in limited (non-browser) environments
  13351. if ( !div.style ) {
  13352. return;
  13353. }
  13354. // Support: IE <=9 - 11 only
  13355. // Style of cloned element affects source element cloned (#8908)
  13356. div.style.backgroundClip = "content-box";
  13357. div.cloneNode( true ).style.backgroundClip = "";
  13358. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13359. jQuery.extend( support, {
  13360. boxSizingReliable: function() {
  13361. computeStyleTests();
  13362. return boxSizingReliableVal;
  13363. },
  13364. pixelBoxStyles: function() {
  13365. computeStyleTests();
  13366. return pixelBoxStylesVal;
  13367. },
  13368. pixelPosition: function() {
  13369. computeStyleTests();
  13370. return pixelPositionVal;
  13371. },
  13372. reliableMarginLeft: function() {
  13373. computeStyleTests();
  13374. return reliableMarginLeftVal;
  13375. },
  13376. scrollboxSize: function() {
  13377. computeStyleTests();
  13378. return scrollboxSizeVal;
  13379. }
  13380. } );
  13381. } )();
  13382. function curCSS( elem, name, computed ) {
  13383. var width, minWidth, maxWidth, ret,
  13384. // Support: Firefox 51+
  13385. // Retrieving style before computed somehow
  13386. // fixes an issue with getting wrong values
  13387. // on detached elements
  13388. style = elem.style;
  13389. computed = computed || getStyles( elem );
  13390. // getPropertyValue is needed for:
  13391. // .css('filter') (IE 9 only, #12537)
  13392. // .css('--customProperty) (#3144)
  13393. if ( computed ) {
  13394. ret = computed.getPropertyValue( name ) || computed[ name ];
  13395. if ( ret === "" && !isAttached( elem ) ) {
  13396. ret = jQuery.style( elem, name );
  13397. }
  13398. // A tribute to the "awesome hack by Dean Edwards"
  13399. // Android Browser returns percentage for some values,
  13400. // but width seems to be reliably pixels.
  13401. // This is against the CSSOM draft spec:
  13402. // https://drafts.csswg.org/cssom/#resolved-values
  13403. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13404. // Remember the original values
  13405. width = style.width;
  13406. minWidth = style.minWidth;
  13407. maxWidth = style.maxWidth;
  13408. // Put in the new values to get a computed value out
  13409. style.minWidth = style.maxWidth = style.width = ret;
  13410. ret = computed.width;
  13411. // Revert the changed values
  13412. style.width = width;
  13413. style.minWidth = minWidth;
  13414. style.maxWidth = maxWidth;
  13415. }
  13416. }
  13417. return ret !== undefined ?
  13418. // Support: IE <=9 - 11 only
  13419. // IE returns zIndex value as an integer.
  13420. ret + "" :
  13421. ret;
  13422. }
  13423. function addGetHookIf( conditionFn, hookFn ) {
  13424. // Define the hook, we'll check on the first run if it's really needed.
  13425. return {
  13426. get: function() {
  13427. if ( conditionFn() ) {
  13428. // Hook not needed (or it's not possible to use it due
  13429. // to missing dependency), remove it.
  13430. delete this.get;
  13431. return;
  13432. }
  13433. // Hook needed; redefine it so that the support test is not executed again.
  13434. return ( this.get = hookFn ).apply( this, arguments );
  13435. }
  13436. };
  13437. }
  13438. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13439. emptyStyle = document.createElement( "div" ).style,
  13440. vendorProps = {};
  13441. // Return a vendor-prefixed property or undefined
  13442. function vendorPropName( name ) {
  13443. // Check for vendor prefixed names
  13444. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13445. i = cssPrefixes.length;
  13446. while ( i-- ) {
  13447. name = cssPrefixes[ i ] + capName;
  13448. if ( name in emptyStyle ) {
  13449. return name;
  13450. }
  13451. }
  13452. }
  13453. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13454. function finalPropName( name ) {
  13455. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13456. if ( final ) {
  13457. return final;
  13458. }
  13459. if ( name in emptyStyle ) {
  13460. return name;
  13461. }
  13462. return vendorProps[ name ] = vendorPropName( name ) || name;
  13463. }
  13464. var
  13465. // Swappable if display is none or starts with table
  13466. // except "table", "table-cell", or "table-caption"
  13467. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13468. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13469. rcustomProp = /^--/,
  13470. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13471. cssNormalTransform = {
  13472. letterSpacing: "0",
  13473. fontWeight: "400"
  13474. };
  13475. function setPositiveNumber( elem, value, subtract ) {
  13476. // Any relative (+/-) values have already been
  13477. // normalized at this point
  13478. var matches = rcssNum.exec( value );
  13479. return matches ?
  13480. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13481. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13482. value;
  13483. }
  13484. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13485. var i = dimension === "width" ? 1 : 0,
  13486. extra = 0,
  13487. delta = 0;
  13488. // Adjustment may not be necessary
  13489. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13490. return 0;
  13491. }
  13492. for ( ; i < 4; i += 2 ) {
  13493. // Both box models exclude margin
  13494. if ( box === "margin" ) {
  13495. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13496. }
  13497. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13498. if ( !isBorderBox ) {
  13499. // Add padding
  13500. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13501. // For "border" or "margin", add border
  13502. if ( box !== "padding" ) {
  13503. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13504. // But still keep track of it otherwise
  13505. } else {
  13506. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13507. }
  13508. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13509. // "padding" or "margin"
  13510. } else {
  13511. // For "content", subtract padding
  13512. if ( box === "content" ) {
  13513. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13514. }
  13515. // For "content" or "padding", subtract border
  13516. if ( box !== "margin" ) {
  13517. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13518. }
  13519. }
  13520. }
  13521. // Account for positive content-box scroll gutter when requested by providing computedVal
  13522. if ( !isBorderBox && computedVal >= 0 ) {
  13523. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13524. // Assuming integer scroll gutter, subtract the rest and round down
  13525. delta += Math.max( 0, Math.ceil(
  13526. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13527. computedVal -
  13528. delta -
  13529. extra -
  13530. 0.5
  13531. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13532. // Use an explicit zero to avoid NaN (gh-3964)
  13533. ) ) || 0;
  13534. }
  13535. return delta;
  13536. }
  13537. function getWidthOrHeight( elem, dimension, extra ) {
  13538. // Start with computed style
  13539. var styles = getStyles( elem ),
  13540. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13541. // Fake content-box until we know it's needed to know the true value.
  13542. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13543. isBorderBox = boxSizingNeeded &&
  13544. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13545. valueIsBorderBox = isBorderBox,
  13546. val = curCSS( elem, dimension, styles ),
  13547. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13548. // Support: Firefox <=54
  13549. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13550. if ( rnumnonpx.test( val ) ) {
  13551. if ( !extra ) {
  13552. return val;
  13553. }
  13554. val = "auto";
  13555. }
  13556. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13557. // This happens for inline elements with no explicit setting (gh-3571)
  13558. // Support: Android <=4.1 - 4.3 only
  13559. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13560. // Support: IE 9-11 only
  13561. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13562. // We use getClientRects() to check for hidden/disconnected.
  13563. // In those cases, the computed value can be trusted to be border-box
  13564. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13565. val === "auto" ||
  13566. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13567. elem.getClientRects().length ) {
  13568. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13569. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13570. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13571. // retrieved value as a content box dimension.
  13572. valueIsBorderBox = offsetProp in elem;
  13573. if ( valueIsBorderBox ) {
  13574. val = elem[ offsetProp ];
  13575. }
  13576. }
  13577. // Normalize "" and auto
  13578. val = parseFloat( val ) || 0;
  13579. // Adjust for the element's box model
  13580. return ( val +
  13581. boxModelAdjustment(
  13582. elem,
  13583. dimension,
  13584. extra || ( isBorderBox ? "border" : "content" ),
  13585. valueIsBorderBox,
  13586. styles,
  13587. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13588. val
  13589. )
  13590. ) + "px";
  13591. }
  13592. jQuery.extend( {
  13593. // Add in style property hooks for overriding the default
  13594. // behavior of getting and setting a style property
  13595. cssHooks: {
  13596. opacity: {
  13597. get: function( elem, computed ) {
  13598. if ( computed ) {
  13599. // We should always get a number back from opacity
  13600. var ret = curCSS( elem, "opacity" );
  13601. return ret === "" ? "1" : ret;
  13602. }
  13603. }
  13604. }
  13605. },
  13606. // Don't automatically add "px" to these possibly-unitless properties
  13607. cssNumber: {
  13608. "animationIterationCount": true,
  13609. "columnCount": true,
  13610. "fillOpacity": true,
  13611. "flexGrow": true,
  13612. "flexShrink": true,
  13613. "fontWeight": true,
  13614. "gridArea": true,
  13615. "gridColumn": true,
  13616. "gridColumnEnd": true,
  13617. "gridColumnStart": true,
  13618. "gridRow": true,
  13619. "gridRowEnd": true,
  13620. "gridRowStart": true,
  13621. "lineHeight": true,
  13622. "opacity": true,
  13623. "order": true,
  13624. "orphans": true,
  13625. "widows": true,
  13626. "zIndex": true,
  13627. "zoom": true
  13628. },
  13629. // Add in properties whose names you wish to fix before
  13630. // setting or getting the value
  13631. cssProps: {},
  13632. // Get and set the style property on a DOM Node
  13633. style: function( elem, name, value, extra ) {
  13634. // Don't set styles on text and comment nodes
  13635. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13636. return;
  13637. }
  13638. // Make sure that we're working with the right name
  13639. var ret, type, hooks,
  13640. origName = camelCase( name ),
  13641. isCustomProp = rcustomProp.test( name ),
  13642. style = elem.style;
  13643. // Make sure that we're working with the right name. We don't
  13644. // want to query the value if it is a CSS custom property
  13645. // since they are user-defined.
  13646. if ( !isCustomProp ) {
  13647. name = finalPropName( origName );
  13648. }
  13649. // Gets hook for the prefixed version, then unprefixed version
  13650. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13651. // Check if we're setting a value
  13652. if ( value !== undefined ) {
  13653. type = typeof value;
  13654. // Convert "+=" or "-=" to relative numbers (#7345)
  13655. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13656. value = adjustCSS( elem, name, ret );
  13657. // Fixes bug #9237
  13658. type = "number";
  13659. }
  13660. // Make sure that null and NaN values aren't set (#7116)
  13661. if ( value == null || value !== value ) {
  13662. return;
  13663. }
  13664. // If a number was passed in, add the unit (except for certain CSS properties)
  13665. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13666. // "px" to a few hardcoded values.
  13667. if ( type === "number" && !isCustomProp ) {
  13668. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13669. }
  13670. // background-* props affect original clone's values
  13671. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13672. style[ name ] = "inherit";
  13673. }
  13674. // If a hook was provided, use that value, otherwise just set the specified value
  13675. if ( !hooks || !( "set" in hooks ) ||
  13676. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13677. if ( isCustomProp ) {
  13678. style.setProperty( name, value );
  13679. } else {
  13680. style[ name ] = value;
  13681. }
  13682. }
  13683. } else {
  13684. // If a hook was provided get the non-computed value from there
  13685. if ( hooks && "get" in hooks &&
  13686. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13687. return ret;
  13688. }
  13689. // Otherwise just get the value from the style object
  13690. return style[ name ];
  13691. }
  13692. },
  13693. css: function( elem, name, extra, styles ) {
  13694. var val, num, hooks,
  13695. origName = camelCase( name ),
  13696. isCustomProp = rcustomProp.test( name );
  13697. // Make sure that we're working with the right name. We don't
  13698. // want to modify the value if it is a CSS custom property
  13699. // since they are user-defined.
  13700. if ( !isCustomProp ) {
  13701. name = finalPropName( origName );
  13702. }
  13703. // Try prefixed name followed by the unprefixed name
  13704. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13705. // If a hook was provided get the computed value from there
  13706. if ( hooks && "get" in hooks ) {
  13707. val = hooks.get( elem, true, extra );
  13708. }
  13709. // Otherwise, if a way to get the computed value exists, use that
  13710. if ( val === undefined ) {
  13711. val = curCSS( elem, name, styles );
  13712. }
  13713. // Convert "normal" to computed value
  13714. if ( val === "normal" && name in cssNormalTransform ) {
  13715. val = cssNormalTransform[ name ];
  13716. }
  13717. // Make numeric if forced or a qualifier was provided and val looks numeric
  13718. if ( extra === "" || extra ) {
  13719. num = parseFloat( val );
  13720. return extra === true || isFinite( num ) ? num || 0 : val;
  13721. }
  13722. return val;
  13723. }
  13724. } );
  13725. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13726. jQuery.cssHooks[ dimension ] = {
  13727. get: function( elem, computed, extra ) {
  13728. if ( computed ) {
  13729. // Certain elements can have dimension info if we invisibly show them
  13730. // but it must have a current display style that would benefit
  13731. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13732. // Support: Safari 8+
  13733. // Table columns in Safari have non-zero offsetWidth & zero
  13734. // getBoundingClientRect().width unless display is changed.
  13735. // Support: IE <=11 only
  13736. // Running getBoundingClientRect on a disconnected node
  13737. // in IE throws an error.
  13738. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13739. swap( elem, cssShow, function() {
  13740. return getWidthOrHeight( elem, dimension, extra );
  13741. } ) :
  13742. getWidthOrHeight( elem, dimension, extra );
  13743. }
  13744. },
  13745. set: function( elem, value, extra ) {
  13746. var matches,
  13747. styles = getStyles( elem ),
  13748. // Only read styles.position if the test has a chance to fail
  13749. // to avoid forcing a reflow.
  13750. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13751. styles.position === "absolute",
  13752. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13753. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13754. isBorderBox = boxSizingNeeded &&
  13755. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13756. subtract = extra ?
  13757. boxModelAdjustment(
  13758. elem,
  13759. dimension,
  13760. extra,
  13761. isBorderBox,
  13762. styles
  13763. ) :
  13764. 0;
  13765. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13766. // faking a content-box to get border and padding (gh-3699)
  13767. if ( isBorderBox && scrollboxSizeBuggy ) {
  13768. subtract -= Math.ceil(
  13769. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13770. parseFloat( styles[ dimension ] ) -
  13771. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13772. 0.5
  13773. );
  13774. }
  13775. // Convert to pixels if value adjustment is needed
  13776. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13777. ( matches[ 3 ] || "px" ) !== "px" ) {
  13778. elem.style[ dimension ] = value;
  13779. value = jQuery.css( elem, dimension );
  13780. }
  13781. return setPositiveNumber( elem, value, subtract );
  13782. }
  13783. };
  13784. } );
  13785. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13786. function( elem, computed ) {
  13787. if ( computed ) {
  13788. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13789. elem.getBoundingClientRect().left -
  13790. swap( elem, { marginLeft: 0 }, function() {
  13791. return elem.getBoundingClientRect().left;
  13792. } )
  13793. ) + "px";
  13794. }
  13795. }
  13796. );
  13797. // These hooks are used by animate to expand properties
  13798. jQuery.each( {
  13799. margin: "",
  13800. padding: "",
  13801. border: "Width"
  13802. }, function( prefix, suffix ) {
  13803. jQuery.cssHooks[ prefix + suffix ] = {
  13804. expand: function( value ) {
  13805. var i = 0,
  13806. expanded = {},
  13807. // Assumes a single number if not a string
  13808. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13809. for ( ; i < 4; i++ ) {
  13810. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13811. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13812. }
  13813. return expanded;
  13814. }
  13815. };
  13816. if ( prefix !== "margin" ) {
  13817. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13818. }
  13819. } );
  13820. jQuery.fn.extend( {
  13821. css: function( name, value ) {
  13822. return access( this, function( elem, name, value ) {
  13823. var styles, len,
  13824. map = {},
  13825. i = 0;
  13826. if ( Array.isArray( name ) ) {
  13827. styles = getStyles( elem );
  13828. len = name.length;
  13829. for ( ; i < len; i++ ) {
  13830. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13831. }
  13832. return map;
  13833. }
  13834. return value !== undefined ?
  13835. jQuery.style( elem, name, value ) :
  13836. jQuery.css( elem, name );
  13837. }, name, value, arguments.length > 1 );
  13838. }
  13839. } );
  13840. function Tween( elem, options, prop, end, easing ) {
  13841. return new Tween.prototype.init( elem, options, prop, end, easing );
  13842. }
  13843. jQuery.Tween = Tween;
  13844. Tween.prototype = {
  13845. constructor: Tween,
  13846. init: function( elem, options, prop, end, easing, unit ) {
  13847. this.elem = elem;
  13848. this.prop = prop;
  13849. this.easing = easing || jQuery.easing._default;
  13850. this.options = options;
  13851. this.start = this.now = this.cur();
  13852. this.end = end;
  13853. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13854. },
  13855. cur: function() {
  13856. var hooks = Tween.propHooks[ this.prop ];
  13857. return hooks && hooks.get ?
  13858. hooks.get( this ) :
  13859. Tween.propHooks._default.get( this );
  13860. },
  13861. run: function( percent ) {
  13862. var eased,
  13863. hooks = Tween.propHooks[ this.prop ];
  13864. if ( this.options.duration ) {
  13865. this.pos = eased = jQuery.easing[ this.easing ](
  13866. percent, this.options.duration * percent, 0, 1, this.options.duration
  13867. );
  13868. } else {
  13869. this.pos = eased = percent;
  13870. }
  13871. this.now = ( this.end - this.start ) * eased + this.start;
  13872. if ( this.options.step ) {
  13873. this.options.step.call( this.elem, this.now, this );
  13874. }
  13875. if ( hooks && hooks.set ) {
  13876. hooks.set( this );
  13877. } else {
  13878. Tween.propHooks._default.set( this );
  13879. }
  13880. return this;
  13881. }
  13882. };
  13883. Tween.prototype.init.prototype = Tween.prototype;
  13884. Tween.propHooks = {
  13885. _default: {
  13886. get: function( tween ) {
  13887. var result;
  13888. // Use a property on the element directly when it is not a DOM element,
  13889. // or when there is no matching style property that exists.
  13890. if ( tween.elem.nodeType !== 1 ||
  13891. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13892. return tween.elem[ tween.prop ];
  13893. }
  13894. // Passing an empty string as a 3rd parameter to .css will automatically
  13895. // attempt a parseFloat and fallback to a string if the parse fails.
  13896. // Simple values such as "10px" are parsed to Float;
  13897. // complex values such as "rotate(1rad)" are returned as-is.
  13898. result = jQuery.css( tween.elem, tween.prop, "" );
  13899. // Empty strings, null, undefined and "auto" are converted to 0.
  13900. return !result || result === "auto" ? 0 : result;
  13901. },
  13902. set: function( tween ) {
  13903. // Use step hook for back compat.
  13904. // Use cssHook if its there.
  13905. // Use .style if available and use plain properties where available.
  13906. if ( jQuery.fx.step[ tween.prop ] ) {
  13907. jQuery.fx.step[ tween.prop ]( tween );
  13908. } else if ( tween.elem.nodeType === 1 && (
  13909. jQuery.cssHooks[ tween.prop ] ||
  13910. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13911. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13912. } else {
  13913. tween.elem[ tween.prop ] = tween.now;
  13914. }
  13915. }
  13916. }
  13917. };
  13918. // Support: IE <=9 only
  13919. // Panic based approach to setting things on disconnected nodes
  13920. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13921. set: function( tween ) {
  13922. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13923. tween.elem[ tween.prop ] = tween.now;
  13924. }
  13925. }
  13926. };
  13927. jQuery.easing = {
  13928. linear: function( p ) {
  13929. return p;
  13930. },
  13931. swing: function( p ) {
  13932. return 0.5 - Math.cos( p * Math.PI ) / 2;
  13933. },
  13934. _default: "swing"
  13935. };
  13936. jQuery.fx = Tween.prototype.init;
  13937. // Back compat <1.8 extension point
  13938. jQuery.fx.step = {};
  13939. var
  13940. fxNow, inProgress,
  13941. rfxtypes = /^(?:toggle|show|hide)$/,
  13942. rrun = /queueHooks$/;
  13943. function schedule() {
  13944. if ( inProgress ) {
  13945. if ( document.hidden === false && window.requestAnimationFrame ) {
  13946. window.requestAnimationFrame( schedule );
  13947. } else {
  13948. window.setTimeout( schedule, jQuery.fx.interval );
  13949. }
  13950. jQuery.fx.tick();
  13951. }
  13952. }
  13953. // Animations created synchronously will run synchronously
  13954. function createFxNow() {
  13955. window.setTimeout( function() {
  13956. fxNow = undefined;
  13957. } );
  13958. return ( fxNow = Date.now() );
  13959. }
  13960. // Generate parameters to create a standard animation
  13961. function genFx( type, includeWidth ) {
  13962. var which,
  13963. i = 0,
  13964. attrs = { height: type };
  13965. // If we include width, step value is 1 to do all cssExpand values,
  13966. // otherwise step value is 2 to skip over Left and Right
  13967. includeWidth = includeWidth ? 1 : 0;
  13968. for ( ; i < 4; i += 2 - includeWidth ) {
  13969. which = cssExpand[ i ];
  13970. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  13971. }
  13972. if ( includeWidth ) {
  13973. attrs.opacity = attrs.width = type;
  13974. }
  13975. return attrs;
  13976. }
  13977. function createTween( value, prop, animation ) {
  13978. var tween,
  13979. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  13980. index = 0,
  13981. length = collection.length;
  13982. for ( ; index < length; index++ ) {
  13983. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  13984. // We're done with this property
  13985. return tween;
  13986. }
  13987. }
  13988. }
  13989. function defaultPrefilter( elem, props, opts ) {
  13990. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  13991. isBox = "width" in props || "height" in props,
  13992. anim = this,
  13993. orig = {},
  13994. style = elem.style,
  13995. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  13996. dataShow = dataPriv.get( elem, "fxshow" );
  13997. // Queue-skipping animations hijack the fx hooks
  13998. if ( !opts.queue ) {
  13999. hooks = jQuery._queueHooks( elem, "fx" );
  14000. if ( hooks.unqueued == null ) {
  14001. hooks.unqueued = 0;
  14002. oldfire = hooks.empty.fire;
  14003. hooks.empty.fire = function() {
  14004. if ( !hooks.unqueued ) {
  14005. oldfire();
  14006. }
  14007. };
  14008. }
  14009. hooks.unqueued++;
  14010. anim.always( function() {
  14011. // Ensure the complete handler is called before this completes
  14012. anim.always( function() {
  14013. hooks.unqueued--;
  14014. if ( !jQuery.queue( elem, "fx" ).length ) {
  14015. hooks.empty.fire();
  14016. }
  14017. } );
  14018. } );
  14019. }
  14020. // Detect show/hide animations
  14021. for ( prop in props ) {
  14022. value = props[ prop ];
  14023. if ( rfxtypes.test( value ) ) {
  14024. delete props[ prop ];
  14025. toggle = toggle || value === "toggle";
  14026. if ( value === ( hidden ? "hide" : "show" ) ) {
  14027. // Pretend to be hidden if this is a "show" and
  14028. // there is still data from a stopped show/hide
  14029. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14030. hidden = true;
  14031. // Ignore all other no-op show/hide data
  14032. } else {
  14033. continue;
  14034. }
  14035. }
  14036. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14037. }
  14038. }
  14039. // Bail out if this is a no-op like .hide().hide()
  14040. propTween = !jQuery.isEmptyObject( props );
  14041. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14042. return;
  14043. }
  14044. // Restrict "overflow" and "display" styles during box animations
  14045. if ( isBox && elem.nodeType === 1 ) {
  14046. // Support: IE <=9 - 11, Edge 12 - 15
  14047. // Record all 3 overflow attributes because IE does not infer the shorthand
  14048. // from identically-valued overflowX and overflowY and Edge just mirrors
  14049. // the overflowX value there.
  14050. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14051. // Identify a display type, preferring old show/hide data over the CSS cascade
  14052. restoreDisplay = dataShow && dataShow.display;
  14053. if ( restoreDisplay == null ) {
  14054. restoreDisplay = dataPriv.get( elem, "display" );
  14055. }
  14056. display = jQuery.css( elem, "display" );
  14057. if ( display === "none" ) {
  14058. if ( restoreDisplay ) {
  14059. display = restoreDisplay;
  14060. } else {
  14061. // Get nonempty value(s) by temporarily forcing visibility
  14062. showHide( [ elem ], true );
  14063. restoreDisplay = elem.style.display || restoreDisplay;
  14064. display = jQuery.css( elem, "display" );
  14065. showHide( [ elem ] );
  14066. }
  14067. }
  14068. // Animate inline elements as inline-block
  14069. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14070. if ( jQuery.css( elem, "float" ) === "none" ) {
  14071. // Restore the original display value at the end of pure show/hide animations
  14072. if ( !propTween ) {
  14073. anim.done( function() {
  14074. style.display = restoreDisplay;
  14075. } );
  14076. if ( restoreDisplay == null ) {
  14077. display = style.display;
  14078. restoreDisplay = display === "none" ? "" : display;
  14079. }
  14080. }
  14081. style.display = "inline-block";
  14082. }
  14083. }
  14084. }
  14085. if ( opts.overflow ) {
  14086. style.overflow = "hidden";
  14087. anim.always( function() {
  14088. style.overflow = opts.overflow[ 0 ];
  14089. style.overflowX = opts.overflow[ 1 ];
  14090. style.overflowY = opts.overflow[ 2 ];
  14091. } );
  14092. }
  14093. // Implement show/hide animations
  14094. propTween = false;
  14095. for ( prop in orig ) {
  14096. // General show/hide setup for this element animation
  14097. if ( !propTween ) {
  14098. if ( dataShow ) {
  14099. if ( "hidden" in dataShow ) {
  14100. hidden = dataShow.hidden;
  14101. }
  14102. } else {
  14103. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14104. }
  14105. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14106. if ( toggle ) {
  14107. dataShow.hidden = !hidden;
  14108. }
  14109. // Show elements before animating them
  14110. if ( hidden ) {
  14111. showHide( [ elem ], true );
  14112. }
  14113. /* eslint-disable no-loop-func */
  14114. anim.done( function() {
  14115. /* eslint-enable no-loop-func */
  14116. // The final step of a "hide" animation is actually hiding the element
  14117. if ( !hidden ) {
  14118. showHide( [ elem ] );
  14119. }
  14120. dataPriv.remove( elem, "fxshow" );
  14121. for ( prop in orig ) {
  14122. jQuery.style( elem, prop, orig[ prop ] );
  14123. }
  14124. } );
  14125. }
  14126. // Per-property setup
  14127. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14128. if ( !( prop in dataShow ) ) {
  14129. dataShow[ prop ] = propTween.start;
  14130. if ( hidden ) {
  14131. propTween.end = propTween.start;
  14132. propTween.start = 0;
  14133. }
  14134. }
  14135. }
  14136. }
  14137. function propFilter( props, specialEasing ) {
  14138. var index, name, easing, value, hooks;
  14139. // camelCase, specialEasing and expand cssHook pass
  14140. for ( index in props ) {
  14141. name = camelCase( index );
  14142. easing = specialEasing[ name ];
  14143. value = props[ index ];
  14144. if ( Array.isArray( value ) ) {
  14145. easing = value[ 1 ];
  14146. value = props[ index ] = value[ 0 ];
  14147. }
  14148. if ( index !== name ) {
  14149. props[ name ] = value;
  14150. delete props[ index ];
  14151. }
  14152. hooks = jQuery.cssHooks[ name ];
  14153. if ( hooks && "expand" in hooks ) {
  14154. value = hooks.expand( value );
  14155. delete props[ name ];
  14156. // Not quite $.extend, this won't overwrite existing keys.
  14157. // Reusing 'index' because we have the correct "name"
  14158. for ( index in value ) {
  14159. if ( !( index in props ) ) {
  14160. props[ index ] = value[ index ];
  14161. specialEasing[ index ] = easing;
  14162. }
  14163. }
  14164. } else {
  14165. specialEasing[ name ] = easing;
  14166. }
  14167. }
  14168. }
  14169. function Animation( elem, properties, options ) {
  14170. var result,
  14171. stopped,
  14172. index = 0,
  14173. length = Animation.prefilters.length,
  14174. deferred = jQuery.Deferred().always( function() {
  14175. // Don't match elem in the :animated selector
  14176. delete tick.elem;
  14177. } ),
  14178. tick = function() {
  14179. if ( stopped ) {
  14180. return false;
  14181. }
  14182. var currentTime = fxNow || createFxNow(),
  14183. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14184. // Support: Android 2.3 only
  14185. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14186. temp = remaining / animation.duration || 0,
  14187. percent = 1 - temp,
  14188. index = 0,
  14189. length = animation.tweens.length;
  14190. for ( ; index < length; index++ ) {
  14191. animation.tweens[ index ].run( percent );
  14192. }
  14193. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14194. // If there's more to do, yield
  14195. if ( percent < 1 && length ) {
  14196. return remaining;
  14197. }
  14198. // If this was an empty animation, synthesize a final progress notification
  14199. if ( !length ) {
  14200. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14201. }
  14202. // Resolve the animation and report its conclusion
  14203. deferred.resolveWith( elem, [ animation ] );
  14204. return false;
  14205. },
  14206. animation = deferred.promise( {
  14207. elem: elem,
  14208. props: jQuery.extend( {}, properties ),
  14209. opts: jQuery.extend( true, {
  14210. specialEasing: {},
  14211. easing: jQuery.easing._default
  14212. }, options ),
  14213. originalProperties: properties,
  14214. originalOptions: options,
  14215. startTime: fxNow || createFxNow(),
  14216. duration: options.duration,
  14217. tweens: [],
  14218. createTween: function( prop, end ) {
  14219. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14220. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14221. animation.tweens.push( tween );
  14222. return tween;
  14223. },
  14224. stop: function( gotoEnd ) {
  14225. var index = 0,
  14226. // If we are going to the end, we want to run all the tweens
  14227. // otherwise we skip this part
  14228. length = gotoEnd ? animation.tweens.length : 0;
  14229. if ( stopped ) {
  14230. return this;
  14231. }
  14232. stopped = true;
  14233. for ( ; index < length; index++ ) {
  14234. animation.tweens[ index ].run( 1 );
  14235. }
  14236. // Resolve when we played the last frame; otherwise, reject
  14237. if ( gotoEnd ) {
  14238. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14239. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14240. } else {
  14241. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14242. }
  14243. return this;
  14244. }
  14245. } ),
  14246. props = animation.props;
  14247. propFilter( props, animation.opts.specialEasing );
  14248. for ( ; index < length; index++ ) {
  14249. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14250. if ( result ) {
  14251. if ( isFunction( result.stop ) ) {
  14252. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14253. result.stop.bind( result );
  14254. }
  14255. return result;
  14256. }
  14257. }
  14258. jQuery.map( props, createTween, animation );
  14259. if ( isFunction( animation.opts.start ) ) {
  14260. animation.opts.start.call( elem, animation );
  14261. }
  14262. // Attach callbacks from options
  14263. animation
  14264. .progress( animation.opts.progress )
  14265. .done( animation.opts.done, animation.opts.complete )
  14266. .fail( animation.opts.fail )
  14267. .always( animation.opts.always );
  14268. jQuery.fx.timer(
  14269. jQuery.extend( tick, {
  14270. elem: elem,
  14271. anim: animation,
  14272. queue: animation.opts.queue
  14273. } )
  14274. );
  14275. return animation;
  14276. }
  14277. jQuery.Animation = jQuery.extend( Animation, {
  14278. tweeners: {
  14279. "*": [ function( prop, value ) {
  14280. var tween = this.createTween( prop, value );
  14281. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14282. return tween;
  14283. } ]
  14284. },
  14285. tweener: function( props, callback ) {
  14286. if ( isFunction( props ) ) {
  14287. callback = props;
  14288. props = [ "*" ];
  14289. } else {
  14290. props = props.match( rnothtmlwhite );
  14291. }
  14292. var prop,
  14293. index = 0,
  14294. length = props.length;
  14295. for ( ; index < length; index++ ) {
  14296. prop = props[ index ];
  14297. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14298. Animation.tweeners[ prop ].unshift( callback );
  14299. }
  14300. },
  14301. prefilters: [ defaultPrefilter ],
  14302. prefilter: function( callback, prepend ) {
  14303. if ( prepend ) {
  14304. Animation.prefilters.unshift( callback );
  14305. } else {
  14306. Animation.prefilters.push( callback );
  14307. }
  14308. }
  14309. } );
  14310. jQuery.speed = function( speed, easing, fn ) {
  14311. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14312. complete: fn || !fn && easing ||
  14313. isFunction( speed ) && speed,
  14314. duration: speed,
  14315. easing: fn && easing || easing && !isFunction( easing ) && easing
  14316. };
  14317. // Go to the end state if fx are off
  14318. if ( jQuery.fx.off ) {
  14319. opt.duration = 0;
  14320. } else {
  14321. if ( typeof opt.duration !== "number" ) {
  14322. if ( opt.duration in jQuery.fx.speeds ) {
  14323. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14324. } else {
  14325. opt.duration = jQuery.fx.speeds._default;
  14326. }
  14327. }
  14328. }
  14329. // Normalize opt.queue - true/undefined/null -> "fx"
  14330. if ( opt.queue == null || opt.queue === true ) {
  14331. opt.queue = "fx";
  14332. }
  14333. // Queueing
  14334. opt.old = opt.complete;
  14335. opt.complete = function() {
  14336. if ( isFunction( opt.old ) ) {
  14337. opt.old.call( this );
  14338. }
  14339. if ( opt.queue ) {
  14340. jQuery.dequeue( this, opt.queue );
  14341. }
  14342. };
  14343. return opt;
  14344. };
  14345. jQuery.fn.extend( {
  14346. fadeTo: function( speed, to, easing, callback ) {
  14347. // Show any hidden elements after setting opacity to 0
  14348. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14349. // Animate to the value specified
  14350. .end().animate( { opacity: to }, speed, easing, callback );
  14351. },
  14352. animate: function( prop, speed, easing, callback ) {
  14353. var empty = jQuery.isEmptyObject( prop ),
  14354. optall = jQuery.speed( speed, easing, callback ),
  14355. doAnimation = function() {
  14356. // Operate on a copy of prop so per-property easing won't be lost
  14357. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14358. // Empty animations, or finishing resolves immediately
  14359. if ( empty || dataPriv.get( this, "finish" ) ) {
  14360. anim.stop( true );
  14361. }
  14362. };
  14363. doAnimation.finish = doAnimation;
  14364. return empty || optall.queue === false ?
  14365. this.each( doAnimation ) :
  14366. this.queue( optall.queue, doAnimation );
  14367. },
  14368. stop: function( type, clearQueue, gotoEnd ) {
  14369. var stopQueue = function( hooks ) {
  14370. var stop = hooks.stop;
  14371. delete hooks.stop;
  14372. stop( gotoEnd );
  14373. };
  14374. if ( typeof type !== "string" ) {
  14375. gotoEnd = clearQueue;
  14376. clearQueue = type;
  14377. type = undefined;
  14378. }
  14379. if ( clearQueue && type !== false ) {
  14380. this.queue( type || "fx", [] );
  14381. }
  14382. return this.each( function() {
  14383. var dequeue = true,
  14384. index = type != null && type + "queueHooks",
  14385. timers = jQuery.timers,
  14386. data = dataPriv.get( this );
  14387. if ( index ) {
  14388. if ( data[ index ] && data[ index ].stop ) {
  14389. stopQueue( data[ index ] );
  14390. }
  14391. } else {
  14392. for ( index in data ) {
  14393. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14394. stopQueue( data[ index ] );
  14395. }
  14396. }
  14397. }
  14398. for ( index = timers.length; index--; ) {
  14399. if ( timers[ index ].elem === this &&
  14400. ( type == null || timers[ index ].queue === type ) ) {
  14401. timers[ index ].anim.stop( gotoEnd );
  14402. dequeue = false;
  14403. timers.splice( index, 1 );
  14404. }
  14405. }
  14406. // Start the next in the queue if the last step wasn't forced.
  14407. // Timers currently will call their complete callbacks, which
  14408. // will dequeue but only if they were gotoEnd.
  14409. if ( dequeue || !gotoEnd ) {
  14410. jQuery.dequeue( this, type );
  14411. }
  14412. } );
  14413. },
  14414. finish: function( type ) {
  14415. if ( type !== false ) {
  14416. type = type || "fx";
  14417. }
  14418. return this.each( function() {
  14419. var index,
  14420. data = dataPriv.get( this ),
  14421. queue = data[ type + "queue" ],
  14422. hooks = data[ type + "queueHooks" ],
  14423. timers = jQuery.timers,
  14424. length = queue ? queue.length : 0;
  14425. // Enable finishing flag on private data
  14426. data.finish = true;
  14427. // Empty the queue first
  14428. jQuery.queue( this, type, [] );
  14429. if ( hooks && hooks.stop ) {
  14430. hooks.stop.call( this, true );
  14431. }
  14432. // Look for any active animations, and finish them
  14433. for ( index = timers.length; index--; ) {
  14434. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14435. timers[ index ].anim.stop( true );
  14436. timers.splice( index, 1 );
  14437. }
  14438. }
  14439. // Look for any animations in the old queue and finish them
  14440. for ( index = 0; index < length; index++ ) {
  14441. if ( queue[ index ] && queue[ index ].finish ) {
  14442. queue[ index ].finish.call( this );
  14443. }
  14444. }
  14445. // Turn off finishing flag
  14446. delete data.finish;
  14447. } );
  14448. }
  14449. } );
  14450. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14451. var cssFn = jQuery.fn[ name ];
  14452. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14453. return speed == null || typeof speed === "boolean" ?
  14454. cssFn.apply( this, arguments ) :
  14455. this.animate( genFx( name, true ), speed, easing, callback );
  14456. };
  14457. } );
  14458. // Generate shortcuts for custom animations
  14459. jQuery.each( {
  14460. slideDown: genFx( "show" ),
  14461. slideUp: genFx( "hide" ),
  14462. slideToggle: genFx( "toggle" ),
  14463. fadeIn: { opacity: "show" },
  14464. fadeOut: { opacity: "hide" },
  14465. fadeToggle: { opacity: "toggle" }
  14466. }, function( name, props ) {
  14467. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14468. return this.animate( props, speed, easing, callback );
  14469. };
  14470. } );
  14471. jQuery.timers = [];
  14472. jQuery.fx.tick = function() {
  14473. var timer,
  14474. i = 0,
  14475. timers = jQuery.timers;
  14476. fxNow = Date.now();
  14477. for ( ; i < timers.length; i++ ) {
  14478. timer = timers[ i ];
  14479. // Run the timer and safely remove it when done (allowing for external removal)
  14480. if ( !timer() && timers[ i ] === timer ) {
  14481. timers.splice( i--, 1 );
  14482. }
  14483. }
  14484. if ( !timers.length ) {
  14485. jQuery.fx.stop();
  14486. }
  14487. fxNow = undefined;
  14488. };
  14489. jQuery.fx.timer = function( timer ) {
  14490. jQuery.timers.push( timer );
  14491. jQuery.fx.start();
  14492. };
  14493. jQuery.fx.interval = 13;
  14494. jQuery.fx.start = function() {
  14495. if ( inProgress ) {
  14496. return;
  14497. }
  14498. inProgress = true;
  14499. schedule();
  14500. };
  14501. jQuery.fx.stop = function() {
  14502. inProgress = null;
  14503. };
  14504. jQuery.fx.speeds = {
  14505. slow: 600,
  14506. fast: 200,
  14507. // Default speed
  14508. _default: 400
  14509. };
  14510. // Based off of the plugin by Clint Helfers, with permission.
  14511. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14512. jQuery.fn.delay = function( time, type ) {
  14513. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14514. type = type || "fx";
  14515. return this.queue( type, function( next, hooks ) {
  14516. var timeout = window.setTimeout( next, time );
  14517. hooks.stop = function() {
  14518. window.clearTimeout( timeout );
  14519. };
  14520. } );
  14521. };
  14522. ( function() {
  14523. var input = document.createElement( "input" ),
  14524. select = document.createElement( "select" ),
  14525. opt = select.appendChild( document.createElement( "option" ) );
  14526. input.type = "checkbox";
  14527. // Support: Android <=4.3 only
  14528. // Default value for a checkbox should be "on"
  14529. support.checkOn = input.value !== "";
  14530. // Support: IE <=11 only
  14531. // Must access selectedIndex to make default options select
  14532. support.optSelected = opt.selected;
  14533. // Support: IE <=11 only
  14534. // An input loses its value after becoming a radio
  14535. input = document.createElement( "input" );
  14536. input.value = "t";
  14537. input.type = "radio";
  14538. support.radioValue = input.value === "t";
  14539. } )();
  14540. var boolHook,
  14541. attrHandle = jQuery.expr.attrHandle;
  14542. jQuery.fn.extend( {
  14543. attr: function( name, value ) {
  14544. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14545. },
  14546. removeAttr: function( name ) {
  14547. return this.each( function() {
  14548. jQuery.removeAttr( this, name );
  14549. } );
  14550. }
  14551. } );
  14552. jQuery.extend( {
  14553. attr: function( elem, name, value ) {
  14554. var ret, hooks,
  14555. nType = elem.nodeType;
  14556. // Don't get/set attributes on text, comment and attribute nodes
  14557. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14558. return;
  14559. }
  14560. // Fallback to prop when attributes are not supported
  14561. if ( typeof elem.getAttribute === "undefined" ) {
  14562. return jQuery.prop( elem, name, value );
  14563. }
  14564. // Attribute hooks are determined by the lowercase version
  14565. // Grab necessary hook if one is defined
  14566. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14567. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14568. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14569. }
  14570. if ( value !== undefined ) {
  14571. if ( value === null ) {
  14572. jQuery.removeAttr( elem, name );
  14573. return;
  14574. }
  14575. if ( hooks && "set" in hooks &&
  14576. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14577. return ret;
  14578. }
  14579. elem.setAttribute( name, value + "" );
  14580. return value;
  14581. }
  14582. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14583. return ret;
  14584. }
  14585. ret = jQuery.find.attr( elem, name );
  14586. // Non-existent attributes return null, we normalize to undefined
  14587. return ret == null ? undefined : ret;
  14588. },
  14589. attrHooks: {
  14590. type: {
  14591. set: function( elem, value ) {
  14592. if ( !support.radioValue && value === "radio" &&
  14593. nodeName( elem, "input" ) ) {
  14594. var val = elem.value;
  14595. elem.setAttribute( "type", value );
  14596. if ( val ) {
  14597. elem.value = val;
  14598. }
  14599. return value;
  14600. }
  14601. }
  14602. }
  14603. },
  14604. removeAttr: function( elem, value ) {
  14605. var name,
  14606. i = 0,
  14607. // Attribute names can contain non-HTML whitespace characters
  14608. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14609. attrNames = value && value.match( rnothtmlwhite );
  14610. if ( attrNames && elem.nodeType === 1 ) {
  14611. while ( ( name = attrNames[ i++ ] ) ) {
  14612. elem.removeAttribute( name );
  14613. }
  14614. }
  14615. }
  14616. } );
  14617. // Hooks for boolean attributes
  14618. boolHook = {
  14619. set: function( elem, value, name ) {
  14620. if ( value === false ) {
  14621. // Remove boolean attributes when set to false
  14622. jQuery.removeAttr( elem, name );
  14623. } else {
  14624. elem.setAttribute( name, name );
  14625. }
  14626. return name;
  14627. }
  14628. };
  14629. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14630. var getter = attrHandle[ name ] || jQuery.find.attr;
  14631. attrHandle[ name ] = function( elem, name, isXML ) {
  14632. var ret, handle,
  14633. lowercaseName = name.toLowerCase();
  14634. if ( !isXML ) {
  14635. // Avoid an infinite loop by temporarily removing this function from the getter
  14636. handle = attrHandle[ lowercaseName ];
  14637. attrHandle[ lowercaseName ] = ret;
  14638. ret = getter( elem, name, isXML ) != null ?
  14639. lowercaseName :
  14640. null;
  14641. attrHandle[ lowercaseName ] = handle;
  14642. }
  14643. return ret;
  14644. };
  14645. } );
  14646. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14647. rclickable = /^(?:a|area)$/i;
  14648. jQuery.fn.extend( {
  14649. prop: function( name, value ) {
  14650. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14651. },
  14652. removeProp: function( name ) {
  14653. return this.each( function() {
  14654. delete this[ jQuery.propFix[ name ] || name ];
  14655. } );
  14656. }
  14657. } );
  14658. jQuery.extend( {
  14659. prop: function( elem, name, value ) {
  14660. var ret, hooks,
  14661. nType = elem.nodeType;
  14662. // Don't get/set properties on text, comment and attribute nodes
  14663. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14664. return;
  14665. }
  14666. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14667. // Fix name and attach hooks
  14668. name = jQuery.propFix[ name ] || name;
  14669. hooks = jQuery.propHooks[ name ];
  14670. }
  14671. if ( value !== undefined ) {
  14672. if ( hooks && "set" in hooks &&
  14673. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14674. return ret;
  14675. }
  14676. return ( elem[ name ] = value );
  14677. }
  14678. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14679. return ret;
  14680. }
  14681. return elem[ name ];
  14682. },
  14683. propHooks: {
  14684. tabIndex: {
  14685. get: function( elem ) {
  14686. // Support: IE <=9 - 11 only
  14687. // elem.tabIndex doesn't always return the
  14688. // correct value when it hasn't been explicitly set
  14689. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14690. // Use proper attribute retrieval(#12072)
  14691. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14692. if ( tabindex ) {
  14693. return parseInt( tabindex, 10 );
  14694. }
  14695. if (
  14696. rfocusable.test( elem.nodeName ) ||
  14697. rclickable.test( elem.nodeName ) &&
  14698. elem.href
  14699. ) {
  14700. return 0;
  14701. }
  14702. return -1;
  14703. }
  14704. }
  14705. },
  14706. propFix: {
  14707. "for": "htmlFor",
  14708. "class": "className"
  14709. }
  14710. } );
  14711. // Support: IE <=11 only
  14712. // Accessing the selectedIndex property
  14713. // forces the browser to respect setting selected
  14714. // on the option
  14715. // The getter ensures a default option is selected
  14716. // when in an optgroup
  14717. // eslint rule "no-unused-expressions" is disabled for this code
  14718. // since it considers such accessions noop
  14719. if ( !support.optSelected ) {
  14720. jQuery.propHooks.selected = {
  14721. get: function( elem ) {
  14722. /* eslint no-unused-expressions: "off" */
  14723. var parent = elem.parentNode;
  14724. if ( parent && parent.parentNode ) {
  14725. parent.parentNode.selectedIndex;
  14726. }
  14727. return null;
  14728. },
  14729. set: function( elem ) {
  14730. /* eslint no-unused-expressions: "off" */
  14731. var parent = elem.parentNode;
  14732. if ( parent ) {
  14733. parent.selectedIndex;
  14734. if ( parent.parentNode ) {
  14735. parent.parentNode.selectedIndex;
  14736. }
  14737. }
  14738. }
  14739. };
  14740. }
  14741. jQuery.each( [
  14742. "tabIndex",
  14743. "readOnly",
  14744. "maxLength",
  14745. "cellSpacing",
  14746. "cellPadding",
  14747. "rowSpan",
  14748. "colSpan",
  14749. "useMap",
  14750. "frameBorder",
  14751. "contentEditable"
  14752. ], function() {
  14753. jQuery.propFix[ this.toLowerCase() ] = this;
  14754. } );
  14755. // Strip and collapse whitespace according to HTML spec
  14756. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14757. function stripAndCollapse( value ) {
  14758. var tokens = value.match( rnothtmlwhite ) || [];
  14759. return tokens.join( " " );
  14760. }
  14761. function getClass( elem ) {
  14762. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14763. }
  14764. function classesToArray( value ) {
  14765. if ( Array.isArray( value ) ) {
  14766. return value;
  14767. }
  14768. if ( typeof value === "string" ) {
  14769. return value.match( rnothtmlwhite ) || [];
  14770. }
  14771. return [];
  14772. }
  14773. jQuery.fn.extend( {
  14774. addClass: function( value ) {
  14775. var classes, elem, cur, curValue, clazz, j, finalValue,
  14776. i = 0;
  14777. if ( isFunction( value ) ) {
  14778. return this.each( function( j ) {
  14779. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14780. } );
  14781. }
  14782. classes = classesToArray( value );
  14783. if ( classes.length ) {
  14784. while ( ( elem = this[ i++ ] ) ) {
  14785. curValue = getClass( elem );
  14786. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14787. if ( cur ) {
  14788. j = 0;
  14789. while ( ( clazz = classes[ j++ ] ) ) {
  14790. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14791. cur += clazz + " ";
  14792. }
  14793. }
  14794. // Only assign if different to avoid unneeded rendering.
  14795. finalValue = stripAndCollapse( cur );
  14796. if ( curValue !== finalValue ) {
  14797. elem.setAttribute( "class", finalValue );
  14798. }
  14799. }
  14800. }
  14801. }
  14802. return this;
  14803. },
  14804. removeClass: function( value ) {
  14805. var classes, elem, cur, curValue, clazz, j, finalValue,
  14806. i = 0;
  14807. if ( isFunction( value ) ) {
  14808. return this.each( function( j ) {
  14809. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14810. } );
  14811. }
  14812. if ( !arguments.length ) {
  14813. return this.attr( "class", "" );
  14814. }
  14815. classes = classesToArray( value );
  14816. if ( classes.length ) {
  14817. while ( ( elem = this[ i++ ] ) ) {
  14818. curValue = getClass( elem );
  14819. // This expression is here for better compressibility (see addClass)
  14820. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14821. if ( cur ) {
  14822. j = 0;
  14823. while ( ( clazz = classes[ j++ ] ) ) {
  14824. // Remove *all* instances
  14825. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14826. cur = cur.replace( " " + clazz + " ", " " );
  14827. }
  14828. }
  14829. // Only assign if different to avoid unneeded rendering.
  14830. finalValue = stripAndCollapse( cur );
  14831. if ( curValue !== finalValue ) {
  14832. elem.setAttribute( "class", finalValue );
  14833. }
  14834. }
  14835. }
  14836. }
  14837. return this;
  14838. },
  14839. toggleClass: function( value, stateVal ) {
  14840. var type = typeof value,
  14841. isValidValue = type === "string" || Array.isArray( value );
  14842. if ( typeof stateVal === "boolean" && isValidValue ) {
  14843. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14844. }
  14845. if ( isFunction( value ) ) {
  14846. return this.each( function( i ) {
  14847. jQuery( this ).toggleClass(
  14848. value.call( this, i, getClass( this ), stateVal ),
  14849. stateVal
  14850. );
  14851. } );
  14852. }
  14853. return this.each( function() {
  14854. var className, i, self, classNames;
  14855. if ( isValidValue ) {
  14856. // Toggle individual class names
  14857. i = 0;
  14858. self = jQuery( this );
  14859. classNames = classesToArray( value );
  14860. while ( ( className = classNames[ i++ ] ) ) {
  14861. // Check each className given, space separated list
  14862. if ( self.hasClass( className ) ) {
  14863. self.removeClass( className );
  14864. } else {
  14865. self.addClass( className );
  14866. }
  14867. }
  14868. // Toggle whole class name
  14869. } else if ( value === undefined || type === "boolean" ) {
  14870. className = getClass( this );
  14871. if ( className ) {
  14872. // Store className if set
  14873. dataPriv.set( this, "__className__", className );
  14874. }
  14875. // If the element has a class name or if we're passed `false`,
  14876. // then remove the whole classname (if there was one, the above saved it).
  14877. // Otherwise bring back whatever was previously saved (if anything),
  14878. // falling back to the empty string if nothing was stored.
  14879. if ( this.setAttribute ) {
  14880. this.setAttribute( "class",
  14881. className || value === false ?
  14882. "" :
  14883. dataPriv.get( this, "__className__" ) || ""
  14884. );
  14885. }
  14886. }
  14887. } );
  14888. },
  14889. hasClass: function( selector ) {
  14890. var className, elem,
  14891. i = 0;
  14892. className = " " + selector + " ";
  14893. while ( ( elem = this[ i++ ] ) ) {
  14894. if ( elem.nodeType === 1 &&
  14895. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14896. return true;
  14897. }
  14898. }
  14899. return false;
  14900. }
  14901. } );
  14902. var rreturn = /\r/g;
  14903. jQuery.fn.extend( {
  14904. val: function( value ) {
  14905. var hooks, ret, valueIsFunction,
  14906. elem = this[ 0 ];
  14907. if ( !arguments.length ) {
  14908. if ( elem ) {
  14909. hooks = jQuery.valHooks[ elem.type ] ||
  14910. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14911. if ( hooks &&
  14912. "get" in hooks &&
  14913. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14914. ) {
  14915. return ret;
  14916. }
  14917. ret = elem.value;
  14918. // Handle most common string cases
  14919. if ( typeof ret === "string" ) {
  14920. return ret.replace( rreturn, "" );
  14921. }
  14922. // Handle cases where value is null/undef or number
  14923. return ret == null ? "" : ret;
  14924. }
  14925. return;
  14926. }
  14927. valueIsFunction = isFunction( value );
  14928. return this.each( function( i ) {
  14929. var val;
  14930. if ( this.nodeType !== 1 ) {
  14931. return;
  14932. }
  14933. if ( valueIsFunction ) {
  14934. val = value.call( this, i, jQuery( this ).val() );
  14935. } else {
  14936. val = value;
  14937. }
  14938. // Treat null/undefined as ""; convert numbers to string
  14939. if ( val == null ) {
  14940. val = "";
  14941. } else if ( typeof val === "number" ) {
  14942. val += "";
  14943. } else if ( Array.isArray( val ) ) {
  14944. val = jQuery.map( val, function( value ) {
  14945. return value == null ? "" : value + "";
  14946. } );
  14947. }
  14948. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  14949. // If set returns undefined, fall back to normal setting
  14950. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  14951. this.value = val;
  14952. }
  14953. } );
  14954. }
  14955. } );
  14956. jQuery.extend( {
  14957. valHooks: {
  14958. option: {
  14959. get: function( elem ) {
  14960. var val = jQuery.find.attr( elem, "value" );
  14961. return val != null ?
  14962. val :
  14963. // Support: IE <=10 - 11 only
  14964. // option.text throws exceptions (#14686, #14858)
  14965. // Strip and collapse whitespace
  14966. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  14967. stripAndCollapse( jQuery.text( elem ) );
  14968. }
  14969. },
  14970. select: {
  14971. get: function( elem ) {
  14972. var value, option, i,
  14973. options = elem.options,
  14974. index = elem.selectedIndex,
  14975. one = elem.type === "select-one",
  14976. values = one ? null : [],
  14977. max = one ? index + 1 : options.length;
  14978. if ( index < 0 ) {
  14979. i = max;
  14980. } else {
  14981. i = one ? index : 0;
  14982. }
  14983. // Loop through all the selected options
  14984. for ( ; i < max; i++ ) {
  14985. option = options[ i ];
  14986. // Support: IE <=9 only
  14987. // IE8-9 doesn't update selected after form reset (#2551)
  14988. if ( ( option.selected || i === index ) &&
  14989. // Don't return options that are disabled or in a disabled optgroup
  14990. !option.disabled &&
  14991. ( !option.parentNode.disabled ||
  14992. !nodeName( option.parentNode, "optgroup" ) ) ) {
  14993. // Get the specific value for the option
  14994. value = jQuery( option ).val();
  14995. // We don't need an array for one selects
  14996. if ( one ) {
  14997. return value;
  14998. }
  14999. // Multi-Selects return an array
  15000. values.push( value );
  15001. }
  15002. }
  15003. return values;
  15004. },
  15005. set: function( elem, value ) {
  15006. var optionSet, option,
  15007. options = elem.options,
  15008. values = jQuery.makeArray( value ),
  15009. i = options.length;
  15010. while ( i-- ) {
  15011. option = options[ i ];
  15012. /* eslint-disable no-cond-assign */
  15013. if ( option.selected =
  15014. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15015. ) {
  15016. optionSet = true;
  15017. }
  15018. /* eslint-enable no-cond-assign */
  15019. }
  15020. // Force browsers to behave consistently when non-matching value is set
  15021. if ( !optionSet ) {
  15022. elem.selectedIndex = -1;
  15023. }
  15024. return values;
  15025. }
  15026. }
  15027. }
  15028. } );
  15029. // Radios and checkboxes getter/setter
  15030. jQuery.each( [ "radio", "checkbox" ], function() {
  15031. jQuery.valHooks[ this ] = {
  15032. set: function( elem, value ) {
  15033. if ( Array.isArray( value ) ) {
  15034. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15035. }
  15036. }
  15037. };
  15038. if ( !support.checkOn ) {
  15039. jQuery.valHooks[ this ].get = function( elem ) {
  15040. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15041. };
  15042. }
  15043. } );
  15044. // Return jQuery for attributes-only inclusion
  15045. support.focusin = "onfocusin" in window;
  15046. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15047. stopPropagationCallback = function( e ) {
  15048. e.stopPropagation();
  15049. };
  15050. jQuery.extend( jQuery.event, {
  15051. trigger: function( event, data, elem, onlyHandlers ) {
  15052. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15053. eventPath = [ elem || document ],
  15054. type = hasOwn.call( event, "type" ) ? event.type : event,
  15055. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15056. cur = lastElement = tmp = elem = elem || document;
  15057. // Don't do events on text and comment nodes
  15058. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15059. return;
  15060. }
  15061. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15062. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15063. return;
  15064. }
  15065. if ( type.indexOf( "." ) > -1 ) {
  15066. // Namespaced trigger; create a regexp to match event type in handle()
  15067. namespaces = type.split( "." );
  15068. type = namespaces.shift();
  15069. namespaces.sort();
  15070. }
  15071. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15072. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15073. event = event[ jQuery.expando ] ?
  15074. event :
  15075. new jQuery.Event( type, typeof event === "object" && event );
  15076. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15077. event.isTrigger = onlyHandlers ? 2 : 3;
  15078. event.namespace = namespaces.join( "." );
  15079. event.rnamespace = event.namespace ?
  15080. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15081. null;
  15082. // Clean up the event in case it is being reused
  15083. event.result = undefined;
  15084. if ( !event.target ) {
  15085. event.target = elem;
  15086. }
  15087. // Clone any incoming data and prepend the event, creating the handler arg list
  15088. data = data == null ?
  15089. [ event ] :
  15090. jQuery.makeArray( data, [ event ] );
  15091. // Allow special events to draw outside the lines
  15092. special = jQuery.event.special[ type ] || {};
  15093. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15094. return;
  15095. }
  15096. // Determine event propagation path in advance, per W3C events spec (#9951)
  15097. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15098. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15099. bubbleType = special.delegateType || type;
  15100. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15101. cur = cur.parentNode;
  15102. }
  15103. for ( ; cur; cur = cur.parentNode ) {
  15104. eventPath.push( cur );
  15105. tmp = cur;
  15106. }
  15107. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15108. if ( tmp === ( elem.ownerDocument || document ) ) {
  15109. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15110. }
  15111. }
  15112. // Fire handlers on the event path
  15113. i = 0;
  15114. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15115. lastElement = cur;
  15116. event.type = i > 1 ?
  15117. bubbleType :
  15118. special.bindType || type;
  15119. // jQuery handler
  15120. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15121. dataPriv.get( cur, "handle" );
  15122. if ( handle ) {
  15123. handle.apply( cur, data );
  15124. }
  15125. // Native handler
  15126. handle = ontype && cur[ ontype ];
  15127. if ( handle && handle.apply && acceptData( cur ) ) {
  15128. event.result = handle.apply( cur, data );
  15129. if ( event.result === false ) {
  15130. event.preventDefault();
  15131. }
  15132. }
  15133. }
  15134. event.type = type;
  15135. // If nobody prevented the default action, do it now
  15136. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15137. if ( ( !special._default ||
  15138. special._default.apply( eventPath.pop(), data ) === false ) &&
  15139. acceptData( elem ) ) {
  15140. // Call a native DOM method on the target with the same name as the event.
  15141. // Don't do default actions on window, that's where global variables be (#6170)
  15142. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15143. // Don't re-trigger an onFOO event when we call its FOO() method
  15144. tmp = elem[ ontype ];
  15145. if ( tmp ) {
  15146. elem[ ontype ] = null;
  15147. }
  15148. // Prevent re-triggering of the same event, since we already bubbled it above
  15149. jQuery.event.triggered = type;
  15150. if ( event.isPropagationStopped() ) {
  15151. lastElement.addEventListener( type, stopPropagationCallback );
  15152. }
  15153. elem[ type ]();
  15154. if ( event.isPropagationStopped() ) {
  15155. lastElement.removeEventListener( type, stopPropagationCallback );
  15156. }
  15157. jQuery.event.triggered = undefined;
  15158. if ( tmp ) {
  15159. elem[ ontype ] = tmp;
  15160. }
  15161. }
  15162. }
  15163. }
  15164. return event.result;
  15165. },
  15166. // Piggyback on a donor event to simulate a different one
  15167. // Used only for `focus(in | out)` events
  15168. simulate: function( type, elem, event ) {
  15169. var e = jQuery.extend(
  15170. new jQuery.Event(),
  15171. event,
  15172. {
  15173. type: type,
  15174. isSimulated: true
  15175. }
  15176. );
  15177. jQuery.event.trigger( e, null, elem );
  15178. }
  15179. } );
  15180. jQuery.fn.extend( {
  15181. trigger: function( type, data ) {
  15182. return this.each( function() {
  15183. jQuery.event.trigger( type, data, this );
  15184. } );
  15185. },
  15186. triggerHandler: function( type, data ) {
  15187. var elem = this[ 0 ];
  15188. if ( elem ) {
  15189. return jQuery.event.trigger( type, data, elem, true );
  15190. }
  15191. }
  15192. } );
  15193. // Support: Firefox <=44
  15194. // Firefox doesn't have focus(in | out) events
  15195. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15196. //
  15197. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15198. // focus(in | out) events fire after focus & blur events,
  15199. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15200. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15201. if ( !support.focusin ) {
  15202. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15203. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15204. var handler = function( event ) {
  15205. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15206. };
  15207. jQuery.event.special[ fix ] = {
  15208. setup: function() {
  15209. var doc = this.ownerDocument || this,
  15210. attaches = dataPriv.access( doc, fix );
  15211. if ( !attaches ) {
  15212. doc.addEventListener( orig, handler, true );
  15213. }
  15214. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15215. },
  15216. teardown: function() {
  15217. var doc = this.ownerDocument || this,
  15218. attaches = dataPriv.access( doc, fix ) - 1;
  15219. if ( !attaches ) {
  15220. doc.removeEventListener( orig, handler, true );
  15221. dataPriv.remove( doc, fix );
  15222. } else {
  15223. dataPriv.access( doc, fix, attaches );
  15224. }
  15225. }
  15226. };
  15227. } );
  15228. }
  15229. var location = window.location;
  15230. var nonce = Date.now();
  15231. var rquery = ( /\?/ );
  15232. // Cross-browser xml parsing
  15233. jQuery.parseXML = function( data ) {
  15234. var xml;
  15235. if ( !data || typeof data !== "string" ) {
  15236. return null;
  15237. }
  15238. // Support: IE 9 - 11 only
  15239. // IE throws on parseFromString with invalid input.
  15240. try {
  15241. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15242. } catch ( e ) {
  15243. xml = undefined;
  15244. }
  15245. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15246. jQuery.error( "Invalid XML: " + data );
  15247. }
  15248. return xml;
  15249. };
  15250. var
  15251. rbracket = /\[\]$/,
  15252. rCRLF = /\r?\n/g,
  15253. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15254. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15255. function buildParams( prefix, obj, traditional, add ) {
  15256. var name;
  15257. if ( Array.isArray( obj ) ) {
  15258. // Serialize array item.
  15259. jQuery.each( obj, function( i, v ) {
  15260. if ( traditional || rbracket.test( prefix ) ) {
  15261. // Treat each array item as a scalar.
  15262. add( prefix, v );
  15263. } else {
  15264. // Item is non-scalar (array or object), encode its numeric index.
  15265. buildParams(
  15266. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15267. v,
  15268. traditional,
  15269. add
  15270. );
  15271. }
  15272. } );
  15273. } else if ( !traditional && toType( obj ) === "object" ) {
  15274. // Serialize object item.
  15275. for ( name in obj ) {
  15276. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15277. }
  15278. } else {
  15279. // Serialize scalar item.
  15280. add( prefix, obj );
  15281. }
  15282. }
  15283. // Serialize an array of form elements or a set of
  15284. // key/values into a query string
  15285. jQuery.param = function( a, traditional ) {
  15286. var prefix,
  15287. s = [],
  15288. add = function( key, valueOrFunction ) {
  15289. // If value is a function, invoke it and use its return value
  15290. var value = isFunction( valueOrFunction ) ?
  15291. valueOrFunction() :
  15292. valueOrFunction;
  15293. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15294. encodeURIComponent( value == null ? "" : value );
  15295. };
  15296. if ( a == null ) {
  15297. return "";
  15298. }
  15299. // If an array was passed in, assume that it is an array of form elements.
  15300. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15301. // Serialize the form elements
  15302. jQuery.each( a, function() {
  15303. add( this.name, this.value );
  15304. } );
  15305. } else {
  15306. // If traditional, encode the "old" way (the way 1.3.2 or older
  15307. // did it), otherwise encode params recursively.
  15308. for ( prefix in a ) {
  15309. buildParams( prefix, a[ prefix ], traditional, add );
  15310. }
  15311. }
  15312. // Return the resulting serialization
  15313. return s.join( "&" );
  15314. };
  15315. jQuery.fn.extend( {
  15316. serialize: function() {
  15317. return jQuery.param( this.serializeArray() );
  15318. },
  15319. serializeArray: function() {
  15320. return this.map( function() {
  15321. // Can add propHook for "elements" to filter or add form elements
  15322. var elements = jQuery.prop( this, "elements" );
  15323. return elements ? jQuery.makeArray( elements ) : this;
  15324. } )
  15325. .filter( function() {
  15326. var type = this.type;
  15327. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15328. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15329. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15330. ( this.checked || !rcheckableType.test( type ) );
  15331. } )
  15332. .map( function( i, elem ) {
  15333. var val = jQuery( this ).val();
  15334. if ( val == null ) {
  15335. return null;
  15336. }
  15337. if ( Array.isArray( val ) ) {
  15338. return jQuery.map( val, function( val ) {
  15339. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15340. } );
  15341. }
  15342. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15343. } ).get();
  15344. }
  15345. } );
  15346. var
  15347. r20 = /%20/g,
  15348. rhash = /#.*$/,
  15349. rantiCache = /([?&])_=[^&]*/,
  15350. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15351. // #7653, #8125, #8152: local protocol detection
  15352. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15353. rnoContent = /^(?:GET|HEAD)$/,
  15354. rprotocol = /^\/\//,
  15355. /* Prefilters
  15356. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15357. * 2) These are called:
  15358. * - BEFORE asking for a transport
  15359. * - AFTER param serialization (s.data is a string if s.processData is true)
  15360. * 3) key is the dataType
  15361. * 4) the catchall symbol "*" can be used
  15362. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15363. */
  15364. prefilters = {},
  15365. /* Transports bindings
  15366. * 1) key is the dataType
  15367. * 2) the catchall symbol "*" can be used
  15368. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15369. */
  15370. transports = {},
  15371. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15372. allTypes = "*/".concat( "*" ),
  15373. // Anchor tag for parsing the document origin
  15374. originAnchor = document.createElement( "a" );
  15375. originAnchor.href = location.href;
  15376. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15377. function addToPrefiltersOrTransports( structure ) {
  15378. // dataTypeExpression is optional and defaults to "*"
  15379. return function( dataTypeExpression, func ) {
  15380. if ( typeof dataTypeExpression !== "string" ) {
  15381. func = dataTypeExpression;
  15382. dataTypeExpression = "*";
  15383. }
  15384. var dataType,
  15385. i = 0,
  15386. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15387. if ( isFunction( func ) ) {
  15388. // For each dataType in the dataTypeExpression
  15389. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15390. // Prepend if requested
  15391. if ( dataType[ 0 ] === "+" ) {
  15392. dataType = dataType.slice( 1 ) || "*";
  15393. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15394. // Otherwise append
  15395. } else {
  15396. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15397. }
  15398. }
  15399. }
  15400. };
  15401. }
  15402. // Base inspection function for prefilters and transports
  15403. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15404. var inspected = {},
  15405. seekingTransport = ( structure === transports );
  15406. function inspect( dataType ) {
  15407. var selected;
  15408. inspected[ dataType ] = true;
  15409. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15410. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15411. if ( typeof dataTypeOrTransport === "string" &&
  15412. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15413. options.dataTypes.unshift( dataTypeOrTransport );
  15414. inspect( dataTypeOrTransport );
  15415. return false;
  15416. } else if ( seekingTransport ) {
  15417. return !( selected = dataTypeOrTransport );
  15418. }
  15419. } );
  15420. return selected;
  15421. }
  15422. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15423. }
  15424. // A special extend for ajax options
  15425. // that takes "flat" options (not to be deep extended)
  15426. // Fixes #9887
  15427. function ajaxExtend( target, src ) {
  15428. var key, deep,
  15429. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15430. for ( key in src ) {
  15431. if ( src[ key ] !== undefined ) {
  15432. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15433. }
  15434. }
  15435. if ( deep ) {
  15436. jQuery.extend( true, target, deep );
  15437. }
  15438. return target;
  15439. }
  15440. /* Handles responses to an ajax request:
  15441. * - finds the right dataType (mediates between content-type and expected dataType)
  15442. * - returns the corresponding response
  15443. */
  15444. function ajaxHandleResponses( s, jqXHR, responses ) {
  15445. var ct, type, finalDataType, firstDataType,
  15446. contents = s.contents,
  15447. dataTypes = s.dataTypes;
  15448. // Remove auto dataType and get content-type in the process
  15449. while ( dataTypes[ 0 ] === "*" ) {
  15450. dataTypes.shift();
  15451. if ( ct === undefined ) {
  15452. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15453. }
  15454. }
  15455. // Check if we're dealing with a known content-type
  15456. if ( ct ) {
  15457. for ( type in contents ) {
  15458. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15459. dataTypes.unshift( type );
  15460. break;
  15461. }
  15462. }
  15463. }
  15464. // Check to see if we have a response for the expected dataType
  15465. if ( dataTypes[ 0 ] in responses ) {
  15466. finalDataType = dataTypes[ 0 ];
  15467. } else {
  15468. // Try convertible dataTypes
  15469. for ( type in responses ) {
  15470. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15471. finalDataType = type;
  15472. break;
  15473. }
  15474. if ( !firstDataType ) {
  15475. firstDataType = type;
  15476. }
  15477. }
  15478. // Or just use first one
  15479. finalDataType = finalDataType || firstDataType;
  15480. }
  15481. // If we found a dataType
  15482. // We add the dataType to the list if needed
  15483. // and return the corresponding response
  15484. if ( finalDataType ) {
  15485. if ( finalDataType !== dataTypes[ 0 ] ) {
  15486. dataTypes.unshift( finalDataType );
  15487. }
  15488. return responses[ finalDataType ];
  15489. }
  15490. }
  15491. /* Chain conversions given the request and the original response
  15492. * Also sets the responseXXX fields on the jqXHR instance
  15493. */
  15494. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15495. var conv2, current, conv, tmp, prev,
  15496. converters = {},
  15497. // Work with a copy of dataTypes in case we need to modify it for conversion
  15498. dataTypes = s.dataTypes.slice();
  15499. // Create converters map with lowercased keys
  15500. if ( dataTypes[ 1 ] ) {
  15501. for ( conv in s.converters ) {
  15502. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15503. }
  15504. }
  15505. current = dataTypes.shift();
  15506. // Convert to each sequential dataType
  15507. while ( current ) {
  15508. if ( s.responseFields[ current ] ) {
  15509. jqXHR[ s.responseFields[ current ] ] = response;
  15510. }
  15511. // Apply the dataFilter if provided
  15512. if ( !prev && isSuccess && s.dataFilter ) {
  15513. response = s.dataFilter( response, s.dataType );
  15514. }
  15515. prev = current;
  15516. current = dataTypes.shift();
  15517. if ( current ) {
  15518. // There's only work to do if current dataType is non-auto
  15519. if ( current === "*" ) {
  15520. current = prev;
  15521. // Convert response if prev dataType is non-auto and differs from current
  15522. } else if ( prev !== "*" && prev !== current ) {
  15523. // Seek a direct converter
  15524. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15525. // If none found, seek a pair
  15526. if ( !conv ) {
  15527. for ( conv2 in converters ) {
  15528. // If conv2 outputs current
  15529. tmp = conv2.split( " " );
  15530. if ( tmp[ 1 ] === current ) {
  15531. // If prev can be converted to accepted input
  15532. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15533. converters[ "* " + tmp[ 0 ] ];
  15534. if ( conv ) {
  15535. // Condense equivalence converters
  15536. if ( conv === true ) {
  15537. conv = converters[ conv2 ];
  15538. // Otherwise, insert the intermediate dataType
  15539. } else if ( converters[ conv2 ] !== true ) {
  15540. current = tmp[ 0 ];
  15541. dataTypes.unshift( tmp[ 1 ] );
  15542. }
  15543. break;
  15544. }
  15545. }
  15546. }
  15547. }
  15548. // Apply converter (if not an equivalence)
  15549. if ( conv !== true ) {
  15550. // Unless errors are allowed to bubble, catch and return them
  15551. if ( conv && s.throws ) {
  15552. response = conv( response );
  15553. } else {
  15554. try {
  15555. response = conv( response );
  15556. } catch ( e ) {
  15557. return {
  15558. state: "parsererror",
  15559. error: conv ? e : "No conversion from " + prev + " to " + current
  15560. };
  15561. }
  15562. }
  15563. }
  15564. }
  15565. }
  15566. }
  15567. return { state: "success", data: response };
  15568. }
  15569. jQuery.extend( {
  15570. // Counter for holding the number of active queries
  15571. active: 0,
  15572. // Last-Modified header cache for next request
  15573. lastModified: {},
  15574. etag: {},
  15575. ajaxSettings: {
  15576. url: location.href,
  15577. type: "GET",
  15578. isLocal: rlocalProtocol.test( location.protocol ),
  15579. global: true,
  15580. processData: true,
  15581. async: true,
  15582. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15583. /*
  15584. timeout: 0,
  15585. data: null,
  15586. dataType: null,
  15587. username: null,
  15588. password: null,
  15589. cache: null,
  15590. throws: false,
  15591. traditional: false,
  15592. headers: {},
  15593. */
  15594. accepts: {
  15595. "*": allTypes,
  15596. text: "text/plain",
  15597. html: "text/html",
  15598. xml: "application/xml, text/xml",
  15599. json: "application/json, text/javascript"
  15600. },
  15601. contents: {
  15602. xml: /\bxml\b/,
  15603. html: /\bhtml/,
  15604. json: /\bjson\b/
  15605. },
  15606. responseFields: {
  15607. xml: "responseXML",
  15608. text: "responseText",
  15609. json: "responseJSON"
  15610. },
  15611. // Data converters
  15612. // Keys separate source (or catchall "*") and destination types with a single space
  15613. converters: {
  15614. // Convert anything to text
  15615. "* text": String,
  15616. // Text to html (true = no transformation)
  15617. "text html": true,
  15618. // Evaluate text as a json expression
  15619. "text json": JSON.parse,
  15620. // Parse text as xml
  15621. "text xml": jQuery.parseXML
  15622. },
  15623. // For options that shouldn't be deep extended:
  15624. // you can add your own custom options here if
  15625. // and when you create one that shouldn't be
  15626. // deep extended (see ajaxExtend)
  15627. flatOptions: {
  15628. url: true,
  15629. context: true
  15630. }
  15631. },
  15632. // Creates a full fledged settings object into target
  15633. // with both ajaxSettings and settings fields.
  15634. // If target is omitted, writes into ajaxSettings.
  15635. ajaxSetup: function( target, settings ) {
  15636. return settings ?
  15637. // Building a settings object
  15638. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15639. // Extending ajaxSettings
  15640. ajaxExtend( jQuery.ajaxSettings, target );
  15641. },
  15642. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15643. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15644. // Main method
  15645. ajax: function( url, options ) {
  15646. // If url is an object, simulate pre-1.5 signature
  15647. if ( typeof url === "object" ) {
  15648. options = url;
  15649. url = undefined;
  15650. }
  15651. // Force options to be an object
  15652. options = options || {};
  15653. var transport,
  15654. // URL without anti-cache param
  15655. cacheURL,
  15656. // Response headers
  15657. responseHeadersString,
  15658. responseHeaders,
  15659. // timeout handle
  15660. timeoutTimer,
  15661. // Url cleanup var
  15662. urlAnchor,
  15663. // Request state (becomes false upon send and true upon completion)
  15664. completed,
  15665. // To know if global events are to be dispatched
  15666. fireGlobals,
  15667. // Loop variable
  15668. i,
  15669. // uncached part of the url
  15670. uncached,
  15671. // Create the final options object
  15672. s = jQuery.ajaxSetup( {}, options ),
  15673. // Callbacks context
  15674. callbackContext = s.context || s,
  15675. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15676. globalEventContext = s.context &&
  15677. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15678. jQuery( callbackContext ) :
  15679. jQuery.event,
  15680. // Deferreds
  15681. deferred = jQuery.Deferred(),
  15682. completeDeferred = jQuery.Callbacks( "once memory" ),
  15683. // Status-dependent callbacks
  15684. statusCode = s.statusCode || {},
  15685. // Headers (they are sent all at once)
  15686. requestHeaders = {},
  15687. requestHeadersNames = {},
  15688. // Default abort message
  15689. strAbort = "canceled",
  15690. // Fake xhr
  15691. jqXHR = {
  15692. readyState: 0,
  15693. // Builds headers hashtable if needed
  15694. getResponseHeader: function( key ) {
  15695. var match;
  15696. if ( completed ) {
  15697. if ( !responseHeaders ) {
  15698. responseHeaders = {};
  15699. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15700. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15701. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15702. .concat( match[ 2 ] );
  15703. }
  15704. }
  15705. match = responseHeaders[ key.toLowerCase() + " " ];
  15706. }
  15707. return match == null ? null : match.join( ", " );
  15708. },
  15709. // Raw string
  15710. getAllResponseHeaders: function() {
  15711. return completed ? responseHeadersString : null;
  15712. },
  15713. // Caches the header
  15714. setRequestHeader: function( name, value ) {
  15715. if ( completed == null ) {
  15716. name = requestHeadersNames[ name.toLowerCase() ] =
  15717. requestHeadersNames[ name.toLowerCase() ] || name;
  15718. requestHeaders[ name ] = value;
  15719. }
  15720. return this;
  15721. },
  15722. // Overrides response content-type header
  15723. overrideMimeType: function( type ) {
  15724. if ( completed == null ) {
  15725. s.mimeType = type;
  15726. }
  15727. return this;
  15728. },
  15729. // Status-dependent callbacks
  15730. statusCode: function( map ) {
  15731. var code;
  15732. if ( map ) {
  15733. if ( completed ) {
  15734. // Execute the appropriate callbacks
  15735. jqXHR.always( map[ jqXHR.status ] );
  15736. } else {
  15737. // Lazy-add the new callbacks in a way that preserves old ones
  15738. for ( code in map ) {
  15739. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15740. }
  15741. }
  15742. }
  15743. return this;
  15744. },
  15745. // Cancel the request
  15746. abort: function( statusText ) {
  15747. var finalText = statusText || strAbort;
  15748. if ( transport ) {
  15749. transport.abort( finalText );
  15750. }
  15751. done( 0, finalText );
  15752. return this;
  15753. }
  15754. };
  15755. // Attach deferreds
  15756. deferred.promise( jqXHR );
  15757. // Add protocol if not provided (prefilters might expect it)
  15758. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15759. // We also use the url parameter if available
  15760. s.url = ( ( url || s.url || location.href ) + "" )
  15761. .replace( rprotocol, location.protocol + "//" );
  15762. // Alias method option to type as per ticket #12004
  15763. s.type = options.method || options.type || s.method || s.type;
  15764. // Extract dataTypes list
  15765. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15766. // A cross-domain request is in order when the origin doesn't match the current origin.
  15767. if ( s.crossDomain == null ) {
  15768. urlAnchor = document.createElement( "a" );
  15769. // Support: IE <=8 - 11, Edge 12 - 15
  15770. // IE throws exception on accessing the href property if url is malformed,
  15771. // e.g. http://example.com:80x/
  15772. try {
  15773. urlAnchor.href = s.url;
  15774. // Support: IE <=8 - 11 only
  15775. // Anchor's host property isn't correctly set when s.url is relative
  15776. urlAnchor.href = urlAnchor.href;
  15777. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15778. urlAnchor.protocol + "//" + urlAnchor.host;
  15779. } catch ( e ) {
  15780. // If there is an error parsing the URL, assume it is crossDomain,
  15781. // it can be rejected by the transport if it is invalid
  15782. s.crossDomain = true;
  15783. }
  15784. }
  15785. // Convert data if not already a string
  15786. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15787. s.data = jQuery.param( s.data, s.traditional );
  15788. }
  15789. // Apply prefilters
  15790. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15791. // If request was aborted inside a prefilter, stop there
  15792. if ( completed ) {
  15793. return jqXHR;
  15794. }
  15795. // We can fire global events as of now if asked to
  15796. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15797. fireGlobals = jQuery.event && s.global;
  15798. // Watch for a new set of requests
  15799. if ( fireGlobals && jQuery.active++ === 0 ) {
  15800. jQuery.event.trigger( "ajaxStart" );
  15801. }
  15802. // Uppercase the type
  15803. s.type = s.type.toUpperCase();
  15804. // Determine if request has content
  15805. s.hasContent = !rnoContent.test( s.type );
  15806. // Save the URL in case we're toying with the If-Modified-Since
  15807. // and/or If-None-Match header later on
  15808. // Remove hash to simplify url manipulation
  15809. cacheURL = s.url.replace( rhash, "" );
  15810. // More options handling for requests with no content
  15811. if ( !s.hasContent ) {
  15812. // Remember the hash so we can put it back
  15813. uncached = s.url.slice( cacheURL.length );
  15814. // If data is available and should be processed, append data to url
  15815. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15816. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15817. // #9682: remove data so that it's not used in an eventual retry
  15818. delete s.data;
  15819. }
  15820. // Add or update anti-cache param if needed
  15821. if ( s.cache === false ) {
  15822. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15823. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15824. }
  15825. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15826. s.url = cacheURL + uncached;
  15827. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15828. } else if ( s.data && s.processData &&
  15829. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15830. s.data = s.data.replace( r20, "+" );
  15831. }
  15832. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15833. if ( s.ifModified ) {
  15834. if ( jQuery.lastModified[ cacheURL ] ) {
  15835. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15836. }
  15837. if ( jQuery.etag[ cacheURL ] ) {
  15838. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15839. }
  15840. }
  15841. // Set the correct header, if data is being sent
  15842. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15843. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15844. }
  15845. // Set the Accepts header for the server, depending on the dataType
  15846. jqXHR.setRequestHeader(
  15847. "Accept",
  15848. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15849. s.accepts[ s.dataTypes[ 0 ] ] +
  15850. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15851. s.accepts[ "*" ]
  15852. );
  15853. // Check for headers option
  15854. for ( i in s.headers ) {
  15855. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15856. }
  15857. // Allow custom headers/mimetypes and early abort
  15858. if ( s.beforeSend &&
  15859. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15860. // Abort if not done already and return
  15861. return jqXHR.abort();
  15862. }
  15863. // Aborting is no longer a cancellation
  15864. strAbort = "abort";
  15865. // Install callbacks on deferreds
  15866. completeDeferred.add( s.complete );
  15867. jqXHR.done( s.success );
  15868. jqXHR.fail( s.error );
  15869. // Get transport
  15870. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15871. // If no transport, we auto-abort
  15872. if ( !transport ) {
  15873. done( -1, "No Transport" );
  15874. } else {
  15875. jqXHR.readyState = 1;
  15876. // Send global event
  15877. if ( fireGlobals ) {
  15878. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15879. }
  15880. // If request was aborted inside ajaxSend, stop there
  15881. if ( completed ) {
  15882. return jqXHR;
  15883. }
  15884. // Timeout
  15885. if ( s.async && s.timeout > 0 ) {
  15886. timeoutTimer = window.setTimeout( function() {
  15887. jqXHR.abort( "timeout" );
  15888. }, s.timeout );
  15889. }
  15890. try {
  15891. completed = false;
  15892. transport.send( requestHeaders, done );
  15893. } catch ( e ) {
  15894. // Rethrow post-completion exceptions
  15895. if ( completed ) {
  15896. throw e;
  15897. }
  15898. // Propagate others as results
  15899. done( -1, e );
  15900. }
  15901. }
  15902. // Callback for when everything is done
  15903. function done( status, nativeStatusText, responses, headers ) {
  15904. var isSuccess, success, error, response, modified,
  15905. statusText = nativeStatusText;
  15906. // Ignore repeat invocations
  15907. if ( completed ) {
  15908. return;
  15909. }
  15910. completed = true;
  15911. // Clear timeout if it exists
  15912. if ( timeoutTimer ) {
  15913. window.clearTimeout( timeoutTimer );
  15914. }
  15915. // Dereference transport for early garbage collection
  15916. // (no matter how long the jqXHR object will be used)
  15917. transport = undefined;
  15918. // Cache response headers
  15919. responseHeadersString = headers || "";
  15920. // Set readyState
  15921. jqXHR.readyState = status > 0 ? 4 : 0;
  15922. // Determine if successful
  15923. isSuccess = status >= 200 && status < 300 || status === 304;
  15924. // Get response data
  15925. if ( responses ) {
  15926. response = ajaxHandleResponses( s, jqXHR, responses );
  15927. }
  15928. // Convert no matter what (that way responseXXX fields are always set)
  15929. response = ajaxConvert( s, response, jqXHR, isSuccess );
  15930. // If successful, handle type chaining
  15931. if ( isSuccess ) {
  15932. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15933. if ( s.ifModified ) {
  15934. modified = jqXHR.getResponseHeader( "Last-Modified" );
  15935. if ( modified ) {
  15936. jQuery.lastModified[ cacheURL ] = modified;
  15937. }
  15938. modified = jqXHR.getResponseHeader( "etag" );
  15939. if ( modified ) {
  15940. jQuery.etag[ cacheURL ] = modified;
  15941. }
  15942. }
  15943. // if no content
  15944. if ( status === 204 || s.type === "HEAD" ) {
  15945. statusText = "nocontent";
  15946. // if not modified
  15947. } else if ( status === 304 ) {
  15948. statusText = "notmodified";
  15949. // If we have data, let's convert it
  15950. } else {
  15951. statusText = response.state;
  15952. success = response.data;
  15953. error = response.error;
  15954. isSuccess = !error;
  15955. }
  15956. } else {
  15957. // Extract error from statusText and normalize for non-aborts
  15958. error = statusText;
  15959. if ( status || !statusText ) {
  15960. statusText = "error";
  15961. if ( status < 0 ) {
  15962. status = 0;
  15963. }
  15964. }
  15965. }
  15966. // Set data for the fake xhr object
  15967. jqXHR.status = status;
  15968. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  15969. // Success/Error
  15970. if ( isSuccess ) {
  15971. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  15972. } else {
  15973. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  15974. }
  15975. // Status-dependent callbacks
  15976. jqXHR.statusCode( statusCode );
  15977. statusCode = undefined;
  15978. if ( fireGlobals ) {
  15979. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  15980. [ jqXHR, s, isSuccess ? success : error ] );
  15981. }
  15982. // Complete
  15983. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  15984. if ( fireGlobals ) {
  15985. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  15986. // Handle the global AJAX counter
  15987. if ( !( --jQuery.active ) ) {
  15988. jQuery.event.trigger( "ajaxStop" );
  15989. }
  15990. }
  15991. }
  15992. return jqXHR;
  15993. },
  15994. getJSON: function( url, data, callback ) {
  15995. return jQuery.get( url, data, callback, "json" );
  15996. },
  15997. getScript: function( url, callback ) {
  15998. return jQuery.get( url, undefined, callback, "script" );
  15999. }
  16000. } );
  16001. jQuery.each( [ "get", "post" ], function( i, method ) {
  16002. jQuery[ method ] = function( url, data, callback, type ) {
  16003. // Shift arguments if data argument was omitted
  16004. if ( isFunction( data ) ) {
  16005. type = type || callback;
  16006. callback = data;
  16007. data = undefined;
  16008. }
  16009. // The url can be an options object (which then must have .url)
  16010. return jQuery.ajax( jQuery.extend( {
  16011. url: url,
  16012. type: method,
  16013. dataType: type,
  16014. data: data,
  16015. success: callback
  16016. }, jQuery.isPlainObject( url ) && url ) );
  16017. };
  16018. } );
  16019. jQuery._evalUrl = function( url, options ) {
  16020. return jQuery.ajax( {
  16021. url: url,
  16022. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16023. type: "GET",
  16024. dataType: "script",
  16025. cache: true,
  16026. async: false,
  16027. global: false,
  16028. // Only evaluate the response if it is successful (gh-4126)
  16029. // dataFilter is not invoked for failure responses, so using it instead
  16030. // of the default converter is kludgy but it works.
  16031. converters: {
  16032. "text script": function() {}
  16033. },
  16034. dataFilter: function( response ) {
  16035. jQuery.globalEval( response, options );
  16036. }
  16037. } );
  16038. };
  16039. jQuery.fn.extend( {
  16040. wrapAll: function( html ) {
  16041. var wrap;
  16042. if ( this[ 0 ] ) {
  16043. if ( isFunction( html ) ) {
  16044. html = html.call( this[ 0 ] );
  16045. }
  16046. // The elements to wrap the target around
  16047. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16048. if ( this[ 0 ].parentNode ) {
  16049. wrap.insertBefore( this[ 0 ] );
  16050. }
  16051. wrap.map( function() {
  16052. var elem = this;
  16053. while ( elem.firstElementChild ) {
  16054. elem = elem.firstElementChild;
  16055. }
  16056. return elem;
  16057. } ).append( this );
  16058. }
  16059. return this;
  16060. },
  16061. wrapInner: function( html ) {
  16062. if ( isFunction( html ) ) {
  16063. return this.each( function( i ) {
  16064. jQuery( this ).wrapInner( html.call( this, i ) );
  16065. } );
  16066. }
  16067. return this.each( function() {
  16068. var self = jQuery( this ),
  16069. contents = self.contents();
  16070. if ( contents.length ) {
  16071. contents.wrapAll( html );
  16072. } else {
  16073. self.append( html );
  16074. }
  16075. } );
  16076. },
  16077. wrap: function( html ) {
  16078. var htmlIsFunction = isFunction( html );
  16079. return this.each( function( i ) {
  16080. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16081. } );
  16082. },
  16083. unwrap: function( selector ) {
  16084. this.parent( selector ).not( "body" ).each( function() {
  16085. jQuery( this ).replaceWith( this.childNodes );
  16086. } );
  16087. return this;
  16088. }
  16089. } );
  16090. jQuery.expr.pseudos.hidden = function( elem ) {
  16091. return !jQuery.expr.pseudos.visible( elem );
  16092. };
  16093. jQuery.expr.pseudos.visible = function( elem ) {
  16094. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16095. };
  16096. jQuery.ajaxSettings.xhr = function() {
  16097. try {
  16098. return new window.XMLHttpRequest();
  16099. } catch ( e ) {}
  16100. };
  16101. var xhrSuccessStatus = {
  16102. // File protocol always yields status code 0, assume 200
  16103. 0: 200,
  16104. // Support: IE <=9 only
  16105. // #1450: sometimes IE returns 1223 when it should be 204
  16106. 1223: 204
  16107. },
  16108. xhrSupported = jQuery.ajaxSettings.xhr();
  16109. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16110. support.ajax = xhrSupported = !!xhrSupported;
  16111. jQuery.ajaxTransport( function( options ) {
  16112. var callback, errorCallback;
  16113. // Cross domain only allowed if supported through XMLHttpRequest
  16114. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16115. return {
  16116. send: function( headers, complete ) {
  16117. var i,
  16118. xhr = options.xhr();
  16119. xhr.open(
  16120. options.type,
  16121. options.url,
  16122. options.async,
  16123. options.username,
  16124. options.password
  16125. );
  16126. // Apply custom fields if provided
  16127. if ( options.xhrFields ) {
  16128. for ( i in options.xhrFields ) {
  16129. xhr[ i ] = options.xhrFields[ i ];
  16130. }
  16131. }
  16132. // Override mime type if needed
  16133. if ( options.mimeType && xhr.overrideMimeType ) {
  16134. xhr.overrideMimeType( options.mimeType );
  16135. }
  16136. // X-Requested-With header
  16137. // For cross-domain requests, seeing as conditions for a preflight are
  16138. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16139. // (it can always be set on a per-request basis or even using ajaxSetup)
  16140. // For same-domain requests, won't change header if already provided.
  16141. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16142. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16143. }
  16144. // Set headers
  16145. for ( i in headers ) {
  16146. xhr.setRequestHeader( i, headers[ i ] );
  16147. }
  16148. // Callback
  16149. callback = function( type ) {
  16150. return function() {
  16151. if ( callback ) {
  16152. callback = errorCallback = xhr.onload =
  16153. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16154. xhr.onreadystatechange = null;
  16155. if ( type === "abort" ) {
  16156. xhr.abort();
  16157. } else if ( type === "error" ) {
  16158. // Support: IE <=9 only
  16159. // On a manual native abort, IE9 throws
  16160. // errors on any property access that is not readyState
  16161. if ( typeof xhr.status !== "number" ) {
  16162. complete( 0, "error" );
  16163. } else {
  16164. complete(
  16165. // File: protocol always yields status 0; see #8605, #14207
  16166. xhr.status,
  16167. xhr.statusText
  16168. );
  16169. }
  16170. } else {
  16171. complete(
  16172. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16173. xhr.statusText,
  16174. // Support: IE <=9 only
  16175. // IE9 has no XHR2 but throws on binary (trac-11426)
  16176. // For XHR2 non-text, let the caller handle it (gh-2498)
  16177. ( xhr.responseType || "text" ) !== "text" ||
  16178. typeof xhr.responseText !== "string" ?
  16179. { binary: xhr.response } :
  16180. { text: xhr.responseText },
  16181. xhr.getAllResponseHeaders()
  16182. );
  16183. }
  16184. }
  16185. };
  16186. };
  16187. // Listen to events
  16188. xhr.onload = callback();
  16189. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16190. // Support: IE 9 only
  16191. // Use onreadystatechange to replace onabort
  16192. // to handle uncaught aborts
  16193. if ( xhr.onabort !== undefined ) {
  16194. xhr.onabort = errorCallback;
  16195. } else {
  16196. xhr.onreadystatechange = function() {
  16197. // Check readyState before timeout as it changes
  16198. if ( xhr.readyState === 4 ) {
  16199. // Allow onerror to be called first,
  16200. // but that will not handle a native abort
  16201. // Also, save errorCallback to a variable
  16202. // as xhr.onerror cannot be accessed
  16203. window.setTimeout( function() {
  16204. if ( callback ) {
  16205. errorCallback();
  16206. }
  16207. } );
  16208. }
  16209. };
  16210. }
  16211. // Create the abort callback
  16212. callback = callback( "abort" );
  16213. try {
  16214. // Do send the request (this may raise an exception)
  16215. xhr.send( options.hasContent && options.data || null );
  16216. } catch ( e ) {
  16217. // #14683: Only rethrow if this hasn't been notified as an error yet
  16218. if ( callback ) {
  16219. throw e;
  16220. }
  16221. }
  16222. },
  16223. abort: function() {
  16224. if ( callback ) {
  16225. callback();
  16226. }
  16227. }
  16228. };
  16229. }
  16230. } );
  16231. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16232. jQuery.ajaxPrefilter( function( s ) {
  16233. if ( s.crossDomain ) {
  16234. s.contents.script = false;
  16235. }
  16236. } );
  16237. // Install script dataType
  16238. jQuery.ajaxSetup( {
  16239. accepts: {
  16240. script: "text/javascript, application/javascript, " +
  16241. "application/ecmascript, application/x-ecmascript"
  16242. },
  16243. contents: {
  16244. script: /\b(?:java|ecma)script\b/
  16245. },
  16246. converters: {
  16247. "text script": function( text ) {
  16248. jQuery.globalEval( text );
  16249. return text;
  16250. }
  16251. }
  16252. } );
  16253. // Handle cache's special case and crossDomain
  16254. jQuery.ajaxPrefilter( "script", function( s ) {
  16255. if ( s.cache === undefined ) {
  16256. s.cache = false;
  16257. }
  16258. if ( s.crossDomain ) {
  16259. s.type = "GET";
  16260. }
  16261. } );
  16262. // Bind script tag hack transport
  16263. jQuery.ajaxTransport( "script", function( s ) {
  16264. // This transport only deals with cross domain or forced-by-attrs requests
  16265. if ( s.crossDomain || s.scriptAttrs ) {
  16266. var script, callback;
  16267. return {
  16268. send: function( _, complete ) {
  16269. script = jQuery( "<script>" )
  16270. .attr( s.scriptAttrs || {} )
  16271. .prop( { charset: s.scriptCharset, src: s.url } )
  16272. .on( "load error", callback = function( evt ) {
  16273. script.remove();
  16274. callback = null;
  16275. if ( evt ) {
  16276. complete( evt.type === "error" ? 404 : 200, evt.type );
  16277. }
  16278. } );
  16279. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16280. document.head.appendChild( script[ 0 ] );
  16281. },
  16282. abort: function() {
  16283. if ( callback ) {
  16284. callback();
  16285. }
  16286. }
  16287. };
  16288. }
  16289. } );
  16290. var oldCallbacks = [],
  16291. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16292. // Default jsonp settings
  16293. jQuery.ajaxSetup( {
  16294. jsonp: "callback",
  16295. jsonpCallback: function() {
  16296. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16297. this[ callback ] = true;
  16298. return callback;
  16299. }
  16300. } );
  16301. // Detect, normalize options and install callbacks for jsonp requests
  16302. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16303. var callbackName, overwritten, responseContainer,
  16304. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16305. "url" :
  16306. typeof s.data === "string" &&
  16307. ( s.contentType || "" )
  16308. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16309. rjsonp.test( s.data ) && "data"
  16310. );
  16311. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16312. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16313. // Get callback name, remembering preexisting value associated with it
  16314. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16315. s.jsonpCallback() :
  16316. s.jsonpCallback;
  16317. // Insert callback into url or form data
  16318. if ( jsonProp ) {
  16319. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16320. } else if ( s.jsonp !== false ) {
  16321. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16322. }
  16323. // Use data converter to retrieve json after script execution
  16324. s.converters[ "script json" ] = function() {
  16325. if ( !responseContainer ) {
  16326. jQuery.error( callbackName + " was not called" );
  16327. }
  16328. return responseContainer[ 0 ];
  16329. };
  16330. // Force json dataType
  16331. s.dataTypes[ 0 ] = "json";
  16332. // Install callback
  16333. overwritten = window[ callbackName ];
  16334. window[ callbackName ] = function() {
  16335. responseContainer = arguments;
  16336. };
  16337. // Clean-up function (fires after converters)
  16338. jqXHR.always( function() {
  16339. // If previous value didn't exist - remove it
  16340. if ( overwritten === undefined ) {
  16341. jQuery( window ).removeProp( callbackName );
  16342. // Otherwise restore preexisting value
  16343. } else {
  16344. window[ callbackName ] = overwritten;
  16345. }
  16346. // Save back as free
  16347. if ( s[ callbackName ] ) {
  16348. // Make sure that re-using the options doesn't screw things around
  16349. s.jsonpCallback = originalSettings.jsonpCallback;
  16350. // Save the callback name for future use
  16351. oldCallbacks.push( callbackName );
  16352. }
  16353. // Call if it was a function and we have a response
  16354. if ( responseContainer && isFunction( overwritten ) ) {
  16355. overwritten( responseContainer[ 0 ] );
  16356. }
  16357. responseContainer = overwritten = undefined;
  16358. } );
  16359. // Delegate to script
  16360. return "script";
  16361. }
  16362. } );
  16363. // Support: Safari 8 only
  16364. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16365. // collapse sibling forms: the second one becomes a child of the first one.
  16366. // Because of that, this security measure has to be disabled in Safari 8.
  16367. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16368. support.createHTMLDocument = ( function() {
  16369. var body = document.implementation.createHTMLDocument( "" ).body;
  16370. body.innerHTML = "<form></form><form></form>";
  16371. return body.childNodes.length === 2;
  16372. } )();
  16373. // Argument "data" should be string of html
  16374. // context (optional): If specified, the fragment will be created in this context,
  16375. // defaults to document
  16376. // keepScripts (optional): If true, will include scripts passed in the html string
  16377. jQuery.parseHTML = function( data, context, keepScripts ) {
  16378. if ( typeof data !== "string" ) {
  16379. return [];
  16380. }
  16381. if ( typeof context === "boolean" ) {
  16382. keepScripts = context;
  16383. context = false;
  16384. }
  16385. var base, parsed, scripts;
  16386. if ( !context ) {
  16387. // Stop scripts or inline event handlers from being executed immediately
  16388. // by using document.implementation
  16389. if ( support.createHTMLDocument ) {
  16390. context = document.implementation.createHTMLDocument( "" );
  16391. // Set the base href for the created document
  16392. // so any parsed elements with URLs
  16393. // are based on the document's URL (gh-2965)
  16394. base = context.createElement( "base" );
  16395. base.href = document.location.href;
  16396. context.head.appendChild( base );
  16397. } else {
  16398. context = document;
  16399. }
  16400. }
  16401. parsed = rsingleTag.exec( data );
  16402. scripts = !keepScripts && [];
  16403. // Single tag
  16404. if ( parsed ) {
  16405. return [ context.createElement( parsed[ 1 ] ) ];
  16406. }
  16407. parsed = buildFragment( [ data ], context, scripts );
  16408. if ( scripts && scripts.length ) {
  16409. jQuery( scripts ).remove();
  16410. }
  16411. return jQuery.merge( [], parsed.childNodes );
  16412. };
  16413. /**
  16414. * Load a url into a page
  16415. */
  16416. jQuery.fn.load = function( url, params, callback ) {
  16417. var selector, type, response,
  16418. self = this,
  16419. off = url.indexOf( " " );
  16420. if ( off > -1 ) {
  16421. selector = stripAndCollapse( url.slice( off ) );
  16422. url = url.slice( 0, off );
  16423. }
  16424. // If it's a function
  16425. if ( isFunction( params ) ) {
  16426. // We assume that it's the callback
  16427. callback = params;
  16428. params = undefined;
  16429. // Otherwise, build a param string
  16430. } else if ( params && typeof params === "object" ) {
  16431. type = "POST";
  16432. }
  16433. // If we have elements to modify, make the request
  16434. if ( self.length > 0 ) {
  16435. jQuery.ajax( {
  16436. url: url,
  16437. // If "type" variable is undefined, then "GET" method will be used.
  16438. // Make value of this field explicit since
  16439. // user can override it through ajaxSetup method
  16440. type: type || "GET",
  16441. dataType: "html",
  16442. data: params
  16443. } ).done( function( responseText ) {
  16444. // Save response for use in complete callback
  16445. response = arguments;
  16446. self.html( selector ?
  16447. // If a selector was specified, locate the right elements in a dummy div
  16448. // Exclude scripts to avoid IE 'Permission Denied' errors
  16449. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16450. // Otherwise use the full result
  16451. responseText );
  16452. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16453. // but they are ignored because response was set above.
  16454. // If it fails, this function gets "jqXHR", "status", "error"
  16455. } ).always( callback && function( jqXHR, status ) {
  16456. self.each( function() {
  16457. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16458. } );
  16459. } );
  16460. }
  16461. return this;
  16462. };
  16463. // Attach a bunch of functions for handling common AJAX events
  16464. jQuery.each( [
  16465. "ajaxStart",
  16466. "ajaxStop",
  16467. "ajaxComplete",
  16468. "ajaxError",
  16469. "ajaxSuccess",
  16470. "ajaxSend"
  16471. ], function( i, type ) {
  16472. jQuery.fn[ type ] = function( fn ) {
  16473. return this.on( type, fn );
  16474. };
  16475. } );
  16476. jQuery.expr.pseudos.animated = function( elem ) {
  16477. return jQuery.grep( jQuery.timers, function( fn ) {
  16478. return elem === fn.elem;
  16479. } ).length;
  16480. };
  16481. jQuery.offset = {
  16482. setOffset: function( elem, options, i ) {
  16483. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16484. position = jQuery.css( elem, "position" ),
  16485. curElem = jQuery( elem ),
  16486. props = {};
  16487. // Set position first, in-case top/left are set even on static elem
  16488. if ( position === "static" ) {
  16489. elem.style.position = "relative";
  16490. }
  16491. curOffset = curElem.offset();
  16492. curCSSTop = jQuery.css( elem, "top" );
  16493. curCSSLeft = jQuery.css( elem, "left" );
  16494. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16495. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16496. // Need to be able to calculate position if either
  16497. // top or left is auto and position is either absolute or fixed
  16498. if ( calculatePosition ) {
  16499. curPosition = curElem.position();
  16500. curTop = curPosition.top;
  16501. curLeft = curPosition.left;
  16502. } else {
  16503. curTop = parseFloat( curCSSTop ) || 0;
  16504. curLeft = parseFloat( curCSSLeft ) || 0;
  16505. }
  16506. if ( isFunction( options ) ) {
  16507. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16508. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16509. }
  16510. if ( options.top != null ) {
  16511. props.top = ( options.top - curOffset.top ) + curTop;
  16512. }
  16513. if ( options.left != null ) {
  16514. props.left = ( options.left - curOffset.left ) + curLeft;
  16515. }
  16516. if ( "using" in options ) {
  16517. options.using.call( elem, props );
  16518. } else {
  16519. curElem.css( props );
  16520. }
  16521. }
  16522. };
  16523. jQuery.fn.extend( {
  16524. // offset() relates an element's border box to the document origin
  16525. offset: function( options ) {
  16526. // Preserve chaining for setter
  16527. if ( arguments.length ) {
  16528. return options === undefined ?
  16529. this :
  16530. this.each( function( i ) {
  16531. jQuery.offset.setOffset( this, options, i );
  16532. } );
  16533. }
  16534. var rect, win,
  16535. elem = this[ 0 ];
  16536. if ( !elem ) {
  16537. return;
  16538. }
  16539. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16540. // Support: IE <=11 only
  16541. // Running getBoundingClientRect on a
  16542. // disconnected node in IE throws an error
  16543. if ( !elem.getClientRects().length ) {
  16544. return { top: 0, left: 0 };
  16545. }
  16546. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16547. rect = elem.getBoundingClientRect();
  16548. win = elem.ownerDocument.defaultView;
  16549. return {
  16550. top: rect.top + win.pageYOffset,
  16551. left: rect.left + win.pageXOffset
  16552. };
  16553. },
  16554. // position() relates an element's margin box to its offset parent's padding box
  16555. // This corresponds to the behavior of CSS absolute positioning
  16556. position: function() {
  16557. if ( !this[ 0 ] ) {
  16558. return;
  16559. }
  16560. var offsetParent, offset, doc,
  16561. elem = this[ 0 ],
  16562. parentOffset = { top: 0, left: 0 };
  16563. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16564. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16565. // Assume position:fixed implies availability of getBoundingClientRect
  16566. offset = elem.getBoundingClientRect();
  16567. } else {
  16568. offset = this.offset();
  16569. // Account for the *real* offset parent, which can be the document or its root element
  16570. // when a statically positioned element is identified
  16571. doc = elem.ownerDocument;
  16572. offsetParent = elem.offsetParent || doc.documentElement;
  16573. while ( offsetParent &&
  16574. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16575. jQuery.css( offsetParent, "position" ) === "static" ) {
  16576. offsetParent = offsetParent.parentNode;
  16577. }
  16578. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16579. // Incorporate borders into its offset, since they are outside its content origin
  16580. parentOffset = jQuery( offsetParent ).offset();
  16581. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16582. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16583. }
  16584. }
  16585. // Subtract parent offsets and element margins
  16586. return {
  16587. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16588. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16589. };
  16590. },
  16591. // This method will return documentElement in the following cases:
  16592. // 1) For the element inside the iframe without offsetParent, this method will return
  16593. // documentElement of the parent window
  16594. // 2) For the hidden or detached element
  16595. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16596. //
  16597. // but those exceptions were never presented as a real life use-cases
  16598. // and might be considered as more preferable results.
  16599. //
  16600. // This logic, however, is not guaranteed and can change at any point in the future
  16601. offsetParent: function() {
  16602. return this.map( function() {
  16603. var offsetParent = this.offsetParent;
  16604. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16605. offsetParent = offsetParent.offsetParent;
  16606. }
  16607. return offsetParent || documentElement;
  16608. } );
  16609. }
  16610. } );
  16611. // Create scrollLeft and scrollTop methods
  16612. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16613. var top = "pageYOffset" === prop;
  16614. jQuery.fn[ method ] = function( val ) {
  16615. return access( this, function( elem, method, val ) {
  16616. // Coalesce documents and windows
  16617. var win;
  16618. if ( isWindow( elem ) ) {
  16619. win = elem;
  16620. } else if ( elem.nodeType === 9 ) {
  16621. win = elem.defaultView;
  16622. }
  16623. if ( val === undefined ) {
  16624. return win ? win[ prop ] : elem[ method ];
  16625. }
  16626. if ( win ) {
  16627. win.scrollTo(
  16628. !top ? val : win.pageXOffset,
  16629. top ? val : win.pageYOffset
  16630. );
  16631. } else {
  16632. elem[ method ] = val;
  16633. }
  16634. }, method, val, arguments.length );
  16635. };
  16636. } );
  16637. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16638. // Add the top/left cssHooks using jQuery.fn.position
  16639. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16640. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16641. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16642. // rather than make the css module depend on the offset module, just check for it here
  16643. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16644. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16645. function( elem, computed ) {
  16646. if ( computed ) {
  16647. computed = curCSS( elem, prop );
  16648. // If curCSS returns percentage, fallback to offset
  16649. return rnumnonpx.test( computed ) ?
  16650. jQuery( elem ).position()[ prop ] + "px" :
  16651. computed;
  16652. }
  16653. }
  16654. );
  16655. } );
  16656. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16657. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16658. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16659. function( defaultExtra, funcName ) {
  16660. // Margin is only for outerHeight, outerWidth
  16661. jQuery.fn[ funcName ] = function( margin, value ) {
  16662. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16663. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16664. return access( this, function( elem, type, value ) {
  16665. var doc;
  16666. if ( isWindow( elem ) ) {
  16667. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16668. return funcName.indexOf( "outer" ) === 0 ?
  16669. elem[ "inner" + name ] :
  16670. elem.document.documentElement[ "client" + name ];
  16671. }
  16672. // Get document width or height
  16673. if ( elem.nodeType === 9 ) {
  16674. doc = elem.documentElement;
  16675. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16676. // whichever is greatest
  16677. return Math.max(
  16678. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16679. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16680. doc[ "client" + name ]
  16681. );
  16682. }
  16683. return value === undefined ?
  16684. // Get width or height on the element, requesting but not forcing parseFloat
  16685. jQuery.css( elem, type, extra ) :
  16686. // Set width or height on the element
  16687. jQuery.style( elem, type, value, extra );
  16688. }, type, chainable ? margin : undefined, chainable );
  16689. };
  16690. } );
  16691. } );
  16692. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16693. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16694. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16695. function( i, name ) {
  16696. // Handle event binding
  16697. jQuery.fn[ name ] = function( data, fn ) {
  16698. return arguments.length > 0 ?
  16699. this.on( name, null, data, fn ) :
  16700. this.trigger( name );
  16701. };
  16702. } );
  16703. jQuery.fn.extend( {
  16704. hover: function( fnOver, fnOut ) {
  16705. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16706. }
  16707. } );
  16708. jQuery.fn.extend( {
  16709. bind: function( types, data, fn ) {
  16710. return this.on( types, null, data, fn );
  16711. },
  16712. unbind: function( types, fn ) {
  16713. return this.off( types, null, fn );
  16714. },
  16715. delegate: function( selector, types, data, fn ) {
  16716. return this.on( types, selector, data, fn );
  16717. },
  16718. undelegate: function( selector, types, fn ) {
  16719. // ( namespace ) or ( selector, types [, fn] )
  16720. return arguments.length === 1 ?
  16721. this.off( selector, "**" ) :
  16722. this.off( types, selector || "**", fn );
  16723. }
  16724. } );
  16725. // Bind a function to a context, optionally partially applying any
  16726. // arguments.
  16727. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16728. // However, it is not slated for removal any time soon
  16729. jQuery.proxy = function( fn, context ) {
  16730. var tmp, args, proxy;
  16731. if ( typeof context === "string" ) {
  16732. tmp = fn[ context ];
  16733. context = fn;
  16734. fn = tmp;
  16735. }
  16736. // Quick check to determine if target is callable, in the spec
  16737. // this throws a TypeError, but we will just return undefined.
  16738. if ( !isFunction( fn ) ) {
  16739. return undefined;
  16740. }
  16741. // Simulated bind
  16742. args = slice.call( arguments, 2 );
  16743. proxy = function() {
  16744. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16745. };
  16746. // Set the guid of unique handler to the same of original handler, so it can be removed
  16747. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16748. return proxy;
  16749. };
  16750. jQuery.holdReady = function( hold ) {
  16751. if ( hold ) {
  16752. jQuery.readyWait++;
  16753. } else {
  16754. jQuery.ready( true );
  16755. }
  16756. };
  16757. jQuery.isArray = Array.isArray;
  16758. jQuery.parseJSON = JSON.parse;
  16759. jQuery.nodeName = nodeName;
  16760. jQuery.isFunction = isFunction;
  16761. jQuery.isWindow = isWindow;
  16762. jQuery.camelCase = camelCase;
  16763. jQuery.type = toType;
  16764. jQuery.now = Date.now;
  16765. jQuery.isNumeric = function( obj ) {
  16766. // As of jQuery 3.0, isNumeric is limited to
  16767. // strings and numbers (primitives or objects)
  16768. // that can be coerced to finite numbers (gh-2662)
  16769. var type = jQuery.type( obj );
  16770. return ( type === "number" || type === "string" ) &&
  16771. // parseFloat NaNs numeric-cast false positives ("")
  16772. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16773. // subtraction forces infinities to NaN
  16774. !isNaN( obj - parseFloat( obj ) );
  16775. };
  16776. // Register as a named AMD module, since jQuery can be concatenated with other
  16777. // files that may use define, but not via a proper concatenation script that
  16778. // understands anonymous AMD modules. A named AMD is safest and most robust
  16779. // way to register. Lowercase jquery is used because AMD module names are
  16780. // derived from file names, and jQuery is normally delivered in a lowercase
  16781. // file name. Do this after creating the global so that if an AMD module wants
  16782. // to call noConflict to hide this version of jQuery, it will work.
  16783. // Note that for maximum portability, libraries that are not jQuery should
  16784. // declare themselves as anonymous modules, and avoid setting a global if an
  16785. // AMD loader is present. jQuery is a special case. For more information, see
  16786. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16787. if ( true ) {
  16788. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16789. return jQuery;
  16790. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16791. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16792. }
  16793. var
  16794. // Map over jQuery in case of overwrite
  16795. _jQuery = window.jQuery,
  16796. // Map over the $ in case of overwrite
  16797. _$ = window.$;
  16798. jQuery.noConflict = function( deep ) {
  16799. if ( window.$ === jQuery ) {
  16800. window.$ = _$;
  16801. }
  16802. if ( deep && window.jQuery === jQuery ) {
  16803. window.jQuery = _jQuery;
  16804. }
  16805. return jQuery;
  16806. };
  16807. // Expose jQuery and $ identifiers, even in AMD
  16808. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16809. // and CommonJS for browser emulators (#13566)
  16810. if ( !noGlobal ) {
  16811. window.jQuery = window.$ = jQuery;
  16812. }
  16813. return jQuery;
  16814. } );
  16815. /***/ }),
  16816. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16817. /*!************************************************!*\
  16818. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16819. \************************************************/
  16820. /*! exports provided: default */
  16821. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16822. "use strict";
  16823. __webpack_require__.r(__webpack_exports__);
  16824. var classCallCheck = function (instance, Constructor) {
  16825. if (!(instance instanceof Constructor)) {
  16826. throw new TypeError("Cannot call a class as a function");
  16827. }
  16828. };
  16829. var createClass = function () {
  16830. function defineProperties(target, props) {
  16831. for (var i = 0; i < props.length; i++) {
  16832. var descriptor = props[i];
  16833. descriptor.enumerable = descriptor.enumerable || false;
  16834. descriptor.configurable = true;
  16835. if ("value" in descriptor) descriptor.writable = true;
  16836. Object.defineProperty(target, descriptor.key, descriptor);
  16837. }
  16838. }
  16839. return function (Constructor, protoProps, staticProps) {
  16840. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16841. if (staticProps) defineProperties(Constructor, staticProps);
  16842. return Constructor;
  16843. };
  16844. }();
  16845. var _extends = Object.assign || function (target) {
  16846. for (var i = 1; i < arguments.length; i++) {
  16847. var source = arguments[i];
  16848. for (var key in source) {
  16849. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16850. target[key] = source[key];
  16851. }
  16852. }
  16853. }
  16854. return target;
  16855. };
  16856. var inherits = function (subClass, superClass) {
  16857. if (typeof superClass !== "function" && superClass !== null) {
  16858. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16859. }
  16860. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16861. constructor: {
  16862. value: subClass,
  16863. enumerable: false,
  16864. writable: true,
  16865. configurable: true
  16866. }
  16867. });
  16868. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16869. };
  16870. var possibleConstructorReturn = function (self, call) {
  16871. if (!self) {
  16872. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16873. }
  16874. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16875. };
  16876. var Connector = function () {
  16877. /**
  16878. * Create a new class instance.
  16879. */
  16880. function Connector(options) {
  16881. classCallCheck(this, Connector);
  16882. /**
  16883. * Default connector options.
  16884. */
  16885. this._defaultOptions = {
  16886. auth: {
  16887. headers: {}
  16888. },
  16889. authEndpoint: '/broadcasting/auth',
  16890. broadcaster: 'pusher',
  16891. csrfToken: null,
  16892. host: null,
  16893. key: null,
  16894. namespace: 'App.Events'
  16895. };
  16896. this.setOptions(options);
  16897. this.connect();
  16898. }
  16899. /**
  16900. * Merge the custom options with the defaults.
  16901. */
  16902. createClass(Connector, [{
  16903. key: 'setOptions',
  16904. value: function setOptions(options) {
  16905. this.options = _extends(this._defaultOptions, options);
  16906. if (this.csrfToken()) {
  16907. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16908. }
  16909. return options;
  16910. }
  16911. /**
  16912. * Extract the CSRF token from the page.
  16913. */
  16914. }, {
  16915. key: 'csrfToken',
  16916. value: function csrfToken() {
  16917. var selector = void 0;
  16918. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16919. return window['Laravel'].csrfToken;
  16920. } else if (this.options.csrfToken) {
  16921. return this.options.csrfToken;
  16922. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16923. return selector.getAttribute('content');
  16924. }
  16925. return null;
  16926. }
  16927. }]);
  16928. return Connector;
  16929. }();
  16930. /**
  16931. * This class represents a basic channel.
  16932. */
  16933. var Channel = function () {
  16934. function Channel() {
  16935. classCallCheck(this, Channel);
  16936. }
  16937. createClass(Channel, [{
  16938. key: 'listenForWhisper',
  16939. /**
  16940. * Listen for a whisper event on the channel instance.
  16941. */
  16942. value: function listenForWhisper(event, callback) {
  16943. return this.listen('.client-' + event, callback);
  16944. }
  16945. /**
  16946. * Listen for an event on the channel instance.
  16947. */
  16948. }, {
  16949. key: 'notification',
  16950. value: function notification(callback) {
  16951. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  16952. }
  16953. /**
  16954. * Stop listening for a whispser event on the channel instance.
  16955. */
  16956. }, {
  16957. key: 'stopListeningForWhisper',
  16958. value: function stopListeningForWhisper(event) {
  16959. return this.stopListening('.client-' + event);
  16960. }
  16961. }]);
  16962. return Channel;
  16963. }();
  16964. /**
  16965. * Event name formatter
  16966. */
  16967. var EventFormatter = function () {
  16968. /**
  16969. * Create a new class instance.
  16970. */
  16971. function EventFormatter(namespace) {
  16972. classCallCheck(this, EventFormatter);
  16973. this.setNamespace(namespace);
  16974. }
  16975. /**
  16976. * Format the given event name.
  16977. */
  16978. createClass(EventFormatter, [{
  16979. key: 'format',
  16980. value: function format(event) {
  16981. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  16982. return event.substr(1);
  16983. } else if (this.namespace) {
  16984. event = this.namespace + '.' + event;
  16985. }
  16986. return event.replace(/\./g, '\\');
  16987. }
  16988. /**
  16989. * Set the event namespace.
  16990. */
  16991. }, {
  16992. key: 'setNamespace',
  16993. value: function setNamespace(value) {
  16994. this.namespace = value;
  16995. }
  16996. }]);
  16997. return EventFormatter;
  16998. }();
  16999. /**
  17000. * This class represents a Pusher channel.
  17001. */
  17002. var PusherChannel = function (_Channel) {
  17003. inherits(PusherChannel, _Channel);
  17004. /**
  17005. * Create a new class instance.
  17006. */
  17007. function PusherChannel(pusher, name, options) {
  17008. classCallCheck(this, PusherChannel);
  17009. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17010. _this.name = name;
  17011. _this.pusher = pusher;
  17012. _this.options = options;
  17013. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17014. _this.subscribe();
  17015. return _this;
  17016. }
  17017. /**
  17018. * Subscribe to a Pusher channel.
  17019. */
  17020. createClass(PusherChannel, [{
  17021. key: 'subscribe',
  17022. value: function subscribe() {
  17023. this.subscription = this.pusher.subscribe(this.name);
  17024. }
  17025. /**
  17026. * Unsubscribe from a Pusher channel.
  17027. */
  17028. }, {
  17029. key: 'unsubscribe',
  17030. value: function unsubscribe() {
  17031. this.pusher.unsubscribe(this.name);
  17032. }
  17033. /**
  17034. * Listen for an event on the channel instance.
  17035. */
  17036. }, {
  17037. key: 'listen',
  17038. value: function listen(event, callback) {
  17039. this.on(this.eventFormatter.format(event), callback);
  17040. return this;
  17041. }
  17042. /**
  17043. * Stop listening for an event on the channel instance.
  17044. */
  17045. }, {
  17046. key: 'stopListening',
  17047. value: function stopListening(event) {
  17048. this.subscription.unbind(this.eventFormatter.format(event));
  17049. return this;
  17050. }
  17051. /**
  17052. * Bind a channel to an event.
  17053. */
  17054. }, {
  17055. key: 'on',
  17056. value: function on(event, callback) {
  17057. this.subscription.bind(event, callback);
  17058. return this;
  17059. }
  17060. }]);
  17061. return PusherChannel;
  17062. }(Channel);
  17063. /**
  17064. * This class represents a Pusher private channel.
  17065. */
  17066. var PusherPrivateChannel = function (_PusherChannel) {
  17067. inherits(PusherPrivateChannel, _PusherChannel);
  17068. function PusherPrivateChannel() {
  17069. classCallCheck(this, PusherPrivateChannel);
  17070. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17071. }
  17072. createClass(PusherPrivateChannel, [{
  17073. key: 'whisper',
  17074. /**
  17075. * Trigger client event on the channel.
  17076. */
  17077. value: function whisper(eventName, data) {
  17078. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17079. return this;
  17080. }
  17081. }]);
  17082. return PusherPrivateChannel;
  17083. }(PusherChannel);
  17084. /**
  17085. * This class represents a Pusher presence channel.
  17086. */
  17087. var PusherPresenceChannel = function (_PusherChannel) {
  17088. inherits(PusherPresenceChannel, _PusherChannel);
  17089. function PusherPresenceChannel() {
  17090. classCallCheck(this, PusherPresenceChannel);
  17091. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17092. }
  17093. createClass(PusherPresenceChannel, [{
  17094. key: 'here',
  17095. /**
  17096. * Register a callback to be called anytime the member list changes.
  17097. */
  17098. value: function here(callback) {
  17099. this.on('pusher:subscription_succeeded', function (data) {
  17100. callback(Object.keys(data.members).map(function (k) {
  17101. return data.members[k];
  17102. }));
  17103. });
  17104. return this;
  17105. }
  17106. /**
  17107. * Listen for someone joining the channel.
  17108. */
  17109. }, {
  17110. key: 'joining',
  17111. value: function joining(callback) {
  17112. this.on('pusher:member_added', function (member) {
  17113. callback(member.info);
  17114. });
  17115. return this;
  17116. }
  17117. /**
  17118. * Listen for someone leaving the channel.
  17119. */
  17120. }, {
  17121. key: 'leaving',
  17122. value: function leaving(callback) {
  17123. this.on('pusher:member_removed', function (member) {
  17124. callback(member.info);
  17125. });
  17126. return this;
  17127. }
  17128. /**
  17129. * Trigger client event on the channel.
  17130. */
  17131. }, {
  17132. key: 'whisper',
  17133. value: function whisper(eventName, data) {
  17134. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17135. return this;
  17136. }
  17137. }]);
  17138. return PusherPresenceChannel;
  17139. }(PusherChannel);
  17140. /**
  17141. * This class represents a Socket.io channel.
  17142. */
  17143. var SocketIoChannel = function (_Channel) {
  17144. inherits(SocketIoChannel, _Channel);
  17145. /**
  17146. * Create a new class instance.
  17147. */
  17148. function SocketIoChannel(socket, name, options) {
  17149. classCallCheck(this, SocketIoChannel);
  17150. /**
  17151. * The event callbacks applied to the channel.
  17152. */
  17153. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17154. _this.events = {};
  17155. _this.name = name;
  17156. _this.socket = socket;
  17157. _this.options = options;
  17158. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17159. _this.subscribe();
  17160. _this.configureReconnector();
  17161. return _this;
  17162. }
  17163. /**
  17164. * Subscribe to a Socket.io channel.
  17165. */
  17166. createClass(SocketIoChannel, [{
  17167. key: 'subscribe',
  17168. value: function subscribe() {
  17169. this.socket.emit('subscribe', {
  17170. channel: this.name,
  17171. auth: this.options.auth || {}
  17172. });
  17173. }
  17174. /**
  17175. * Unsubscribe from channel and ubind event callbacks.
  17176. */
  17177. }, {
  17178. key: 'unsubscribe',
  17179. value: function unsubscribe() {
  17180. this.unbind();
  17181. this.socket.emit('unsubscribe', {
  17182. channel: this.name,
  17183. auth: this.options.auth || {}
  17184. });
  17185. }
  17186. /**
  17187. * Listen for an event on the channel instance.
  17188. */
  17189. }, {
  17190. key: 'listen',
  17191. value: function listen(event, callback) {
  17192. this.on(this.eventFormatter.format(event), callback);
  17193. return this;
  17194. }
  17195. /**
  17196. * Stop listening for an event on the channel instance.
  17197. */
  17198. }, {
  17199. key: 'stopListening',
  17200. value: function stopListening(event) {
  17201. var name = this.eventFormatter.format(event);
  17202. this.socket.removeListener(name);
  17203. delete this.events[name];
  17204. return this;
  17205. }
  17206. /**
  17207. * Bind the channel's socket to an event and store the callback.
  17208. */
  17209. }, {
  17210. key: 'on',
  17211. value: function on(event, callback) {
  17212. var _this2 = this;
  17213. var listener = function listener(channel, data) {
  17214. if (_this2.name == channel) {
  17215. callback(data);
  17216. }
  17217. };
  17218. this.socket.on(event, listener);
  17219. this.bind(event, listener);
  17220. }
  17221. /**
  17222. * Attach a 'reconnect' listener and bind the event.
  17223. */
  17224. }, {
  17225. key: 'configureReconnector',
  17226. value: function configureReconnector() {
  17227. var _this3 = this;
  17228. var listener = function listener() {
  17229. _this3.subscribe();
  17230. };
  17231. this.socket.on('reconnect', listener);
  17232. this.bind('reconnect', listener);
  17233. }
  17234. /**
  17235. * Bind the channel's socket to an event and store the callback.
  17236. */
  17237. }, {
  17238. key: 'bind',
  17239. value: function bind(event, callback) {
  17240. this.events[event] = this.events[event] || [];
  17241. this.events[event].push(callback);
  17242. }
  17243. /**
  17244. * Unbind the channel's socket from all stored event callbacks.
  17245. */
  17246. }, {
  17247. key: 'unbind',
  17248. value: function unbind() {
  17249. var _this4 = this;
  17250. Object.keys(this.events).forEach(function (event) {
  17251. _this4.events[event].forEach(function (callback) {
  17252. _this4.socket.removeListener(event, callback);
  17253. });
  17254. delete _this4.events[event];
  17255. });
  17256. }
  17257. }]);
  17258. return SocketIoChannel;
  17259. }(Channel);
  17260. /**
  17261. * This class represents a Socket.io presence channel.
  17262. */
  17263. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17264. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17265. function SocketIoPrivateChannel() {
  17266. classCallCheck(this, SocketIoPrivateChannel);
  17267. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17268. }
  17269. createClass(SocketIoPrivateChannel, [{
  17270. key: 'whisper',
  17271. /**
  17272. * Trigger client event on the channel.
  17273. */
  17274. value: function whisper(eventName, data) {
  17275. this.socket.emit('client event', {
  17276. channel: this.name,
  17277. event: 'client-' + eventName,
  17278. data: data
  17279. });
  17280. return this;
  17281. }
  17282. }]);
  17283. return SocketIoPrivateChannel;
  17284. }(SocketIoChannel);
  17285. /**
  17286. * This class represents a Socket.io presence channel.
  17287. */
  17288. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17289. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17290. function SocketIoPresenceChannel() {
  17291. classCallCheck(this, SocketIoPresenceChannel);
  17292. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17293. }
  17294. createClass(SocketIoPresenceChannel, [{
  17295. key: 'here',
  17296. /**
  17297. * Register a callback to be called anytime the member list changes.
  17298. */
  17299. value: function here(callback) {
  17300. this.on('presence:subscribed', function (members) {
  17301. callback(members.map(function (m) {
  17302. return m.user_info;
  17303. }));
  17304. });
  17305. return this;
  17306. }
  17307. /**
  17308. * Listen for someone joining the channel.
  17309. */
  17310. }, {
  17311. key: 'joining',
  17312. value: function joining(callback) {
  17313. this.on('presence:joining', function (member) {
  17314. return callback(member.user_info);
  17315. });
  17316. return this;
  17317. }
  17318. /**
  17319. * Listen for someone leaving the channel.
  17320. */
  17321. }, {
  17322. key: 'leaving',
  17323. value: function leaving(callback) {
  17324. this.on('presence:leaving', function (member) {
  17325. return callback(member.user_info);
  17326. });
  17327. return this;
  17328. }
  17329. }]);
  17330. return SocketIoPresenceChannel;
  17331. }(SocketIoPrivateChannel);
  17332. /**
  17333. * This class represents a null channel.
  17334. */
  17335. var NullChannel = function (_Channel) {
  17336. inherits(NullChannel, _Channel);
  17337. function NullChannel() {
  17338. classCallCheck(this, NullChannel);
  17339. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17340. }
  17341. createClass(NullChannel, [{
  17342. key: 'subscribe',
  17343. /**
  17344. * Subscribe to a channel.
  17345. */
  17346. value: function subscribe() {}
  17347. //
  17348. /**
  17349. * Unsubscribe from a channel.
  17350. */
  17351. }, {
  17352. key: 'unsubscribe',
  17353. value: function unsubscribe() {}
  17354. //
  17355. /**
  17356. * Listen for an event on the channel instance.
  17357. */
  17358. }, {
  17359. key: 'listen',
  17360. value: function listen(event, callback) {
  17361. return this;
  17362. }
  17363. /**
  17364. * Stop listening for an event on the channel instance.
  17365. */
  17366. }, {
  17367. key: 'stopListening',
  17368. value: function stopListening(event) {
  17369. return this;
  17370. }
  17371. /**
  17372. * Bind a channel to an event.
  17373. */
  17374. }, {
  17375. key: 'on',
  17376. value: function on(event, callback) {
  17377. return this;
  17378. }
  17379. }]);
  17380. return NullChannel;
  17381. }(Channel);
  17382. /**
  17383. * This class represents a null private channel.
  17384. */
  17385. var NullPrivateChannel = function (_NullChannel) {
  17386. inherits(NullPrivateChannel, _NullChannel);
  17387. function NullPrivateChannel() {
  17388. classCallCheck(this, NullPrivateChannel);
  17389. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17390. }
  17391. createClass(NullPrivateChannel, [{
  17392. key: 'whisper',
  17393. /**
  17394. * Trigger client event on the channel.
  17395. */
  17396. value: function whisper(eventName, data) {
  17397. return this;
  17398. }
  17399. }]);
  17400. return NullPrivateChannel;
  17401. }(NullChannel);
  17402. /**
  17403. * This class represents a null presence channel.
  17404. */
  17405. var NullPresenceChannel = function (_NullChannel) {
  17406. inherits(NullPresenceChannel, _NullChannel);
  17407. function NullPresenceChannel() {
  17408. classCallCheck(this, NullPresenceChannel);
  17409. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17410. }
  17411. createClass(NullPresenceChannel, [{
  17412. key: 'here',
  17413. /**
  17414. * Register a callback to be called anytime the member list changes.
  17415. */
  17416. value: function here(callback) {
  17417. return this;
  17418. }
  17419. /**
  17420. * Listen for someone joining the channel.
  17421. */
  17422. }, {
  17423. key: 'joining',
  17424. value: function joining(callback) {
  17425. return this;
  17426. }
  17427. /**
  17428. * Listen for someone leaving the channel.
  17429. */
  17430. }, {
  17431. key: 'leaving',
  17432. value: function leaving(callback) {
  17433. return this;
  17434. }
  17435. /**
  17436. * Trigger client event on the channel.
  17437. */
  17438. }, {
  17439. key: 'whisper',
  17440. value: function whisper(eventName, data) {
  17441. return this;
  17442. }
  17443. }]);
  17444. return NullPresenceChannel;
  17445. }(NullChannel);
  17446. /**
  17447. * This class creates a connector to Pusher.
  17448. */
  17449. var PusherConnector = function (_Connector) {
  17450. inherits(PusherConnector, _Connector);
  17451. function PusherConnector() {
  17452. classCallCheck(this, PusherConnector);
  17453. /**
  17454. * All of the subscribed channel names.
  17455. */
  17456. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17457. _this.channels = {};
  17458. return _this;
  17459. }
  17460. /**
  17461. * Create a fresh Pusher connection.
  17462. */
  17463. createClass(PusherConnector, [{
  17464. key: 'connect',
  17465. value: function connect() {
  17466. if (typeof this.options.client !== 'undefined') {
  17467. this.pusher = this.options.client;
  17468. } else {
  17469. this.pusher = new Pusher(this.options.key, this.options);
  17470. }
  17471. }
  17472. /**
  17473. * Listen for an event on a channel instance.
  17474. */
  17475. }, {
  17476. key: 'listen',
  17477. value: function listen(name, event, callback) {
  17478. return this.channel(name).listen(event, callback);
  17479. }
  17480. /**
  17481. * Get a channel instance by name.
  17482. */
  17483. }, {
  17484. key: 'channel',
  17485. value: function channel(name) {
  17486. if (!this.channels[name]) {
  17487. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17488. }
  17489. return this.channels[name];
  17490. }
  17491. /**
  17492. * Get a private channel instance by name.
  17493. */
  17494. }, {
  17495. key: 'privateChannel',
  17496. value: function privateChannel(name) {
  17497. if (!this.channels['private-' + name]) {
  17498. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17499. }
  17500. return this.channels['private-' + name];
  17501. }
  17502. /**
  17503. * Get a presence channel instance by name.
  17504. */
  17505. }, {
  17506. key: 'presenceChannel',
  17507. value: function presenceChannel(name) {
  17508. if (!this.channels['presence-' + name]) {
  17509. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17510. }
  17511. return this.channels['presence-' + name];
  17512. }
  17513. /**
  17514. * Leave the given channel, as well as its private and presence variants.
  17515. */
  17516. }, {
  17517. key: 'leave',
  17518. value: function leave(name) {
  17519. var _this2 = this;
  17520. var channels = [name, 'private-' + name, 'presence-' + name];
  17521. channels.forEach(function (name, index) {
  17522. _this2.leaveChannel(name);
  17523. });
  17524. }
  17525. /**
  17526. * Leave the given channel.
  17527. */
  17528. }, {
  17529. key: 'leaveChannel',
  17530. value: function leaveChannel(name) {
  17531. if (this.channels[name]) {
  17532. this.channels[name].unsubscribe();
  17533. delete this.channels[name];
  17534. }
  17535. }
  17536. /**
  17537. * Get the socket ID for the connection.
  17538. */
  17539. }, {
  17540. key: 'socketId',
  17541. value: function socketId() {
  17542. return this.pusher.connection.socket_id;
  17543. }
  17544. /**
  17545. * Disconnect Pusher connection.
  17546. */
  17547. }, {
  17548. key: 'disconnect',
  17549. value: function disconnect() {
  17550. this.pusher.disconnect();
  17551. }
  17552. }]);
  17553. return PusherConnector;
  17554. }(Connector);
  17555. /**
  17556. * This class creates a connnector to a Socket.io server.
  17557. */
  17558. var SocketIoConnector = function (_Connector) {
  17559. inherits(SocketIoConnector, _Connector);
  17560. function SocketIoConnector() {
  17561. classCallCheck(this, SocketIoConnector);
  17562. /**
  17563. * All of the subscribed channel names.
  17564. */
  17565. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17566. _this.channels = {};
  17567. return _this;
  17568. }
  17569. /**
  17570. * Create a fresh Socket.io connection.
  17571. */
  17572. createClass(SocketIoConnector, [{
  17573. key: 'connect',
  17574. value: function connect() {
  17575. var io = this.getSocketIO();
  17576. this.socket = io(this.options.host, this.options);
  17577. return this.socket;
  17578. }
  17579. /**
  17580. * Get socket.io module from global scope or options.
  17581. */
  17582. }, {
  17583. key: 'getSocketIO',
  17584. value: function getSocketIO() {
  17585. if (typeof this.options.client !== 'undefined') {
  17586. return this.options.client;
  17587. }
  17588. if (typeof io !== 'undefined') {
  17589. return io;
  17590. }
  17591. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17592. }
  17593. /**
  17594. * Listen for an event on a channel instance.
  17595. */
  17596. }, {
  17597. key: 'listen',
  17598. value: function listen(name, event, callback) {
  17599. return this.channel(name).listen(event, callback);
  17600. }
  17601. /**
  17602. * Get a channel instance by name.
  17603. */
  17604. }, {
  17605. key: 'channel',
  17606. value: function channel(name) {
  17607. if (!this.channels[name]) {
  17608. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17609. }
  17610. return this.channels[name];
  17611. }
  17612. /**
  17613. * Get a private channel instance by name.
  17614. */
  17615. }, {
  17616. key: 'privateChannel',
  17617. value: function privateChannel(name) {
  17618. if (!this.channels['private-' + name]) {
  17619. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17620. }
  17621. return this.channels['private-' + name];
  17622. }
  17623. /**
  17624. * Get a presence channel instance by name.
  17625. */
  17626. }, {
  17627. key: 'presenceChannel',
  17628. value: function presenceChannel(name) {
  17629. if (!this.channels['presence-' + name]) {
  17630. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17631. }
  17632. return this.channels['presence-' + name];
  17633. }
  17634. /**
  17635. * Leave the given channel, as well as its private and presence variants.
  17636. */
  17637. }, {
  17638. key: 'leave',
  17639. value: function leave(name) {
  17640. var _this2 = this;
  17641. var channels = [name, 'private-' + name, 'presence-' + name];
  17642. channels.forEach(function (name) {
  17643. _this2.leaveChannel(name);
  17644. });
  17645. }
  17646. /**
  17647. * Leave the given channel.
  17648. */
  17649. }, {
  17650. key: 'leaveChannel',
  17651. value: function leaveChannel(name) {
  17652. if (this.channels[name]) {
  17653. this.channels[name].unsubscribe();
  17654. delete this.channels[name];
  17655. }
  17656. }
  17657. /**
  17658. * Get the socket ID for the connection.
  17659. */
  17660. }, {
  17661. key: 'socketId',
  17662. value: function socketId() {
  17663. return this.socket.id;
  17664. }
  17665. /**
  17666. * Disconnect Socketio connection.
  17667. */
  17668. }, {
  17669. key: 'disconnect',
  17670. value: function disconnect() {
  17671. this.socket.disconnect();
  17672. }
  17673. }]);
  17674. return SocketIoConnector;
  17675. }(Connector);
  17676. /**
  17677. * This class creates a null connector.
  17678. */
  17679. var NullConnector = function (_Connector) {
  17680. inherits(NullConnector, _Connector);
  17681. function NullConnector() {
  17682. classCallCheck(this, NullConnector);
  17683. /**
  17684. * All of the subscribed channel names.
  17685. */
  17686. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17687. _this.channels = {};
  17688. return _this;
  17689. }
  17690. /**
  17691. * Create a fresh connection.
  17692. */
  17693. createClass(NullConnector, [{
  17694. key: 'connect',
  17695. value: function connect() {}
  17696. //
  17697. /**
  17698. * Listen for an event on a channel instance.
  17699. */
  17700. }, {
  17701. key: 'listen',
  17702. value: function listen(name, event, callback) {
  17703. return new NullChannel();
  17704. }
  17705. /**
  17706. * Get a channel instance by name.
  17707. */
  17708. }, {
  17709. key: 'channel',
  17710. value: function channel(name) {
  17711. return new NullChannel();
  17712. }
  17713. /**
  17714. * Get a private channel instance by name.
  17715. */
  17716. }, {
  17717. key: 'privateChannel',
  17718. value: function privateChannel(name) {
  17719. return new NullPrivateChannel();
  17720. }
  17721. /**
  17722. * Get a presence channel instance by name.
  17723. */
  17724. }, {
  17725. key: 'presenceChannel',
  17726. value: function presenceChannel(name) {
  17727. return new NullPresenceChannel();
  17728. }
  17729. /**
  17730. * Leave the given channel, as well as its private and presence variants.
  17731. */
  17732. }, {
  17733. key: 'leave',
  17734. value: function leave(name) {}
  17735. //
  17736. /**
  17737. * Leave the given channel.
  17738. */
  17739. }, {
  17740. key: 'leaveChannel',
  17741. value: function leaveChannel(name) {}
  17742. //
  17743. /**
  17744. * Get the socket ID for the connection.
  17745. */
  17746. }, {
  17747. key: 'socketId',
  17748. value: function socketId() {
  17749. return 'fake-socket-id';
  17750. }
  17751. /**
  17752. * Disconnect the connection.
  17753. */
  17754. }, {
  17755. key: 'disconnect',
  17756. value: function disconnect() {
  17757. //
  17758. }
  17759. }]);
  17760. return NullConnector;
  17761. }(Connector);
  17762. /**
  17763. * This class is the primary API for interacting with broadcasting.
  17764. */
  17765. var Echo = function () {
  17766. /**
  17767. * Create a new class instance.
  17768. */
  17769. function Echo(options) {
  17770. classCallCheck(this, Echo);
  17771. this.options = options;
  17772. this.connect();
  17773. if (!this.options.withoutInterceptors) {
  17774. this.registerInterceptors();
  17775. }
  17776. }
  17777. /**
  17778. * Get a channel instance by name.
  17779. */
  17780. createClass(Echo, [{
  17781. key: 'channel',
  17782. value: function channel(_channel) {
  17783. return this.connector.channel(_channel);
  17784. }
  17785. /**
  17786. * Create a new connection.
  17787. */
  17788. }, {
  17789. key: 'connect',
  17790. value: function connect() {
  17791. if (this.options.broadcaster == 'pusher') {
  17792. this.connector = new PusherConnector(this.options);
  17793. } else if (this.options.broadcaster == 'socket.io') {
  17794. this.connector = new SocketIoConnector(this.options);
  17795. } else if (this.options.broadcaster == 'null') {
  17796. this.connector = new NullConnector(this.options);
  17797. } else if (typeof this.options.broadcaster == 'function') {
  17798. this.connector = new this.options.broadcaster(this.options);
  17799. }
  17800. }
  17801. /**
  17802. * Disconnect from the Echo server.
  17803. */
  17804. }, {
  17805. key: 'disconnect',
  17806. value: function disconnect() {
  17807. this.connector.disconnect();
  17808. }
  17809. /**
  17810. * Get a presence channel instance by name.
  17811. */
  17812. }, {
  17813. key: 'join',
  17814. value: function join(channel) {
  17815. return this.connector.presenceChannel(channel);
  17816. }
  17817. /**
  17818. * Leave the given channel, as well as its private and presence variants.
  17819. */
  17820. }, {
  17821. key: 'leave',
  17822. value: function leave(channel) {
  17823. this.connector.leave(channel);
  17824. }
  17825. /**
  17826. * Leave the given channel.
  17827. */
  17828. }, {
  17829. key: 'leaveChannel',
  17830. value: function leaveChannel(channel) {
  17831. this.connector.leaveChannel(channel);
  17832. }
  17833. /**
  17834. * Listen for an event on a channel instance.
  17835. */
  17836. }, {
  17837. key: 'listen',
  17838. value: function listen(channel, event, callback) {
  17839. return this.connector.listen(channel, event, callback);
  17840. }
  17841. /**
  17842. * Get a private channel instance by name.
  17843. */
  17844. }, {
  17845. key: 'private',
  17846. value: function _private(channel) {
  17847. return this.connector.privateChannel(channel);
  17848. }
  17849. /**
  17850. * Get the Socket ID for the connection.
  17851. */
  17852. }, {
  17853. key: 'socketId',
  17854. value: function socketId() {
  17855. return this.connector.socketId();
  17856. }
  17857. /**
  17858. * Register 3rd party request interceptiors. These are used to automatically
  17859. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17860. */
  17861. }, {
  17862. key: 'registerInterceptors',
  17863. value: function registerInterceptors() {
  17864. if (typeof Vue === 'function' && Vue.http) {
  17865. this.registerVueRequestInterceptor();
  17866. }
  17867. if (typeof axios === 'function') {
  17868. this.registerAxiosRequestInterceptor();
  17869. }
  17870. if (typeof jQuery === 'function') {
  17871. this.registerjQueryAjaxSetup();
  17872. }
  17873. }
  17874. /**
  17875. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17876. */
  17877. }, {
  17878. key: 'registerVueRequestInterceptor',
  17879. value: function registerVueRequestInterceptor() {
  17880. var _this = this;
  17881. Vue.http.interceptors.push(function (request, next) {
  17882. if (_this.socketId()) {
  17883. request.headers.set('X-Socket-ID', _this.socketId());
  17884. }
  17885. next();
  17886. });
  17887. }
  17888. /**
  17889. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17890. */
  17891. }, {
  17892. key: 'registerAxiosRequestInterceptor',
  17893. value: function registerAxiosRequestInterceptor() {
  17894. var _this2 = this;
  17895. axios.interceptors.request.use(function (config) {
  17896. if (_this2.socketId()) {
  17897. config.headers['X-Socket-Id'] = _this2.socketId();
  17898. }
  17899. return config;
  17900. });
  17901. }
  17902. /**
  17903. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17904. */
  17905. }, {
  17906. key: 'registerjQueryAjaxSetup',
  17907. value: function registerjQueryAjaxSetup() {
  17908. var _this3 = this;
  17909. if (typeof jQuery.ajax != 'undefined') {
  17910. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17911. if (_this3.socketId()) {
  17912. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17913. }
  17914. });
  17915. }
  17916. }
  17917. }]);
  17918. return Echo;
  17919. }();
  17920. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17921. /***/ }),
  17922. /***/ "./node_modules/lodash/lodash.js":
  17923. /*!***************************************!*\
  17924. !*** ./node_modules/lodash/lodash.js ***!
  17925. \***************************************/
  17926. /*! no static exports found */
  17927. /***/ (function(module, exports, __webpack_require__) {
  17928. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  17929. * @license
  17930. * Lodash <https://lodash.com/>
  17931. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  17932. * Released under MIT license <https://lodash.com/license>
  17933. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  17934. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  17935. */
  17936. ;(function() {
  17937. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  17938. var undefined;
  17939. /** Used as the semantic version number. */
  17940. var VERSION = '4.17.15';
  17941. /** Used as the size to enable large array optimizations. */
  17942. var LARGE_ARRAY_SIZE = 200;
  17943. /** Error message constants. */
  17944. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  17945. FUNC_ERROR_TEXT = 'Expected a function';
  17946. /** Used to stand-in for `undefined` hash values. */
  17947. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  17948. /** Used as the maximum memoize cache size. */
  17949. var MAX_MEMOIZE_SIZE = 500;
  17950. /** Used as the internal argument placeholder. */
  17951. var PLACEHOLDER = '__lodash_placeholder__';
  17952. /** Used to compose bitmasks for cloning. */
  17953. var CLONE_DEEP_FLAG = 1,
  17954. CLONE_FLAT_FLAG = 2,
  17955. CLONE_SYMBOLS_FLAG = 4;
  17956. /** Used to compose bitmasks for value comparisons. */
  17957. var COMPARE_PARTIAL_FLAG = 1,
  17958. COMPARE_UNORDERED_FLAG = 2;
  17959. /** Used to compose bitmasks for function metadata. */
  17960. var WRAP_BIND_FLAG = 1,
  17961. WRAP_BIND_KEY_FLAG = 2,
  17962. WRAP_CURRY_BOUND_FLAG = 4,
  17963. WRAP_CURRY_FLAG = 8,
  17964. WRAP_CURRY_RIGHT_FLAG = 16,
  17965. WRAP_PARTIAL_FLAG = 32,
  17966. WRAP_PARTIAL_RIGHT_FLAG = 64,
  17967. WRAP_ARY_FLAG = 128,
  17968. WRAP_REARG_FLAG = 256,
  17969. WRAP_FLIP_FLAG = 512;
  17970. /** Used as default options for `_.truncate`. */
  17971. var DEFAULT_TRUNC_LENGTH = 30,
  17972. DEFAULT_TRUNC_OMISSION = '...';
  17973. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  17974. var HOT_COUNT = 800,
  17975. HOT_SPAN = 16;
  17976. /** Used to indicate the type of lazy iteratees. */
  17977. var LAZY_FILTER_FLAG = 1,
  17978. LAZY_MAP_FLAG = 2,
  17979. LAZY_WHILE_FLAG = 3;
  17980. /** Used as references for various `Number` constants. */
  17981. var INFINITY = 1 / 0,
  17982. MAX_SAFE_INTEGER = 9007199254740991,
  17983. MAX_INTEGER = 1.7976931348623157e+308,
  17984. NAN = 0 / 0;
  17985. /** Used as references for the maximum length and index of an array. */
  17986. var MAX_ARRAY_LENGTH = 4294967295,
  17987. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  17988. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  17989. /** Used to associate wrap methods with their bit flags. */
  17990. var wrapFlags = [
  17991. ['ary', WRAP_ARY_FLAG],
  17992. ['bind', WRAP_BIND_FLAG],
  17993. ['bindKey', WRAP_BIND_KEY_FLAG],
  17994. ['curry', WRAP_CURRY_FLAG],
  17995. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  17996. ['flip', WRAP_FLIP_FLAG],
  17997. ['partial', WRAP_PARTIAL_FLAG],
  17998. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  17999. ['rearg', WRAP_REARG_FLAG]
  18000. ];
  18001. /** `Object#toString` result references. */
  18002. var argsTag = '[object Arguments]',
  18003. arrayTag = '[object Array]',
  18004. asyncTag = '[object AsyncFunction]',
  18005. boolTag = '[object Boolean]',
  18006. dateTag = '[object Date]',
  18007. domExcTag = '[object DOMException]',
  18008. errorTag = '[object Error]',
  18009. funcTag = '[object Function]',
  18010. genTag = '[object GeneratorFunction]',
  18011. mapTag = '[object Map]',
  18012. numberTag = '[object Number]',
  18013. nullTag = '[object Null]',
  18014. objectTag = '[object Object]',
  18015. promiseTag = '[object Promise]',
  18016. proxyTag = '[object Proxy]',
  18017. regexpTag = '[object RegExp]',
  18018. setTag = '[object Set]',
  18019. stringTag = '[object String]',
  18020. symbolTag = '[object Symbol]',
  18021. undefinedTag = '[object Undefined]',
  18022. weakMapTag = '[object WeakMap]',
  18023. weakSetTag = '[object WeakSet]';
  18024. var arrayBufferTag = '[object ArrayBuffer]',
  18025. dataViewTag = '[object DataView]',
  18026. float32Tag = '[object Float32Array]',
  18027. float64Tag = '[object Float64Array]',
  18028. int8Tag = '[object Int8Array]',
  18029. int16Tag = '[object Int16Array]',
  18030. int32Tag = '[object Int32Array]',
  18031. uint8Tag = '[object Uint8Array]',
  18032. uint8ClampedTag = '[object Uint8ClampedArray]',
  18033. uint16Tag = '[object Uint16Array]',
  18034. uint32Tag = '[object Uint32Array]';
  18035. /** Used to match empty string literals in compiled template source. */
  18036. var reEmptyStringLeading = /\b__p \+= '';/g,
  18037. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18038. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18039. /** Used to match HTML entities and HTML characters. */
  18040. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18041. reUnescapedHtml = /[&<>"']/g,
  18042. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18043. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18044. /** Used to match template delimiters. */
  18045. var reEscape = /<%-([\s\S]+?)%>/g,
  18046. reEvaluate = /<%([\s\S]+?)%>/g,
  18047. reInterpolate = /<%=([\s\S]+?)%>/g;
  18048. /** Used to match property names within property paths. */
  18049. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18050. reIsPlainProp = /^\w*$/,
  18051. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18052. /**
  18053. * Used to match `RegExp`
  18054. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18055. */
  18056. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18057. reHasRegExpChar = RegExp(reRegExpChar.source);
  18058. /** Used to match leading and trailing whitespace. */
  18059. var reTrim = /^\s+|\s+$/g,
  18060. reTrimStart = /^\s+/,
  18061. reTrimEnd = /\s+$/;
  18062. /** Used to match wrap detail comments. */
  18063. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18064. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18065. reSplitDetails = /,? & /;
  18066. /** Used to match words composed of alphanumeric characters. */
  18067. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18068. /** Used to match backslashes in property paths. */
  18069. var reEscapeChar = /\\(\\)?/g;
  18070. /**
  18071. * Used to match
  18072. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18073. */
  18074. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18075. /** Used to match `RegExp` flags from their coerced string values. */
  18076. var reFlags = /\w*$/;
  18077. /** Used to detect bad signed hexadecimal string values. */
  18078. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18079. /** Used to detect binary string values. */
  18080. var reIsBinary = /^0b[01]+$/i;
  18081. /** Used to detect host constructors (Safari). */
  18082. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18083. /** Used to detect octal string values. */
  18084. var reIsOctal = /^0o[0-7]+$/i;
  18085. /** Used to detect unsigned integer values. */
  18086. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18087. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18088. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18089. /** Used to ensure capturing order of template delimiters. */
  18090. var reNoMatch = /($^)/;
  18091. /** Used to match unescaped characters in compiled string literals. */
  18092. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18093. /** Used to compose unicode character classes. */
  18094. var rsAstralRange = '\\ud800-\\udfff',
  18095. rsComboMarksRange = '\\u0300-\\u036f',
  18096. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18097. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18098. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18099. rsDingbatRange = '\\u2700-\\u27bf',
  18100. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18101. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18102. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18103. rsPunctuationRange = '\\u2000-\\u206f',
  18104. 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',
  18105. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18106. rsVarRange = '\\ufe0e\\ufe0f',
  18107. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18108. /** Used to compose unicode capture groups. */
  18109. var rsApos = "['\u2019]",
  18110. rsAstral = '[' + rsAstralRange + ']',
  18111. rsBreak = '[' + rsBreakRange + ']',
  18112. rsCombo = '[' + rsComboRange + ']',
  18113. rsDigits = '\\d+',
  18114. rsDingbat = '[' + rsDingbatRange + ']',
  18115. rsLower = '[' + rsLowerRange + ']',
  18116. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18117. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18118. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18119. rsNonAstral = '[^' + rsAstralRange + ']',
  18120. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18121. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18122. rsUpper = '[' + rsUpperRange + ']',
  18123. rsZWJ = '\\u200d';
  18124. /** Used to compose unicode regexes. */
  18125. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18126. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18127. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18128. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18129. reOptMod = rsModifier + '?',
  18130. rsOptVar = '[' + rsVarRange + ']?',
  18131. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18132. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18133. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18134. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18135. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18136. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18137. /** Used to match apostrophes. */
  18138. var reApos = RegExp(rsApos, 'g');
  18139. /**
  18140. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18141. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18142. */
  18143. var reComboMark = RegExp(rsCombo, 'g');
  18144. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18145. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18146. /** Used to match complex or compound words. */
  18147. var reUnicodeWord = RegExp([
  18148. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18149. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18150. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18151. rsUpper + '+' + rsOptContrUpper,
  18152. rsOrdUpper,
  18153. rsOrdLower,
  18154. rsDigits,
  18155. rsEmoji
  18156. ].join('|'), 'g');
  18157. /** 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/). */
  18158. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18159. /** Used to detect strings that need a more robust regexp to match words. */
  18160. 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 ]/;
  18161. /** Used to assign default `context` object properties. */
  18162. var contextProps = [
  18163. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18164. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18165. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18166. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18167. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18168. ];
  18169. /** Used to make template sourceURLs easier to identify. */
  18170. var templateCounter = -1;
  18171. /** Used to identify `toStringTag` values of typed arrays. */
  18172. var typedArrayTags = {};
  18173. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18174. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18175. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18176. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18177. typedArrayTags[uint32Tag] = true;
  18178. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18179. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18180. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18181. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18182. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18183. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18184. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18185. typedArrayTags[weakMapTag] = false;
  18186. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18187. var cloneableTags = {};
  18188. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18189. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18190. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18191. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18192. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18193. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18194. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18195. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18196. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18197. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18198. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18199. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18200. cloneableTags[weakMapTag] = false;
  18201. /** Used to map Latin Unicode letters to basic Latin letters. */
  18202. var deburredLetters = {
  18203. // Latin-1 Supplement block.
  18204. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18205. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18206. '\xc7': 'C', '\xe7': 'c',
  18207. '\xd0': 'D', '\xf0': 'd',
  18208. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18209. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18210. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18211. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18212. '\xd1': 'N', '\xf1': 'n',
  18213. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18214. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18215. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18216. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18217. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18218. '\xc6': 'Ae', '\xe6': 'ae',
  18219. '\xde': 'Th', '\xfe': 'th',
  18220. '\xdf': 'ss',
  18221. // Latin Extended-A block.
  18222. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18223. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18224. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18225. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18226. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18227. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18228. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18229. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18230. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18231. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18232. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18233. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18234. '\u0134': 'J', '\u0135': 'j',
  18235. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18236. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18237. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18238. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18239. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18240. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18241. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18242. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18243. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18244. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18245. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18246. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18247. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18248. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18249. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18250. '\u0174': 'W', '\u0175': 'w',
  18251. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18252. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18253. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18254. '\u0132': 'IJ', '\u0133': 'ij',
  18255. '\u0152': 'Oe', '\u0153': 'oe',
  18256. '\u0149': "'n", '\u017f': 's'
  18257. };
  18258. /** Used to map characters to HTML entities. */
  18259. var htmlEscapes = {
  18260. '&': '&amp;',
  18261. '<': '&lt;',
  18262. '>': '&gt;',
  18263. '"': '&quot;',
  18264. "'": '&#39;'
  18265. };
  18266. /** Used to map HTML entities to characters. */
  18267. var htmlUnescapes = {
  18268. '&amp;': '&',
  18269. '&lt;': '<',
  18270. '&gt;': '>',
  18271. '&quot;': '"',
  18272. '&#39;': "'"
  18273. };
  18274. /** Used to escape characters for inclusion in compiled string literals. */
  18275. var stringEscapes = {
  18276. '\\': '\\',
  18277. "'": "'",
  18278. '\n': 'n',
  18279. '\r': 'r',
  18280. '\u2028': 'u2028',
  18281. '\u2029': 'u2029'
  18282. };
  18283. /** Built-in method references without a dependency on `root`. */
  18284. var freeParseFloat = parseFloat,
  18285. freeParseInt = parseInt;
  18286. /** Detect free variable `global` from Node.js. */
  18287. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18288. /** Detect free variable `self`. */
  18289. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18290. /** Used as a reference to the global object. */
  18291. var root = freeGlobal || freeSelf || Function('return this')();
  18292. /** Detect free variable `exports`. */
  18293. var freeExports = true && exports && !exports.nodeType && exports;
  18294. /** Detect free variable `module`. */
  18295. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18296. /** Detect the popular CommonJS extension `module.exports`. */
  18297. var moduleExports = freeModule && freeModule.exports === freeExports;
  18298. /** Detect free variable `process` from Node.js. */
  18299. var freeProcess = moduleExports && freeGlobal.process;
  18300. /** Used to access faster Node.js helpers. */
  18301. var nodeUtil = (function() {
  18302. try {
  18303. // Use `util.types` for Node.js 10+.
  18304. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18305. if (types) {
  18306. return types;
  18307. }
  18308. // Legacy `process.binding('util')` for Node.js < 10.
  18309. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18310. } catch (e) {}
  18311. }());
  18312. /* Node.js helper references. */
  18313. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18314. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18315. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18316. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18317. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18318. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18319. /*--------------------------------------------------------------------------*/
  18320. /**
  18321. * A faster alternative to `Function#apply`, this function invokes `func`
  18322. * with the `this` binding of `thisArg` and the arguments of `args`.
  18323. *
  18324. * @private
  18325. * @param {Function} func The function to invoke.
  18326. * @param {*} thisArg The `this` binding of `func`.
  18327. * @param {Array} args The arguments to invoke `func` with.
  18328. * @returns {*} Returns the result of `func`.
  18329. */
  18330. function apply(func, thisArg, args) {
  18331. switch (args.length) {
  18332. case 0: return func.call(thisArg);
  18333. case 1: return func.call(thisArg, args[0]);
  18334. case 2: return func.call(thisArg, args[0], args[1]);
  18335. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18336. }
  18337. return func.apply(thisArg, args);
  18338. }
  18339. /**
  18340. * A specialized version of `baseAggregator` for arrays.
  18341. *
  18342. * @private
  18343. * @param {Array} [array] The array to iterate over.
  18344. * @param {Function} setter The function to set `accumulator` values.
  18345. * @param {Function} iteratee The iteratee to transform keys.
  18346. * @param {Object} accumulator The initial aggregated object.
  18347. * @returns {Function} Returns `accumulator`.
  18348. */
  18349. function arrayAggregator(array, setter, iteratee, accumulator) {
  18350. var index = -1,
  18351. length = array == null ? 0 : array.length;
  18352. while (++index < length) {
  18353. var value = array[index];
  18354. setter(accumulator, value, iteratee(value), array);
  18355. }
  18356. return accumulator;
  18357. }
  18358. /**
  18359. * A specialized version of `_.forEach` for arrays without support for
  18360. * iteratee shorthands.
  18361. *
  18362. * @private
  18363. * @param {Array} [array] The array to iterate over.
  18364. * @param {Function} iteratee The function invoked per iteration.
  18365. * @returns {Array} Returns `array`.
  18366. */
  18367. function arrayEach(array, iteratee) {
  18368. var index = -1,
  18369. length = array == null ? 0 : array.length;
  18370. while (++index < length) {
  18371. if (iteratee(array[index], index, array) === false) {
  18372. break;
  18373. }
  18374. }
  18375. return array;
  18376. }
  18377. /**
  18378. * A specialized version of `_.forEachRight` for arrays without support for
  18379. * iteratee shorthands.
  18380. *
  18381. * @private
  18382. * @param {Array} [array] The array to iterate over.
  18383. * @param {Function} iteratee The function invoked per iteration.
  18384. * @returns {Array} Returns `array`.
  18385. */
  18386. function arrayEachRight(array, iteratee) {
  18387. var length = array == null ? 0 : array.length;
  18388. while (length--) {
  18389. if (iteratee(array[length], length, array) === false) {
  18390. break;
  18391. }
  18392. }
  18393. return array;
  18394. }
  18395. /**
  18396. * A specialized version of `_.every` for arrays without support for
  18397. * iteratee shorthands.
  18398. *
  18399. * @private
  18400. * @param {Array} [array] The array to iterate over.
  18401. * @param {Function} predicate The function invoked per iteration.
  18402. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18403. * else `false`.
  18404. */
  18405. function arrayEvery(array, predicate) {
  18406. var index = -1,
  18407. length = array == null ? 0 : array.length;
  18408. while (++index < length) {
  18409. if (!predicate(array[index], index, array)) {
  18410. return false;
  18411. }
  18412. }
  18413. return true;
  18414. }
  18415. /**
  18416. * A specialized version of `_.filter` for arrays without support for
  18417. * iteratee shorthands.
  18418. *
  18419. * @private
  18420. * @param {Array} [array] The array to iterate over.
  18421. * @param {Function} predicate The function invoked per iteration.
  18422. * @returns {Array} Returns the new filtered array.
  18423. */
  18424. function arrayFilter(array, predicate) {
  18425. var index = -1,
  18426. length = array == null ? 0 : array.length,
  18427. resIndex = 0,
  18428. result = [];
  18429. while (++index < length) {
  18430. var value = array[index];
  18431. if (predicate(value, index, array)) {
  18432. result[resIndex++] = value;
  18433. }
  18434. }
  18435. return result;
  18436. }
  18437. /**
  18438. * A specialized version of `_.includes` for arrays without support for
  18439. * specifying an index to search from.
  18440. *
  18441. * @private
  18442. * @param {Array} [array] The array to inspect.
  18443. * @param {*} target The value to search for.
  18444. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18445. */
  18446. function arrayIncludes(array, value) {
  18447. var length = array == null ? 0 : array.length;
  18448. return !!length && baseIndexOf(array, value, 0) > -1;
  18449. }
  18450. /**
  18451. * This function is like `arrayIncludes` except that it accepts a comparator.
  18452. *
  18453. * @private
  18454. * @param {Array} [array] The array to inspect.
  18455. * @param {*} target The value to search for.
  18456. * @param {Function} comparator The comparator invoked per element.
  18457. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18458. */
  18459. function arrayIncludesWith(array, value, comparator) {
  18460. var index = -1,
  18461. length = array == null ? 0 : array.length;
  18462. while (++index < length) {
  18463. if (comparator(value, array[index])) {
  18464. return true;
  18465. }
  18466. }
  18467. return false;
  18468. }
  18469. /**
  18470. * A specialized version of `_.map` for arrays without support for iteratee
  18471. * shorthands.
  18472. *
  18473. * @private
  18474. * @param {Array} [array] The array to iterate over.
  18475. * @param {Function} iteratee The function invoked per iteration.
  18476. * @returns {Array} Returns the new mapped array.
  18477. */
  18478. function arrayMap(array, iteratee) {
  18479. var index = -1,
  18480. length = array == null ? 0 : array.length,
  18481. result = Array(length);
  18482. while (++index < length) {
  18483. result[index] = iteratee(array[index], index, array);
  18484. }
  18485. return result;
  18486. }
  18487. /**
  18488. * Appends the elements of `values` to `array`.
  18489. *
  18490. * @private
  18491. * @param {Array} array The array to modify.
  18492. * @param {Array} values The values to append.
  18493. * @returns {Array} Returns `array`.
  18494. */
  18495. function arrayPush(array, values) {
  18496. var index = -1,
  18497. length = values.length,
  18498. offset = array.length;
  18499. while (++index < length) {
  18500. array[offset + index] = values[index];
  18501. }
  18502. return array;
  18503. }
  18504. /**
  18505. * A specialized version of `_.reduce` for arrays without support for
  18506. * iteratee shorthands.
  18507. *
  18508. * @private
  18509. * @param {Array} [array] The array to iterate over.
  18510. * @param {Function} iteratee The function invoked per iteration.
  18511. * @param {*} [accumulator] The initial value.
  18512. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18513. * the initial value.
  18514. * @returns {*} Returns the accumulated value.
  18515. */
  18516. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18517. var index = -1,
  18518. length = array == null ? 0 : array.length;
  18519. if (initAccum && length) {
  18520. accumulator = array[++index];
  18521. }
  18522. while (++index < length) {
  18523. accumulator = iteratee(accumulator, array[index], index, array);
  18524. }
  18525. return accumulator;
  18526. }
  18527. /**
  18528. * A specialized version of `_.reduceRight` for arrays without support for
  18529. * iteratee shorthands.
  18530. *
  18531. * @private
  18532. * @param {Array} [array] The array to iterate over.
  18533. * @param {Function} iteratee The function invoked per iteration.
  18534. * @param {*} [accumulator] The initial value.
  18535. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18536. * the initial value.
  18537. * @returns {*} Returns the accumulated value.
  18538. */
  18539. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18540. var length = array == null ? 0 : array.length;
  18541. if (initAccum && length) {
  18542. accumulator = array[--length];
  18543. }
  18544. while (length--) {
  18545. accumulator = iteratee(accumulator, array[length], length, array);
  18546. }
  18547. return accumulator;
  18548. }
  18549. /**
  18550. * A specialized version of `_.some` for arrays without support for iteratee
  18551. * shorthands.
  18552. *
  18553. * @private
  18554. * @param {Array} [array] The array to iterate over.
  18555. * @param {Function} predicate The function invoked per iteration.
  18556. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18557. * else `false`.
  18558. */
  18559. function arraySome(array, predicate) {
  18560. var index = -1,
  18561. length = array == null ? 0 : array.length;
  18562. while (++index < length) {
  18563. if (predicate(array[index], index, array)) {
  18564. return true;
  18565. }
  18566. }
  18567. return false;
  18568. }
  18569. /**
  18570. * Gets the size of an ASCII `string`.
  18571. *
  18572. * @private
  18573. * @param {string} string The string inspect.
  18574. * @returns {number} Returns the string size.
  18575. */
  18576. var asciiSize = baseProperty('length');
  18577. /**
  18578. * Converts an ASCII `string` to an array.
  18579. *
  18580. * @private
  18581. * @param {string} string The string to convert.
  18582. * @returns {Array} Returns the converted array.
  18583. */
  18584. function asciiToArray(string) {
  18585. return string.split('');
  18586. }
  18587. /**
  18588. * Splits an ASCII `string` into an array of its words.
  18589. *
  18590. * @private
  18591. * @param {string} The string to inspect.
  18592. * @returns {Array} Returns the words of `string`.
  18593. */
  18594. function asciiWords(string) {
  18595. return string.match(reAsciiWord) || [];
  18596. }
  18597. /**
  18598. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18599. * without support for iteratee shorthands, which iterates over `collection`
  18600. * using `eachFunc`.
  18601. *
  18602. * @private
  18603. * @param {Array|Object} collection The collection to inspect.
  18604. * @param {Function} predicate The function invoked per iteration.
  18605. * @param {Function} eachFunc The function to iterate over `collection`.
  18606. * @returns {*} Returns the found element or its key, else `undefined`.
  18607. */
  18608. function baseFindKey(collection, predicate, eachFunc) {
  18609. var result;
  18610. eachFunc(collection, function(value, key, collection) {
  18611. if (predicate(value, key, collection)) {
  18612. result = key;
  18613. return false;
  18614. }
  18615. });
  18616. return result;
  18617. }
  18618. /**
  18619. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18620. * support for iteratee shorthands.
  18621. *
  18622. * @private
  18623. * @param {Array} array The array to inspect.
  18624. * @param {Function} predicate The function invoked per iteration.
  18625. * @param {number} fromIndex The index to search from.
  18626. * @param {boolean} [fromRight] Specify iterating from right to left.
  18627. * @returns {number} Returns the index of the matched value, else `-1`.
  18628. */
  18629. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18630. var length = array.length,
  18631. index = fromIndex + (fromRight ? 1 : -1);
  18632. while ((fromRight ? index-- : ++index < length)) {
  18633. if (predicate(array[index], index, array)) {
  18634. return index;
  18635. }
  18636. }
  18637. return -1;
  18638. }
  18639. /**
  18640. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18641. *
  18642. * @private
  18643. * @param {Array} array The array to inspect.
  18644. * @param {*} value The value to search for.
  18645. * @param {number} fromIndex The index to search from.
  18646. * @returns {number} Returns the index of the matched value, else `-1`.
  18647. */
  18648. function baseIndexOf(array, value, fromIndex) {
  18649. return value === value
  18650. ? strictIndexOf(array, value, fromIndex)
  18651. : baseFindIndex(array, baseIsNaN, fromIndex);
  18652. }
  18653. /**
  18654. * This function is like `baseIndexOf` except that it accepts a comparator.
  18655. *
  18656. * @private
  18657. * @param {Array} array The array to inspect.
  18658. * @param {*} value The value to search for.
  18659. * @param {number} fromIndex The index to search from.
  18660. * @param {Function} comparator The comparator invoked per element.
  18661. * @returns {number} Returns the index of the matched value, else `-1`.
  18662. */
  18663. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18664. var index = fromIndex - 1,
  18665. length = array.length;
  18666. while (++index < length) {
  18667. if (comparator(array[index], value)) {
  18668. return index;
  18669. }
  18670. }
  18671. return -1;
  18672. }
  18673. /**
  18674. * The base implementation of `_.isNaN` without support for number objects.
  18675. *
  18676. * @private
  18677. * @param {*} value The value to check.
  18678. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18679. */
  18680. function baseIsNaN(value) {
  18681. return value !== value;
  18682. }
  18683. /**
  18684. * The base implementation of `_.mean` and `_.meanBy` without support for
  18685. * iteratee shorthands.
  18686. *
  18687. * @private
  18688. * @param {Array} array The array to iterate over.
  18689. * @param {Function} iteratee The function invoked per iteration.
  18690. * @returns {number} Returns the mean.
  18691. */
  18692. function baseMean(array, iteratee) {
  18693. var length = array == null ? 0 : array.length;
  18694. return length ? (baseSum(array, iteratee) / length) : NAN;
  18695. }
  18696. /**
  18697. * The base implementation of `_.property` without support for deep paths.
  18698. *
  18699. * @private
  18700. * @param {string} key The key of the property to get.
  18701. * @returns {Function} Returns the new accessor function.
  18702. */
  18703. function baseProperty(key) {
  18704. return function(object) {
  18705. return object == null ? undefined : object[key];
  18706. };
  18707. }
  18708. /**
  18709. * The base implementation of `_.propertyOf` without support for deep paths.
  18710. *
  18711. * @private
  18712. * @param {Object} object The object to query.
  18713. * @returns {Function} Returns the new accessor function.
  18714. */
  18715. function basePropertyOf(object) {
  18716. return function(key) {
  18717. return object == null ? undefined : object[key];
  18718. };
  18719. }
  18720. /**
  18721. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18722. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18723. *
  18724. * @private
  18725. * @param {Array|Object} collection The collection to iterate over.
  18726. * @param {Function} iteratee The function invoked per iteration.
  18727. * @param {*} accumulator The initial value.
  18728. * @param {boolean} initAccum Specify using the first or last element of
  18729. * `collection` as the initial value.
  18730. * @param {Function} eachFunc The function to iterate over `collection`.
  18731. * @returns {*} Returns the accumulated value.
  18732. */
  18733. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18734. eachFunc(collection, function(value, index, collection) {
  18735. accumulator = initAccum
  18736. ? (initAccum = false, value)
  18737. : iteratee(accumulator, value, index, collection);
  18738. });
  18739. return accumulator;
  18740. }
  18741. /**
  18742. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18743. * sort order of `array` and replaces criteria objects with their corresponding
  18744. * values.
  18745. *
  18746. * @private
  18747. * @param {Array} array The array to sort.
  18748. * @param {Function} comparer The function to define sort order.
  18749. * @returns {Array} Returns `array`.
  18750. */
  18751. function baseSortBy(array, comparer) {
  18752. var length = array.length;
  18753. array.sort(comparer);
  18754. while (length--) {
  18755. array[length] = array[length].value;
  18756. }
  18757. return array;
  18758. }
  18759. /**
  18760. * The base implementation of `_.sum` and `_.sumBy` without support for
  18761. * iteratee shorthands.
  18762. *
  18763. * @private
  18764. * @param {Array} array The array to iterate over.
  18765. * @param {Function} iteratee The function invoked per iteration.
  18766. * @returns {number} Returns the sum.
  18767. */
  18768. function baseSum(array, iteratee) {
  18769. var result,
  18770. index = -1,
  18771. length = array.length;
  18772. while (++index < length) {
  18773. var current = iteratee(array[index]);
  18774. if (current !== undefined) {
  18775. result = result === undefined ? current : (result + current);
  18776. }
  18777. }
  18778. return result;
  18779. }
  18780. /**
  18781. * The base implementation of `_.times` without support for iteratee shorthands
  18782. * or max array length checks.
  18783. *
  18784. * @private
  18785. * @param {number} n The number of times to invoke `iteratee`.
  18786. * @param {Function} iteratee The function invoked per iteration.
  18787. * @returns {Array} Returns the array of results.
  18788. */
  18789. function baseTimes(n, iteratee) {
  18790. var index = -1,
  18791. result = Array(n);
  18792. while (++index < n) {
  18793. result[index] = iteratee(index);
  18794. }
  18795. return result;
  18796. }
  18797. /**
  18798. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18799. * of key-value pairs for `object` corresponding to the property names of `props`.
  18800. *
  18801. * @private
  18802. * @param {Object} object The object to query.
  18803. * @param {Array} props The property names to get values for.
  18804. * @returns {Object} Returns the key-value pairs.
  18805. */
  18806. function baseToPairs(object, props) {
  18807. return arrayMap(props, function(key) {
  18808. return [key, object[key]];
  18809. });
  18810. }
  18811. /**
  18812. * The base implementation of `_.unary` without support for storing metadata.
  18813. *
  18814. * @private
  18815. * @param {Function} func The function to cap arguments for.
  18816. * @returns {Function} Returns the new capped function.
  18817. */
  18818. function baseUnary(func) {
  18819. return function(value) {
  18820. return func(value);
  18821. };
  18822. }
  18823. /**
  18824. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18825. * array of `object` property values corresponding to the property names
  18826. * of `props`.
  18827. *
  18828. * @private
  18829. * @param {Object} object The object to query.
  18830. * @param {Array} props The property names to get values for.
  18831. * @returns {Object} Returns the array of property values.
  18832. */
  18833. function baseValues(object, props) {
  18834. return arrayMap(props, function(key) {
  18835. return object[key];
  18836. });
  18837. }
  18838. /**
  18839. * Checks if a `cache` value for `key` exists.
  18840. *
  18841. * @private
  18842. * @param {Object} cache The cache to query.
  18843. * @param {string} key The key of the entry to check.
  18844. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18845. */
  18846. function cacheHas(cache, key) {
  18847. return cache.has(key);
  18848. }
  18849. /**
  18850. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18851. * that is not found in the character symbols.
  18852. *
  18853. * @private
  18854. * @param {Array} strSymbols The string symbols to inspect.
  18855. * @param {Array} chrSymbols The character symbols to find.
  18856. * @returns {number} Returns the index of the first unmatched string symbol.
  18857. */
  18858. function charsStartIndex(strSymbols, chrSymbols) {
  18859. var index = -1,
  18860. length = strSymbols.length;
  18861. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18862. return index;
  18863. }
  18864. /**
  18865. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18866. * that is not found in the character symbols.
  18867. *
  18868. * @private
  18869. * @param {Array} strSymbols The string symbols to inspect.
  18870. * @param {Array} chrSymbols The character symbols to find.
  18871. * @returns {number} Returns the index of the last unmatched string symbol.
  18872. */
  18873. function charsEndIndex(strSymbols, chrSymbols) {
  18874. var index = strSymbols.length;
  18875. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18876. return index;
  18877. }
  18878. /**
  18879. * Gets the number of `placeholder` occurrences in `array`.
  18880. *
  18881. * @private
  18882. * @param {Array} array The array to inspect.
  18883. * @param {*} placeholder The placeholder to search for.
  18884. * @returns {number} Returns the placeholder count.
  18885. */
  18886. function countHolders(array, placeholder) {
  18887. var length = array.length,
  18888. result = 0;
  18889. while (length--) {
  18890. if (array[length] === placeholder) {
  18891. ++result;
  18892. }
  18893. }
  18894. return result;
  18895. }
  18896. /**
  18897. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18898. * letters to basic Latin letters.
  18899. *
  18900. * @private
  18901. * @param {string} letter The matched letter to deburr.
  18902. * @returns {string} Returns the deburred letter.
  18903. */
  18904. var deburrLetter = basePropertyOf(deburredLetters);
  18905. /**
  18906. * Used by `_.escape` to convert characters to HTML entities.
  18907. *
  18908. * @private
  18909. * @param {string} chr The matched character to escape.
  18910. * @returns {string} Returns the escaped character.
  18911. */
  18912. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18913. /**
  18914. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18915. *
  18916. * @private
  18917. * @param {string} chr The matched character to escape.
  18918. * @returns {string} Returns the escaped character.
  18919. */
  18920. function escapeStringChar(chr) {
  18921. return '\\' + stringEscapes[chr];
  18922. }
  18923. /**
  18924. * Gets the value at `key` of `object`.
  18925. *
  18926. * @private
  18927. * @param {Object} [object] The object to query.
  18928. * @param {string} key The key of the property to get.
  18929. * @returns {*} Returns the property value.
  18930. */
  18931. function getValue(object, key) {
  18932. return object == null ? undefined : object[key];
  18933. }
  18934. /**
  18935. * Checks if `string` contains Unicode symbols.
  18936. *
  18937. * @private
  18938. * @param {string} string The string to inspect.
  18939. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18940. */
  18941. function hasUnicode(string) {
  18942. return reHasUnicode.test(string);
  18943. }
  18944. /**
  18945. * Checks if `string` contains a word composed of Unicode symbols.
  18946. *
  18947. * @private
  18948. * @param {string} string The string to inspect.
  18949. * @returns {boolean} Returns `true` if a word is found, else `false`.
  18950. */
  18951. function hasUnicodeWord(string) {
  18952. return reHasUnicodeWord.test(string);
  18953. }
  18954. /**
  18955. * Converts `iterator` to an array.
  18956. *
  18957. * @private
  18958. * @param {Object} iterator The iterator to convert.
  18959. * @returns {Array} Returns the converted array.
  18960. */
  18961. function iteratorToArray(iterator) {
  18962. var data,
  18963. result = [];
  18964. while (!(data = iterator.next()).done) {
  18965. result.push(data.value);
  18966. }
  18967. return result;
  18968. }
  18969. /**
  18970. * Converts `map` to its key-value pairs.
  18971. *
  18972. * @private
  18973. * @param {Object} map The map to convert.
  18974. * @returns {Array} Returns the key-value pairs.
  18975. */
  18976. function mapToArray(map) {
  18977. var index = -1,
  18978. result = Array(map.size);
  18979. map.forEach(function(value, key) {
  18980. result[++index] = [key, value];
  18981. });
  18982. return result;
  18983. }
  18984. /**
  18985. * Creates a unary function that invokes `func` with its argument transformed.
  18986. *
  18987. * @private
  18988. * @param {Function} func The function to wrap.
  18989. * @param {Function} transform The argument transform.
  18990. * @returns {Function} Returns the new function.
  18991. */
  18992. function overArg(func, transform) {
  18993. return function(arg) {
  18994. return func(transform(arg));
  18995. };
  18996. }
  18997. /**
  18998. * Replaces all `placeholder` elements in `array` with an internal placeholder
  18999. * and returns an array of their indexes.
  19000. *
  19001. * @private
  19002. * @param {Array} array The array to modify.
  19003. * @param {*} placeholder The placeholder to replace.
  19004. * @returns {Array} Returns the new array of placeholder indexes.
  19005. */
  19006. function replaceHolders(array, placeholder) {
  19007. var index = -1,
  19008. length = array.length,
  19009. resIndex = 0,
  19010. result = [];
  19011. while (++index < length) {
  19012. var value = array[index];
  19013. if (value === placeholder || value === PLACEHOLDER) {
  19014. array[index] = PLACEHOLDER;
  19015. result[resIndex++] = index;
  19016. }
  19017. }
  19018. return result;
  19019. }
  19020. /**
  19021. * Converts `set` to an array of its values.
  19022. *
  19023. * @private
  19024. * @param {Object} set The set to convert.
  19025. * @returns {Array} Returns the values.
  19026. */
  19027. function setToArray(set) {
  19028. var index = -1,
  19029. result = Array(set.size);
  19030. set.forEach(function(value) {
  19031. result[++index] = value;
  19032. });
  19033. return result;
  19034. }
  19035. /**
  19036. * Converts `set` to its value-value pairs.
  19037. *
  19038. * @private
  19039. * @param {Object} set The set to convert.
  19040. * @returns {Array} Returns the value-value pairs.
  19041. */
  19042. function setToPairs(set) {
  19043. var index = -1,
  19044. result = Array(set.size);
  19045. set.forEach(function(value) {
  19046. result[++index] = [value, value];
  19047. });
  19048. return result;
  19049. }
  19050. /**
  19051. * A specialized version of `_.indexOf` which performs strict equality
  19052. * comparisons of values, i.e. `===`.
  19053. *
  19054. * @private
  19055. * @param {Array} array The array to inspect.
  19056. * @param {*} value The value to search for.
  19057. * @param {number} fromIndex The index to search from.
  19058. * @returns {number} Returns the index of the matched value, else `-1`.
  19059. */
  19060. function strictIndexOf(array, value, fromIndex) {
  19061. var index = fromIndex - 1,
  19062. length = array.length;
  19063. while (++index < length) {
  19064. if (array[index] === value) {
  19065. return index;
  19066. }
  19067. }
  19068. return -1;
  19069. }
  19070. /**
  19071. * A specialized version of `_.lastIndexOf` which performs strict equality
  19072. * comparisons of values, i.e. `===`.
  19073. *
  19074. * @private
  19075. * @param {Array} array The array to inspect.
  19076. * @param {*} value The value to search for.
  19077. * @param {number} fromIndex The index to search from.
  19078. * @returns {number} Returns the index of the matched value, else `-1`.
  19079. */
  19080. function strictLastIndexOf(array, value, fromIndex) {
  19081. var index = fromIndex + 1;
  19082. while (index--) {
  19083. if (array[index] === value) {
  19084. return index;
  19085. }
  19086. }
  19087. return index;
  19088. }
  19089. /**
  19090. * Gets the number of symbols in `string`.
  19091. *
  19092. * @private
  19093. * @param {string} string The string to inspect.
  19094. * @returns {number} Returns the string size.
  19095. */
  19096. function stringSize(string) {
  19097. return hasUnicode(string)
  19098. ? unicodeSize(string)
  19099. : asciiSize(string);
  19100. }
  19101. /**
  19102. * Converts `string` to an array.
  19103. *
  19104. * @private
  19105. * @param {string} string The string to convert.
  19106. * @returns {Array} Returns the converted array.
  19107. */
  19108. function stringToArray(string) {
  19109. return hasUnicode(string)
  19110. ? unicodeToArray(string)
  19111. : asciiToArray(string);
  19112. }
  19113. /**
  19114. * Used by `_.unescape` to convert HTML entities to characters.
  19115. *
  19116. * @private
  19117. * @param {string} chr The matched character to unescape.
  19118. * @returns {string} Returns the unescaped character.
  19119. */
  19120. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19121. /**
  19122. * Gets the size of a Unicode `string`.
  19123. *
  19124. * @private
  19125. * @param {string} string The string inspect.
  19126. * @returns {number} Returns the string size.
  19127. */
  19128. function unicodeSize(string) {
  19129. var result = reUnicode.lastIndex = 0;
  19130. while (reUnicode.test(string)) {
  19131. ++result;
  19132. }
  19133. return result;
  19134. }
  19135. /**
  19136. * Converts a Unicode `string` to an array.
  19137. *
  19138. * @private
  19139. * @param {string} string The string to convert.
  19140. * @returns {Array} Returns the converted array.
  19141. */
  19142. function unicodeToArray(string) {
  19143. return string.match(reUnicode) || [];
  19144. }
  19145. /**
  19146. * Splits a Unicode `string` into an array of its words.
  19147. *
  19148. * @private
  19149. * @param {string} The string to inspect.
  19150. * @returns {Array} Returns the words of `string`.
  19151. */
  19152. function unicodeWords(string) {
  19153. return string.match(reUnicodeWord) || [];
  19154. }
  19155. /*--------------------------------------------------------------------------*/
  19156. /**
  19157. * Create a new pristine `lodash` function using the `context` object.
  19158. *
  19159. * @static
  19160. * @memberOf _
  19161. * @since 1.1.0
  19162. * @category Util
  19163. * @param {Object} [context=root] The context object.
  19164. * @returns {Function} Returns a new `lodash` function.
  19165. * @example
  19166. *
  19167. * _.mixin({ 'foo': _.constant('foo') });
  19168. *
  19169. * var lodash = _.runInContext();
  19170. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19171. *
  19172. * _.isFunction(_.foo);
  19173. * // => true
  19174. * _.isFunction(_.bar);
  19175. * // => false
  19176. *
  19177. * lodash.isFunction(lodash.foo);
  19178. * // => false
  19179. * lodash.isFunction(lodash.bar);
  19180. * // => true
  19181. *
  19182. * // Create a suped-up `defer` in Node.js.
  19183. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19184. */
  19185. var runInContext = (function runInContext(context) {
  19186. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19187. /** Built-in constructor references. */
  19188. var Array = context.Array,
  19189. Date = context.Date,
  19190. Error = context.Error,
  19191. Function = context.Function,
  19192. Math = context.Math,
  19193. Object = context.Object,
  19194. RegExp = context.RegExp,
  19195. String = context.String,
  19196. TypeError = context.TypeError;
  19197. /** Used for built-in method references. */
  19198. var arrayProto = Array.prototype,
  19199. funcProto = Function.prototype,
  19200. objectProto = Object.prototype;
  19201. /** Used to detect overreaching core-js shims. */
  19202. var coreJsData = context['__core-js_shared__'];
  19203. /** Used to resolve the decompiled source of functions. */
  19204. var funcToString = funcProto.toString;
  19205. /** Used to check objects for own properties. */
  19206. var hasOwnProperty = objectProto.hasOwnProperty;
  19207. /** Used to generate unique IDs. */
  19208. var idCounter = 0;
  19209. /** Used to detect methods masquerading as native. */
  19210. var maskSrcKey = (function() {
  19211. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19212. return uid ? ('Symbol(src)_1.' + uid) : '';
  19213. }());
  19214. /**
  19215. * Used to resolve the
  19216. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19217. * of values.
  19218. */
  19219. var nativeObjectToString = objectProto.toString;
  19220. /** Used to infer the `Object` constructor. */
  19221. var objectCtorString = funcToString.call(Object);
  19222. /** Used to restore the original `_` reference in `_.noConflict`. */
  19223. var oldDash = root._;
  19224. /** Used to detect if a method is native. */
  19225. var reIsNative = RegExp('^' +
  19226. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19227. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19228. );
  19229. /** Built-in value references. */
  19230. var Buffer = moduleExports ? context.Buffer : undefined,
  19231. Symbol = context.Symbol,
  19232. Uint8Array = context.Uint8Array,
  19233. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19234. getPrototype = overArg(Object.getPrototypeOf, Object),
  19235. objectCreate = Object.create,
  19236. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19237. splice = arrayProto.splice,
  19238. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19239. symIterator = Symbol ? Symbol.iterator : undefined,
  19240. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19241. var defineProperty = (function() {
  19242. try {
  19243. var func = getNative(Object, 'defineProperty');
  19244. func({}, '', {});
  19245. return func;
  19246. } catch (e) {}
  19247. }());
  19248. /** Mocked built-ins. */
  19249. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19250. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19251. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19252. /* Built-in method references for those with the same name as other `lodash` methods. */
  19253. var nativeCeil = Math.ceil,
  19254. nativeFloor = Math.floor,
  19255. nativeGetSymbols = Object.getOwnPropertySymbols,
  19256. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19257. nativeIsFinite = context.isFinite,
  19258. nativeJoin = arrayProto.join,
  19259. nativeKeys = overArg(Object.keys, Object),
  19260. nativeMax = Math.max,
  19261. nativeMin = Math.min,
  19262. nativeNow = Date.now,
  19263. nativeParseInt = context.parseInt,
  19264. nativeRandom = Math.random,
  19265. nativeReverse = arrayProto.reverse;
  19266. /* Built-in method references that are verified to be native. */
  19267. var DataView = getNative(context, 'DataView'),
  19268. Map = getNative(context, 'Map'),
  19269. Promise = getNative(context, 'Promise'),
  19270. Set = getNative(context, 'Set'),
  19271. WeakMap = getNative(context, 'WeakMap'),
  19272. nativeCreate = getNative(Object, 'create');
  19273. /** Used to store function metadata. */
  19274. var metaMap = WeakMap && new WeakMap;
  19275. /** Used to lookup unminified function names. */
  19276. var realNames = {};
  19277. /** Used to detect maps, sets, and weakmaps. */
  19278. var dataViewCtorString = toSource(DataView),
  19279. mapCtorString = toSource(Map),
  19280. promiseCtorString = toSource(Promise),
  19281. setCtorString = toSource(Set),
  19282. weakMapCtorString = toSource(WeakMap);
  19283. /** Used to convert symbols to primitives and strings. */
  19284. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19285. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19286. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19287. /*------------------------------------------------------------------------*/
  19288. /**
  19289. * Creates a `lodash` object which wraps `value` to enable implicit method
  19290. * chain sequences. Methods that operate on and return arrays, collections,
  19291. * and functions can be chained together. Methods that retrieve a single value
  19292. * or may return a primitive value will automatically end the chain sequence
  19293. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19294. * with `_#value`.
  19295. *
  19296. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19297. * enabled using `_.chain`.
  19298. *
  19299. * The execution of chained methods is lazy, that is, it's deferred until
  19300. * `_#value` is implicitly or explicitly called.
  19301. *
  19302. * Lazy evaluation allows several methods to support shortcut fusion.
  19303. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19304. * the creation of intermediate arrays and can greatly reduce the number of
  19305. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19306. * fusion if the section is applied to an array and iteratees accept only
  19307. * one argument. The heuristic for whether a section qualifies for shortcut
  19308. * fusion is subject to change.
  19309. *
  19310. * Chaining is supported in custom builds as long as the `_#value` method is
  19311. * directly or indirectly included in the build.
  19312. *
  19313. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19314. *
  19315. * The wrapper `Array` methods are:
  19316. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19317. *
  19318. * The wrapper `String` methods are:
  19319. * `replace` and `split`
  19320. *
  19321. * The wrapper methods that support shortcut fusion are:
  19322. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19323. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19324. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19325. *
  19326. * The chainable wrapper methods are:
  19327. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19328. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19329. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19330. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19331. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19332. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19333. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19334. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19335. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19336. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19337. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19338. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19339. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19340. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19341. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19342. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19343. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19344. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19345. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19346. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19347. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19348. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19349. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19350. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19351. *
  19352. * The wrapper methods that are **not** chainable by default are:
  19353. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19354. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19355. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19356. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19357. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19358. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19359. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19360. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19361. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19362. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19363. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19364. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19365. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19366. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19367. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19368. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19369. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19370. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19371. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19372. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19373. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19374. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19375. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19376. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19377. * `upperFirst`, `value`, and `words`
  19378. *
  19379. * @name _
  19380. * @constructor
  19381. * @category Seq
  19382. * @param {*} value The value to wrap in a `lodash` instance.
  19383. * @returns {Object} Returns the new `lodash` wrapper instance.
  19384. * @example
  19385. *
  19386. * function square(n) {
  19387. * return n * n;
  19388. * }
  19389. *
  19390. * var wrapped = _([1, 2, 3]);
  19391. *
  19392. * // Returns an unwrapped value.
  19393. * wrapped.reduce(_.add);
  19394. * // => 6
  19395. *
  19396. * // Returns a wrapped value.
  19397. * var squares = wrapped.map(square);
  19398. *
  19399. * _.isArray(squares);
  19400. * // => false
  19401. *
  19402. * _.isArray(squares.value());
  19403. * // => true
  19404. */
  19405. function lodash(value) {
  19406. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19407. if (value instanceof LodashWrapper) {
  19408. return value;
  19409. }
  19410. if (hasOwnProperty.call(value, '__wrapped__')) {
  19411. return wrapperClone(value);
  19412. }
  19413. }
  19414. return new LodashWrapper(value);
  19415. }
  19416. /**
  19417. * The base implementation of `_.create` without support for assigning
  19418. * properties to the created object.
  19419. *
  19420. * @private
  19421. * @param {Object} proto The object to inherit from.
  19422. * @returns {Object} Returns the new object.
  19423. */
  19424. var baseCreate = (function() {
  19425. function object() {}
  19426. return function(proto) {
  19427. if (!isObject(proto)) {
  19428. return {};
  19429. }
  19430. if (objectCreate) {
  19431. return objectCreate(proto);
  19432. }
  19433. object.prototype = proto;
  19434. var result = new object;
  19435. object.prototype = undefined;
  19436. return result;
  19437. };
  19438. }());
  19439. /**
  19440. * The function whose prototype chain sequence wrappers inherit from.
  19441. *
  19442. * @private
  19443. */
  19444. function baseLodash() {
  19445. // No operation performed.
  19446. }
  19447. /**
  19448. * The base constructor for creating `lodash` wrapper objects.
  19449. *
  19450. * @private
  19451. * @param {*} value The value to wrap.
  19452. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19453. */
  19454. function LodashWrapper(value, chainAll) {
  19455. this.__wrapped__ = value;
  19456. this.__actions__ = [];
  19457. this.__chain__ = !!chainAll;
  19458. this.__index__ = 0;
  19459. this.__values__ = undefined;
  19460. }
  19461. /**
  19462. * By default, the template delimiters used by lodash are like those in
  19463. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19464. * following template settings to use alternative delimiters.
  19465. *
  19466. * @static
  19467. * @memberOf _
  19468. * @type {Object}
  19469. */
  19470. lodash.templateSettings = {
  19471. /**
  19472. * Used to detect `data` property values to be HTML-escaped.
  19473. *
  19474. * @memberOf _.templateSettings
  19475. * @type {RegExp}
  19476. */
  19477. 'escape': reEscape,
  19478. /**
  19479. * Used to detect code to be evaluated.
  19480. *
  19481. * @memberOf _.templateSettings
  19482. * @type {RegExp}
  19483. */
  19484. 'evaluate': reEvaluate,
  19485. /**
  19486. * Used to detect `data` property values to inject.
  19487. *
  19488. * @memberOf _.templateSettings
  19489. * @type {RegExp}
  19490. */
  19491. 'interpolate': reInterpolate,
  19492. /**
  19493. * Used to reference the data object in the template text.
  19494. *
  19495. * @memberOf _.templateSettings
  19496. * @type {string}
  19497. */
  19498. 'variable': '',
  19499. /**
  19500. * Used to import variables into the compiled template.
  19501. *
  19502. * @memberOf _.templateSettings
  19503. * @type {Object}
  19504. */
  19505. 'imports': {
  19506. /**
  19507. * A reference to the `lodash` function.
  19508. *
  19509. * @memberOf _.templateSettings.imports
  19510. * @type {Function}
  19511. */
  19512. '_': lodash
  19513. }
  19514. };
  19515. // Ensure wrappers are instances of `baseLodash`.
  19516. lodash.prototype = baseLodash.prototype;
  19517. lodash.prototype.constructor = lodash;
  19518. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19519. LodashWrapper.prototype.constructor = LodashWrapper;
  19520. /*------------------------------------------------------------------------*/
  19521. /**
  19522. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19523. *
  19524. * @private
  19525. * @constructor
  19526. * @param {*} value The value to wrap.
  19527. */
  19528. function LazyWrapper(value) {
  19529. this.__wrapped__ = value;
  19530. this.__actions__ = [];
  19531. this.__dir__ = 1;
  19532. this.__filtered__ = false;
  19533. this.__iteratees__ = [];
  19534. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19535. this.__views__ = [];
  19536. }
  19537. /**
  19538. * Creates a clone of the lazy wrapper object.
  19539. *
  19540. * @private
  19541. * @name clone
  19542. * @memberOf LazyWrapper
  19543. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19544. */
  19545. function lazyClone() {
  19546. var result = new LazyWrapper(this.__wrapped__);
  19547. result.__actions__ = copyArray(this.__actions__);
  19548. result.__dir__ = this.__dir__;
  19549. result.__filtered__ = this.__filtered__;
  19550. result.__iteratees__ = copyArray(this.__iteratees__);
  19551. result.__takeCount__ = this.__takeCount__;
  19552. result.__views__ = copyArray(this.__views__);
  19553. return result;
  19554. }
  19555. /**
  19556. * Reverses the direction of lazy iteration.
  19557. *
  19558. * @private
  19559. * @name reverse
  19560. * @memberOf LazyWrapper
  19561. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19562. */
  19563. function lazyReverse() {
  19564. if (this.__filtered__) {
  19565. var result = new LazyWrapper(this);
  19566. result.__dir__ = -1;
  19567. result.__filtered__ = true;
  19568. } else {
  19569. result = this.clone();
  19570. result.__dir__ *= -1;
  19571. }
  19572. return result;
  19573. }
  19574. /**
  19575. * Extracts the unwrapped value from its lazy wrapper.
  19576. *
  19577. * @private
  19578. * @name value
  19579. * @memberOf LazyWrapper
  19580. * @returns {*} Returns the unwrapped value.
  19581. */
  19582. function lazyValue() {
  19583. var array = this.__wrapped__.value(),
  19584. dir = this.__dir__,
  19585. isArr = isArray(array),
  19586. isRight = dir < 0,
  19587. arrLength = isArr ? array.length : 0,
  19588. view = getView(0, arrLength, this.__views__),
  19589. start = view.start,
  19590. end = view.end,
  19591. length = end - start,
  19592. index = isRight ? end : (start - 1),
  19593. iteratees = this.__iteratees__,
  19594. iterLength = iteratees.length,
  19595. resIndex = 0,
  19596. takeCount = nativeMin(length, this.__takeCount__);
  19597. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19598. return baseWrapperValue(array, this.__actions__);
  19599. }
  19600. var result = [];
  19601. outer:
  19602. while (length-- && resIndex < takeCount) {
  19603. index += dir;
  19604. var iterIndex = -1,
  19605. value = array[index];
  19606. while (++iterIndex < iterLength) {
  19607. var data = iteratees[iterIndex],
  19608. iteratee = data.iteratee,
  19609. type = data.type,
  19610. computed = iteratee(value);
  19611. if (type == LAZY_MAP_FLAG) {
  19612. value = computed;
  19613. } else if (!computed) {
  19614. if (type == LAZY_FILTER_FLAG) {
  19615. continue outer;
  19616. } else {
  19617. break outer;
  19618. }
  19619. }
  19620. }
  19621. result[resIndex++] = value;
  19622. }
  19623. return result;
  19624. }
  19625. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19626. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19627. LazyWrapper.prototype.constructor = LazyWrapper;
  19628. /*------------------------------------------------------------------------*/
  19629. /**
  19630. * Creates a hash object.
  19631. *
  19632. * @private
  19633. * @constructor
  19634. * @param {Array} [entries] The key-value pairs to cache.
  19635. */
  19636. function Hash(entries) {
  19637. var index = -1,
  19638. length = entries == null ? 0 : entries.length;
  19639. this.clear();
  19640. while (++index < length) {
  19641. var entry = entries[index];
  19642. this.set(entry[0], entry[1]);
  19643. }
  19644. }
  19645. /**
  19646. * Removes all key-value entries from the hash.
  19647. *
  19648. * @private
  19649. * @name clear
  19650. * @memberOf Hash
  19651. */
  19652. function hashClear() {
  19653. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19654. this.size = 0;
  19655. }
  19656. /**
  19657. * Removes `key` and its value from the hash.
  19658. *
  19659. * @private
  19660. * @name delete
  19661. * @memberOf Hash
  19662. * @param {Object} hash The hash to modify.
  19663. * @param {string} key The key of the value to remove.
  19664. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19665. */
  19666. function hashDelete(key) {
  19667. var result = this.has(key) && delete this.__data__[key];
  19668. this.size -= result ? 1 : 0;
  19669. return result;
  19670. }
  19671. /**
  19672. * Gets the hash value for `key`.
  19673. *
  19674. * @private
  19675. * @name get
  19676. * @memberOf Hash
  19677. * @param {string} key The key of the value to get.
  19678. * @returns {*} Returns the entry value.
  19679. */
  19680. function hashGet(key) {
  19681. var data = this.__data__;
  19682. if (nativeCreate) {
  19683. var result = data[key];
  19684. return result === HASH_UNDEFINED ? undefined : result;
  19685. }
  19686. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19687. }
  19688. /**
  19689. * Checks if a hash value for `key` exists.
  19690. *
  19691. * @private
  19692. * @name has
  19693. * @memberOf Hash
  19694. * @param {string} key The key of the entry to check.
  19695. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19696. */
  19697. function hashHas(key) {
  19698. var data = this.__data__;
  19699. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19700. }
  19701. /**
  19702. * Sets the hash `key` to `value`.
  19703. *
  19704. * @private
  19705. * @name set
  19706. * @memberOf Hash
  19707. * @param {string} key The key of the value to set.
  19708. * @param {*} value The value to set.
  19709. * @returns {Object} Returns the hash instance.
  19710. */
  19711. function hashSet(key, value) {
  19712. var data = this.__data__;
  19713. this.size += this.has(key) ? 0 : 1;
  19714. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19715. return this;
  19716. }
  19717. // Add methods to `Hash`.
  19718. Hash.prototype.clear = hashClear;
  19719. Hash.prototype['delete'] = hashDelete;
  19720. Hash.prototype.get = hashGet;
  19721. Hash.prototype.has = hashHas;
  19722. Hash.prototype.set = hashSet;
  19723. /*------------------------------------------------------------------------*/
  19724. /**
  19725. * Creates an list cache object.
  19726. *
  19727. * @private
  19728. * @constructor
  19729. * @param {Array} [entries] The key-value pairs to cache.
  19730. */
  19731. function ListCache(entries) {
  19732. var index = -1,
  19733. length = entries == null ? 0 : entries.length;
  19734. this.clear();
  19735. while (++index < length) {
  19736. var entry = entries[index];
  19737. this.set(entry[0], entry[1]);
  19738. }
  19739. }
  19740. /**
  19741. * Removes all key-value entries from the list cache.
  19742. *
  19743. * @private
  19744. * @name clear
  19745. * @memberOf ListCache
  19746. */
  19747. function listCacheClear() {
  19748. this.__data__ = [];
  19749. this.size = 0;
  19750. }
  19751. /**
  19752. * Removes `key` and its value from the list cache.
  19753. *
  19754. * @private
  19755. * @name delete
  19756. * @memberOf ListCache
  19757. * @param {string} key The key of the value to remove.
  19758. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19759. */
  19760. function listCacheDelete(key) {
  19761. var data = this.__data__,
  19762. index = assocIndexOf(data, key);
  19763. if (index < 0) {
  19764. return false;
  19765. }
  19766. var lastIndex = data.length - 1;
  19767. if (index == lastIndex) {
  19768. data.pop();
  19769. } else {
  19770. splice.call(data, index, 1);
  19771. }
  19772. --this.size;
  19773. return true;
  19774. }
  19775. /**
  19776. * Gets the list cache value for `key`.
  19777. *
  19778. * @private
  19779. * @name get
  19780. * @memberOf ListCache
  19781. * @param {string} key The key of the value to get.
  19782. * @returns {*} Returns the entry value.
  19783. */
  19784. function listCacheGet(key) {
  19785. var data = this.__data__,
  19786. index = assocIndexOf(data, key);
  19787. return index < 0 ? undefined : data[index][1];
  19788. }
  19789. /**
  19790. * Checks if a list cache value for `key` exists.
  19791. *
  19792. * @private
  19793. * @name has
  19794. * @memberOf ListCache
  19795. * @param {string} key The key of the entry to check.
  19796. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19797. */
  19798. function listCacheHas(key) {
  19799. return assocIndexOf(this.__data__, key) > -1;
  19800. }
  19801. /**
  19802. * Sets the list cache `key` to `value`.
  19803. *
  19804. * @private
  19805. * @name set
  19806. * @memberOf ListCache
  19807. * @param {string} key The key of the value to set.
  19808. * @param {*} value The value to set.
  19809. * @returns {Object} Returns the list cache instance.
  19810. */
  19811. function listCacheSet(key, value) {
  19812. var data = this.__data__,
  19813. index = assocIndexOf(data, key);
  19814. if (index < 0) {
  19815. ++this.size;
  19816. data.push([key, value]);
  19817. } else {
  19818. data[index][1] = value;
  19819. }
  19820. return this;
  19821. }
  19822. // Add methods to `ListCache`.
  19823. ListCache.prototype.clear = listCacheClear;
  19824. ListCache.prototype['delete'] = listCacheDelete;
  19825. ListCache.prototype.get = listCacheGet;
  19826. ListCache.prototype.has = listCacheHas;
  19827. ListCache.prototype.set = listCacheSet;
  19828. /*------------------------------------------------------------------------*/
  19829. /**
  19830. * Creates a map cache object to store key-value pairs.
  19831. *
  19832. * @private
  19833. * @constructor
  19834. * @param {Array} [entries] The key-value pairs to cache.
  19835. */
  19836. function MapCache(entries) {
  19837. var index = -1,
  19838. length = entries == null ? 0 : entries.length;
  19839. this.clear();
  19840. while (++index < length) {
  19841. var entry = entries[index];
  19842. this.set(entry[0], entry[1]);
  19843. }
  19844. }
  19845. /**
  19846. * Removes all key-value entries from the map.
  19847. *
  19848. * @private
  19849. * @name clear
  19850. * @memberOf MapCache
  19851. */
  19852. function mapCacheClear() {
  19853. this.size = 0;
  19854. this.__data__ = {
  19855. 'hash': new Hash,
  19856. 'map': new (Map || ListCache),
  19857. 'string': new Hash
  19858. };
  19859. }
  19860. /**
  19861. * Removes `key` and its value from the map.
  19862. *
  19863. * @private
  19864. * @name delete
  19865. * @memberOf MapCache
  19866. * @param {string} key The key of the value to remove.
  19867. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19868. */
  19869. function mapCacheDelete(key) {
  19870. var result = getMapData(this, key)['delete'](key);
  19871. this.size -= result ? 1 : 0;
  19872. return result;
  19873. }
  19874. /**
  19875. * Gets the map value for `key`.
  19876. *
  19877. * @private
  19878. * @name get
  19879. * @memberOf MapCache
  19880. * @param {string} key The key of the value to get.
  19881. * @returns {*} Returns the entry value.
  19882. */
  19883. function mapCacheGet(key) {
  19884. return getMapData(this, key).get(key);
  19885. }
  19886. /**
  19887. * Checks if a map value for `key` exists.
  19888. *
  19889. * @private
  19890. * @name has
  19891. * @memberOf MapCache
  19892. * @param {string} key The key of the entry to check.
  19893. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19894. */
  19895. function mapCacheHas(key) {
  19896. return getMapData(this, key).has(key);
  19897. }
  19898. /**
  19899. * Sets the map `key` to `value`.
  19900. *
  19901. * @private
  19902. * @name set
  19903. * @memberOf MapCache
  19904. * @param {string} key The key of the value to set.
  19905. * @param {*} value The value to set.
  19906. * @returns {Object} Returns the map cache instance.
  19907. */
  19908. function mapCacheSet(key, value) {
  19909. var data = getMapData(this, key),
  19910. size = data.size;
  19911. data.set(key, value);
  19912. this.size += data.size == size ? 0 : 1;
  19913. return this;
  19914. }
  19915. // Add methods to `MapCache`.
  19916. MapCache.prototype.clear = mapCacheClear;
  19917. MapCache.prototype['delete'] = mapCacheDelete;
  19918. MapCache.prototype.get = mapCacheGet;
  19919. MapCache.prototype.has = mapCacheHas;
  19920. MapCache.prototype.set = mapCacheSet;
  19921. /*------------------------------------------------------------------------*/
  19922. /**
  19923. *
  19924. * Creates an array cache object to store unique values.
  19925. *
  19926. * @private
  19927. * @constructor
  19928. * @param {Array} [values] The values to cache.
  19929. */
  19930. function SetCache(values) {
  19931. var index = -1,
  19932. length = values == null ? 0 : values.length;
  19933. this.__data__ = new MapCache;
  19934. while (++index < length) {
  19935. this.add(values[index]);
  19936. }
  19937. }
  19938. /**
  19939. * Adds `value` to the array cache.
  19940. *
  19941. * @private
  19942. * @name add
  19943. * @memberOf SetCache
  19944. * @alias push
  19945. * @param {*} value The value to cache.
  19946. * @returns {Object} Returns the cache instance.
  19947. */
  19948. function setCacheAdd(value) {
  19949. this.__data__.set(value, HASH_UNDEFINED);
  19950. return this;
  19951. }
  19952. /**
  19953. * Checks if `value` is in the array cache.
  19954. *
  19955. * @private
  19956. * @name has
  19957. * @memberOf SetCache
  19958. * @param {*} value The value to search for.
  19959. * @returns {number} Returns `true` if `value` is found, else `false`.
  19960. */
  19961. function setCacheHas(value) {
  19962. return this.__data__.has(value);
  19963. }
  19964. // Add methods to `SetCache`.
  19965. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  19966. SetCache.prototype.has = setCacheHas;
  19967. /*------------------------------------------------------------------------*/
  19968. /**
  19969. * Creates a stack cache object to store key-value pairs.
  19970. *
  19971. * @private
  19972. * @constructor
  19973. * @param {Array} [entries] The key-value pairs to cache.
  19974. */
  19975. function Stack(entries) {
  19976. var data = this.__data__ = new ListCache(entries);
  19977. this.size = data.size;
  19978. }
  19979. /**
  19980. * Removes all key-value entries from the stack.
  19981. *
  19982. * @private
  19983. * @name clear
  19984. * @memberOf Stack
  19985. */
  19986. function stackClear() {
  19987. this.__data__ = new ListCache;
  19988. this.size = 0;
  19989. }
  19990. /**
  19991. * Removes `key` and its value from the stack.
  19992. *
  19993. * @private
  19994. * @name delete
  19995. * @memberOf Stack
  19996. * @param {string} key The key of the value to remove.
  19997. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19998. */
  19999. function stackDelete(key) {
  20000. var data = this.__data__,
  20001. result = data['delete'](key);
  20002. this.size = data.size;
  20003. return result;
  20004. }
  20005. /**
  20006. * Gets the stack value for `key`.
  20007. *
  20008. * @private
  20009. * @name get
  20010. * @memberOf Stack
  20011. * @param {string} key The key of the value to get.
  20012. * @returns {*} Returns the entry value.
  20013. */
  20014. function stackGet(key) {
  20015. return this.__data__.get(key);
  20016. }
  20017. /**
  20018. * Checks if a stack value for `key` exists.
  20019. *
  20020. * @private
  20021. * @name has
  20022. * @memberOf Stack
  20023. * @param {string} key The key of the entry to check.
  20024. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20025. */
  20026. function stackHas(key) {
  20027. return this.__data__.has(key);
  20028. }
  20029. /**
  20030. * Sets the stack `key` to `value`.
  20031. *
  20032. * @private
  20033. * @name set
  20034. * @memberOf Stack
  20035. * @param {string} key The key of the value to set.
  20036. * @param {*} value The value to set.
  20037. * @returns {Object} Returns the stack cache instance.
  20038. */
  20039. function stackSet(key, value) {
  20040. var data = this.__data__;
  20041. if (data instanceof ListCache) {
  20042. var pairs = data.__data__;
  20043. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20044. pairs.push([key, value]);
  20045. this.size = ++data.size;
  20046. return this;
  20047. }
  20048. data = this.__data__ = new MapCache(pairs);
  20049. }
  20050. data.set(key, value);
  20051. this.size = data.size;
  20052. return this;
  20053. }
  20054. // Add methods to `Stack`.
  20055. Stack.prototype.clear = stackClear;
  20056. Stack.prototype['delete'] = stackDelete;
  20057. Stack.prototype.get = stackGet;
  20058. Stack.prototype.has = stackHas;
  20059. Stack.prototype.set = stackSet;
  20060. /*------------------------------------------------------------------------*/
  20061. /**
  20062. * Creates an array of the enumerable property names of the array-like `value`.
  20063. *
  20064. * @private
  20065. * @param {*} value The value to query.
  20066. * @param {boolean} inherited Specify returning inherited property names.
  20067. * @returns {Array} Returns the array of property names.
  20068. */
  20069. function arrayLikeKeys(value, inherited) {
  20070. var isArr = isArray(value),
  20071. isArg = !isArr && isArguments(value),
  20072. isBuff = !isArr && !isArg && isBuffer(value),
  20073. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20074. skipIndexes = isArr || isArg || isBuff || isType,
  20075. result = skipIndexes ? baseTimes(value.length, String) : [],
  20076. length = result.length;
  20077. for (var key in value) {
  20078. if ((inherited || hasOwnProperty.call(value, key)) &&
  20079. !(skipIndexes && (
  20080. // Safari 9 has enumerable `arguments.length` in strict mode.
  20081. key == 'length' ||
  20082. // Node.js 0.10 has enumerable non-index properties on buffers.
  20083. (isBuff && (key == 'offset' || key == 'parent')) ||
  20084. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20085. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20086. // Skip index properties.
  20087. isIndex(key, length)
  20088. ))) {
  20089. result.push(key);
  20090. }
  20091. }
  20092. return result;
  20093. }
  20094. /**
  20095. * A specialized version of `_.sample` for arrays.
  20096. *
  20097. * @private
  20098. * @param {Array} array The array to sample.
  20099. * @returns {*} Returns the random element.
  20100. */
  20101. function arraySample(array) {
  20102. var length = array.length;
  20103. return length ? array[baseRandom(0, length - 1)] : undefined;
  20104. }
  20105. /**
  20106. * A specialized version of `_.sampleSize` for arrays.
  20107. *
  20108. * @private
  20109. * @param {Array} array The array to sample.
  20110. * @param {number} n The number of elements to sample.
  20111. * @returns {Array} Returns the random elements.
  20112. */
  20113. function arraySampleSize(array, n) {
  20114. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20115. }
  20116. /**
  20117. * A specialized version of `_.shuffle` for arrays.
  20118. *
  20119. * @private
  20120. * @param {Array} array The array to shuffle.
  20121. * @returns {Array} Returns the new shuffled array.
  20122. */
  20123. function arrayShuffle(array) {
  20124. return shuffleSelf(copyArray(array));
  20125. }
  20126. /**
  20127. * This function is like `assignValue` except that it doesn't assign
  20128. * `undefined` values.
  20129. *
  20130. * @private
  20131. * @param {Object} object The object to modify.
  20132. * @param {string} key The key of the property to assign.
  20133. * @param {*} value The value to assign.
  20134. */
  20135. function assignMergeValue(object, key, value) {
  20136. if ((value !== undefined && !eq(object[key], value)) ||
  20137. (value === undefined && !(key in object))) {
  20138. baseAssignValue(object, key, value);
  20139. }
  20140. }
  20141. /**
  20142. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20143. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20144. * for equality comparisons.
  20145. *
  20146. * @private
  20147. * @param {Object} object The object to modify.
  20148. * @param {string} key The key of the property to assign.
  20149. * @param {*} value The value to assign.
  20150. */
  20151. function assignValue(object, key, value) {
  20152. var objValue = object[key];
  20153. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20154. (value === undefined && !(key in object))) {
  20155. baseAssignValue(object, key, value);
  20156. }
  20157. }
  20158. /**
  20159. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20160. *
  20161. * @private
  20162. * @param {Array} array The array to inspect.
  20163. * @param {*} key The key to search for.
  20164. * @returns {number} Returns the index of the matched value, else `-1`.
  20165. */
  20166. function assocIndexOf(array, key) {
  20167. var length = array.length;
  20168. while (length--) {
  20169. if (eq(array[length][0], key)) {
  20170. return length;
  20171. }
  20172. }
  20173. return -1;
  20174. }
  20175. /**
  20176. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20177. * by `iteratee` and values set by `setter`.
  20178. *
  20179. * @private
  20180. * @param {Array|Object} collection The collection to iterate over.
  20181. * @param {Function} setter The function to set `accumulator` values.
  20182. * @param {Function} iteratee The iteratee to transform keys.
  20183. * @param {Object} accumulator The initial aggregated object.
  20184. * @returns {Function} Returns `accumulator`.
  20185. */
  20186. function baseAggregator(collection, setter, iteratee, accumulator) {
  20187. baseEach(collection, function(value, key, collection) {
  20188. setter(accumulator, value, iteratee(value), collection);
  20189. });
  20190. return accumulator;
  20191. }
  20192. /**
  20193. * The base implementation of `_.assign` without support for multiple sources
  20194. * or `customizer` functions.
  20195. *
  20196. * @private
  20197. * @param {Object} object The destination object.
  20198. * @param {Object} source The source object.
  20199. * @returns {Object} Returns `object`.
  20200. */
  20201. function baseAssign(object, source) {
  20202. return object && copyObject(source, keys(source), object);
  20203. }
  20204. /**
  20205. * The base implementation of `_.assignIn` without support for multiple sources
  20206. * or `customizer` functions.
  20207. *
  20208. * @private
  20209. * @param {Object} object The destination object.
  20210. * @param {Object} source The source object.
  20211. * @returns {Object} Returns `object`.
  20212. */
  20213. function baseAssignIn(object, source) {
  20214. return object && copyObject(source, keysIn(source), object);
  20215. }
  20216. /**
  20217. * The base implementation of `assignValue` and `assignMergeValue` without
  20218. * value checks.
  20219. *
  20220. * @private
  20221. * @param {Object} object The object to modify.
  20222. * @param {string} key The key of the property to assign.
  20223. * @param {*} value The value to assign.
  20224. */
  20225. function baseAssignValue(object, key, value) {
  20226. if (key == '__proto__' && defineProperty) {
  20227. defineProperty(object, key, {
  20228. 'configurable': true,
  20229. 'enumerable': true,
  20230. 'value': value,
  20231. 'writable': true
  20232. });
  20233. } else {
  20234. object[key] = value;
  20235. }
  20236. }
  20237. /**
  20238. * The base implementation of `_.at` without support for individual paths.
  20239. *
  20240. * @private
  20241. * @param {Object} object The object to iterate over.
  20242. * @param {string[]} paths The property paths to pick.
  20243. * @returns {Array} Returns the picked elements.
  20244. */
  20245. function baseAt(object, paths) {
  20246. var index = -1,
  20247. length = paths.length,
  20248. result = Array(length),
  20249. skip = object == null;
  20250. while (++index < length) {
  20251. result[index] = skip ? undefined : get(object, paths[index]);
  20252. }
  20253. return result;
  20254. }
  20255. /**
  20256. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20257. *
  20258. * @private
  20259. * @param {number} number The number to clamp.
  20260. * @param {number} [lower] The lower bound.
  20261. * @param {number} upper The upper bound.
  20262. * @returns {number} Returns the clamped number.
  20263. */
  20264. function baseClamp(number, lower, upper) {
  20265. if (number === number) {
  20266. if (upper !== undefined) {
  20267. number = number <= upper ? number : upper;
  20268. }
  20269. if (lower !== undefined) {
  20270. number = number >= lower ? number : lower;
  20271. }
  20272. }
  20273. return number;
  20274. }
  20275. /**
  20276. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20277. * traversed objects.
  20278. *
  20279. * @private
  20280. * @param {*} value The value to clone.
  20281. * @param {boolean} bitmask The bitmask flags.
  20282. * 1 - Deep clone
  20283. * 2 - Flatten inherited properties
  20284. * 4 - Clone symbols
  20285. * @param {Function} [customizer] The function to customize cloning.
  20286. * @param {string} [key] The key of `value`.
  20287. * @param {Object} [object] The parent object of `value`.
  20288. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20289. * @returns {*} Returns the cloned value.
  20290. */
  20291. function baseClone(value, bitmask, customizer, key, object, stack) {
  20292. var result,
  20293. isDeep = bitmask & CLONE_DEEP_FLAG,
  20294. isFlat = bitmask & CLONE_FLAT_FLAG,
  20295. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20296. if (customizer) {
  20297. result = object ? customizer(value, key, object, stack) : customizer(value);
  20298. }
  20299. if (result !== undefined) {
  20300. return result;
  20301. }
  20302. if (!isObject(value)) {
  20303. return value;
  20304. }
  20305. var isArr = isArray(value);
  20306. if (isArr) {
  20307. result = initCloneArray(value);
  20308. if (!isDeep) {
  20309. return copyArray(value, result);
  20310. }
  20311. } else {
  20312. var tag = getTag(value),
  20313. isFunc = tag == funcTag || tag == genTag;
  20314. if (isBuffer(value)) {
  20315. return cloneBuffer(value, isDeep);
  20316. }
  20317. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20318. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20319. if (!isDeep) {
  20320. return isFlat
  20321. ? copySymbolsIn(value, baseAssignIn(result, value))
  20322. : copySymbols(value, baseAssign(result, value));
  20323. }
  20324. } else {
  20325. if (!cloneableTags[tag]) {
  20326. return object ? value : {};
  20327. }
  20328. result = initCloneByTag(value, tag, isDeep);
  20329. }
  20330. }
  20331. // Check for circular references and return its corresponding clone.
  20332. stack || (stack = new Stack);
  20333. var stacked = stack.get(value);
  20334. if (stacked) {
  20335. return stacked;
  20336. }
  20337. stack.set(value, result);
  20338. if (isSet(value)) {
  20339. value.forEach(function(subValue) {
  20340. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20341. });
  20342. } else if (isMap(value)) {
  20343. value.forEach(function(subValue, key) {
  20344. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20345. });
  20346. }
  20347. var keysFunc = isFull
  20348. ? (isFlat ? getAllKeysIn : getAllKeys)
  20349. : (isFlat ? keysIn : keys);
  20350. var props = isArr ? undefined : keysFunc(value);
  20351. arrayEach(props || value, function(subValue, key) {
  20352. if (props) {
  20353. key = subValue;
  20354. subValue = value[key];
  20355. }
  20356. // Recursively populate clone (susceptible to call stack limits).
  20357. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20358. });
  20359. return result;
  20360. }
  20361. /**
  20362. * The base implementation of `_.conforms` which doesn't clone `source`.
  20363. *
  20364. * @private
  20365. * @param {Object} source The object of property predicates to conform to.
  20366. * @returns {Function} Returns the new spec function.
  20367. */
  20368. function baseConforms(source) {
  20369. var props = keys(source);
  20370. return function(object) {
  20371. return baseConformsTo(object, source, props);
  20372. };
  20373. }
  20374. /**
  20375. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20376. *
  20377. * @private
  20378. * @param {Object} object The object to inspect.
  20379. * @param {Object} source The object of property predicates to conform to.
  20380. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20381. */
  20382. function baseConformsTo(object, source, props) {
  20383. var length = props.length;
  20384. if (object == null) {
  20385. return !length;
  20386. }
  20387. object = Object(object);
  20388. while (length--) {
  20389. var key = props[length],
  20390. predicate = source[key],
  20391. value = object[key];
  20392. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20393. return false;
  20394. }
  20395. }
  20396. return true;
  20397. }
  20398. /**
  20399. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20400. * to provide to `func`.
  20401. *
  20402. * @private
  20403. * @param {Function} func The function to delay.
  20404. * @param {number} wait The number of milliseconds to delay invocation.
  20405. * @param {Array} args The arguments to provide to `func`.
  20406. * @returns {number|Object} Returns the timer id or timeout object.
  20407. */
  20408. function baseDelay(func, wait, args) {
  20409. if (typeof func != 'function') {
  20410. throw new TypeError(FUNC_ERROR_TEXT);
  20411. }
  20412. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20413. }
  20414. /**
  20415. * The base implementation of methods like `_.difference` without support
  20416. * for excluding multiple arrays or iteratee shorthands.
  20417. *
  20418. * @private
  20419. * @param {Array} array The array to inspect.
  20420. * @param {Array} values The values to exclude.
  20421. * @param {Function} [iteratee] The iteratee invoked per element.
  20422. * @param {Function} [comparator] The comparator invoked per element.
  20423. * @returns {Array} Returns the new array of filtered values.
  20424. */
  20425. function baseDifference(array, values, iteratee, comparator) {
  20426. var index = -1,
  20427. includes = arrayIncludes,
  20428. isCommon = true,
  20429. length = array.length,
  20430. result = [],
  20431. valuesLength = values.length;
  20432. if (!length) {
  20433. return result;
  20434. }
  20435. if (iteratee) {
  20436. values = arrayMap(values, baseUnary(iteratee));
  20437. }
  20438. if (comparator) {
  20439. includes = arrayIncludesWith;
  20440. isCommon = false;
  20441. }
  20442. else if (values.length >= LARGE_ARRAY_SIZE) {
  20443. includes = cacheHas;
  20444. isCommon = false;
  20445. values = new SetCache(values);
  20446. }
  20447. outer:
  20448. while (++index < length) {
  20449. var value = array[index],
  20450. computed = iteratee == null ? value : iteratee(value);
  20451. value = (comparator || value !== 0) ? value : 0;
  20452. if (isCommon && computed === computed) {
  20453. var valuesIndex = valuesLength;
  20454. while (valuesIndex--) {
  20455. if (values[valuesIndex] === computed) {
  20456. continue outer;
  20457. }
  20458. }
  20459. result.push(value);
  20460. }
  20461. else if (!includes(values, computed, comparator)) {
  20462. result.push(value);
  20463. }
  20464. }
  20465. return result;
  20466. }
  20467. /**
  20468. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20469. *
  20470. * @private
  20471. * @param {Array|Object} collection The collection to iterate over.
  20472. * @param {Function} iteratee The function invoked per iteration.
  20473. * @returns {Array|Object} Returns `collection`.
  20474. */
  20475. var baseEach = createBaseEach(baseForOwn);
  20476. /**
  20477. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20478. *
  20479. * @private
  20480. * @param {Array|Object} collection The collection to iterate over.
  20481. * @param {Function} iteratee The function invoked per iteration.
  20482. * @returns {Array|Object} Returns `collection`.
  20483. */
  20484. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20485. /**
  20486. * The base implementation of `_.every` without support for iteratee shorthands.
  20487. *
  20488. * @private
  20489. * @param {Array|Object} collection The collection to iterate over.
  20490. * @param {Function} predicate The function invoked per iteration.
  20491. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20492. * else `false`
  20493. */
  20494. function baseEvery(collection, predicate) {
  20495. var result = true;
  20496. baseEach(collection, function(value, index, collection) {
  20497. result = !!predicate(value, index, collection);
  20498. return result;
  20499. });
  20500. return result;
  20501. }
  20502. /**
  20503. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20504. * `comparator` to determine the extremum value.
  20505. *
  20506. * @private
  20507. * @param {Array} array The array to iterate over.
  20508. * @param {Function} iteratee The iteratee invoked per iteration.
  20509. * @param {Function} comparator The comparator used to compare values.
  20510. * @returns {*} Returns the extremum value.
  20511. */
  20512. function baseExtremum(array, iteratee, comparator) {
  20513. var index = -1,
  20514. length = array.length;
  20515. while (++index < length) {
  20516. var value = array[index],
  20517. current = iteratee(value);
  20518. if (current != null && (computed === undefined
  20519. ? (current === current && !isSymbol(current))
  20520. : comparator(current, computed)
  20521. )) {
  20522. var computed = current,
  20523. result = value;
  20524. }
  20525. }
  20526. return result;
  20527. }
  20528. /**
  20529. * The base implementation of `_.fill` without an iteratee call guard.
  20530. *
  20531. * @private
  20532. * @param {Array} array The array to fill.
  20533. * @param {*} value The value to fill `array` with.
  20534. * @param {number} [start=0] The start position.
  20535. * @param {number} [end=array.length] The end position.
  20536. * @returns {Array} Returns `array`.
  20537. */
  20538. function baseFill(array, value, start, end) {
  20539. var length = array.length;
  20540. start = toInteger(start);
  20541. if (start < 0) {
  20542. start = -start > length ? 0 : (length + start);
  20543. }
  20544. end = (end === undefined || end > length) ? length : toInteger(end);
  20545. if (end < 0) {
  20546. end += length;
  20547. }
  20548. end = start > end ? 0 : toLength(end);
  20549. while (start < end) {
  20550. array[start++] = value;
  20551. }
  20552. return array;
  20553. }
  20554. /**
  20555. * The base implementation of `_.filter` without support for iteratee shorthands.
  20556. *
  20557. * @private
  20558. * @param {Array|Object} collection The collection to iterate over.
  20559. * @param {Function} predicate The function invoked per iteration.
  20560. * @returns {Array} Returns the new filtered array.
  20561. */
  20562. function baseFilter(collection, predicate) {
  20563. var result = [];
  20564. baseEach(collection, function(value, index, collection) {
  20565. if (predicate(value, index, collection)) {
  20566. result.push(value);
  20567. }
  20568. });
  20569. return result;
  20570. }
  20571. /**
  20572. * The base implementation of `_.flatten` with support for restricting flattening.
  20573. *
  20574. * @private
  20575. * @param {Array} array The array to flatten.
  20576. * @param {number} depth The maximum recursion depth.
  20577. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20578. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20579. * @param {Array} [result=[]] The initial result value.
  20580. * @returns {Array} Returns the new flattened array.
  20581. */
  20582. function baseFlatten(array, depth, predicate, isStrict, result) {
  20583. var index = -1,
  20584. length = array.length;
  20585. predicate || (predicate = isFlattenable);
  20586. result || (result = []);
  20587. while (++index < length) {
  20588. var value = array[index];
  20589. if (depth > 0 && predicate(value)) {
  20590. if (depth > 1) {
  20591. // Recursively flatten arrays (susceptible to call stack limits).
  20592. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20593. } else {
  20594. arrayPush(result, value);
  20595. }
  20596. } else if (!isStrict) {
  20597. result[result.length] = value;
  20598. }
  20599. }
  20600. return result;
  20601. }
  20602. /**
  20603. * The base implementation of `baseForOwn` which iterates over `object`
  20604. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20605. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20606. *
  20607. * @private
  20608. * @param {Object} object The object to iterate over.
  20609. * @param {Function} iteratee The function invoked per iteration.
  20610. * @param {Function} keysFunc The function to get the keys of `object`.
  20611. * @returns {Object} Returns `object`.
  20612. */
  20613. var baseFor = createBaseFor();
  20614. /**
  20615. * This function is like `baseFor` except that it iterates over properties
  20616. * in the opposite order.
  20617. *
  20618. * @private
  20619. * @param {Object} object The object to iterate over.
  20620. * @param {Function} iteratee The function invoked per iteration.
  20621. * @param {Function} keysFunc The function to get the keys of `object`.
  20622. * @returns {Object} Returns `object`.
  20623. */
  20624. var baseForRight = createBaseFor(true);
  20625. /**
  20626. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20627. *
  20628. * @private
  20629. * @param {Object} object The object to iterate over.
  20630. * @param {Function} iteratee The function invoked per iteration.
  20631. * @returns {Object} Returns `object`.
  20632. */
  20633. function baseForOwn(object, iteratee) {
  20634. return object && baseFor(object, iteratee, keys);
  20635. }
  20636. /**
  20637. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20638. *
  20639. * @private
  20640. * @param {Object} object The object to iterate over.
  20641. * @param {Function} iteratee The function invoked per iteration.
  20642. * @returns {Object} Returns `object`.
  20643. */
  20644. function baseForOwnRight(object, iteratee) {
  20645. return object && baseForRight(object, iteratee, keys);
  20646. }
  20647. /**
  20648. * The base implementation of `_.functions` which creates an array of
  20649. * `object` function property names filtered from `props`.
  20650. *
  20651. * @private
  20652. * @param {Object} object The object to inspect.
  20653. * @param {Array} props The property names to filter.
  20654. * @returns {Array} Returns the function names.
  20655. */
  20656. function baseFunctions(object, props) {
  20657. return arrayFilter(props, function(key) {
  20658. return isFunction(object[key]);
  20659. });
  20660. }
  20661. /**
  20662. * The base implementation of `_.get` without support for default values.
  20663. *
  20664. * @private
  20665. * @param {Object} object The object to query.
  20666. * @param {Array|string} path The path of the property to get.
  20667. * @returns {*} Returns the resolved value.
  20668. */
  20669. function baseGet(object, path) {
  20670. path = castPath(path, object);
  20671. var index = 0,
  20672. length = path.length;
  20673. while (object != null && index < length) {
  20674. object = object[toKey(path[index++])];
  20675. }
  20676. return (index && index == length) ? object : undefined;
  20677. }
  20678. /**
  20679. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20680. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20681. * symbols of `object`.
  20682. *
  20683. * @private
  20684. * @param {Object} object The object to query.
  20685. * @param {Function} keysFunc The function to get the keys of `object`.
  20686. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20687. * @returns {Array} Returns the array of property names and symbols.
  20688. */
  20689. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20690. var result = keysFunc(object);
  20691. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20692. }
  20693. /**
  20694. * The base implementation of `getTag` without fallbacks for buggy environments.
  20695. *
  20696. * @private
  20697. * @param {*} value The value to query.
  20698. * @returns {string} Returns the `toStringTag`.
  20699. */
  20700. function baseGetTag(value) {
  20701. if (value == null) {
  20702. return value === undefined ? undefinedTag : nullTag;
  20703. }
  20704. return (symToStringTag && symToStringTag in Object(value))
  20705. ? getRawTag(value)
  20706. : objectToString(value);
  20707. }
  20708. /**
  20709. * The base implementation of `_.gt` which doesn't coerce arguments.
  20710. *
  20711. * @private
  20712. * @param {*} value The value to compare.
  20713. * @param {*} other The other value to compare.
  20714. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20715. * else `false`.
  20716. */
  20717. function baseGt(value, other) {
  20718. return value > other;
  20719. }
  20720. /**
  20721. * The base implementation of `_.has` without support for deep paths.
  20722. *
  20723. * @private
  20724. * @param {Object} [object] The object to query.
  20725. * @param {Array|string} key The key to check.
  20726. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20727. */
  20728. function baseHas(object, key) {
  20729. return object != null && hasOwnProperty.call(object, key);
  20730. }
  20731. /**
  20732. * The base implementation of `_.hasIn` without support for deep paths.
  20733. *
  20734. * @private
  20735. * @param {Object} [object] The object to query.
  20736. * @param {Array|string} key The key to check.
  20737. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20738. */
  20739. function baseHasIn(object, key) {
  20740. return object != null && key in Object(object);
  20741. }
  20742. /**
  20743. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20744. *
  20745. * @private
  20746. * @param {number} number The number to check.
  20747. * @param {number} start The start of the range.
  20748. * @param {number} end The end of the range.
  20749. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20750. */
  20751. function baseInRange(number, start, end) {
  20752. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20753. }
  20754. /**
  20755. * The base implementation of methods like `_.intersection`, without support
  20756. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20757. *
  20758. * @private
  20759. * @param {Array} arrays The arrays to inspect.
  20760. * @param {Function} [iteratee] The iteratee invoked per element.
  20761. * @param {Function} [comparator] The comparator invoked per element.
  20762. * @returns {Array} Returns the new array of shared values.
  20763. */
  20764. function baseIntersection(arrays, iteratee, comparator) {
  20765. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20766. length = arrays[0].length,
  20767. othLength = arrays.length,
  20768. othIndex = othLength,
  20769. caches = Array(othLength),
  20770. maxLength = Infinity,
  20771. result = [];
  20772. while (othIndex--) {
  20773. var array = arrays[othIndex];
  20774. if (othIndex && iteratee) {
  20775. array = arrayMap(array, baseUnary(iteratee));
  20776. }
  20777. maxLength = nativeMin(array.length, maxLength);
  20778. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20779. ? new SetCache(othIndex && array)
  20780. : undefined;
  20781. }
  20782. array = arrays[0];
  20783. var index = -1,
  20784. seen = caches[0];
  20785. outer:
  20786. while (++index < length && result.length < maxLength) {
  20787. var value = array[index],
  20788. computed = iteratee ? iteratee(value) : value;
  20789. value = (comparator || value !== 0) ? value : 0;
  20790. if (!(seen
  20791. ? cacheHas(seen, computed)
  20792. : includes(result, computed, comparator)
  20793. )) {
  20794. othIndex = othLength;
  20795. while (--othIndex) {
  20796. var cache = caches[othIndex];
  20797. if (!(cache
  20798. ? cacheHas(cache, computed)
  20799. : includes(arrays[othIndex], computed, comparator))
  20800. ) {
  20801. continue outer;
  20802. }
  20803. }
  20804. if (seen) {
  20805. seen.push(computed);
  20806. }
  20807. result.push(value);
  20808. }
  20809. }
  20810. return result;
  20811. }
  20812. /**
  20813. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20814. * `object` with values transformed by `iteratee` and set by `setter`.
  20815. *
  20816. * @private
  20817. * @param {Object} object The object to iterate over.
  20818. * @param {Function} setter The function to set `accumulator` values.
  20819. * @param {Function} iteratee The iteratee to transform values.
  20820. * @param {Object} accumulator The initial inverted object.
  20821. * @returns {Function} Returns `accumulator`.
  20822. */
  20823. function baseInverter(object, setter, iteratee, accumulator) {
  20824. baseForOwn(object, function(value, key, object) {
  20825. setter(accumulator, iteratee(value), key, object);
  20826. });
  20827. return accumulator;
  20828. }
  20829. /**
  20830. * The base implementation of `_.invoke` without support for individual
  20831. * method arguments.
  20832. *
  20833. * @private
  20834. * @param {Object} object The object to query.
  20835. * @param {Array|string} path The path of the method to invoke.
  20836. * @param {Array} args The arguments to invoke the method with.
  20837. * @returns {*} Returns the result of the invoked method.
  20838. */
  20839. function baseInvoke(object, path, args) {
  20840. path = castPath(path, object);
  20841. object = parent(object, path);
  20842. var func = object == null ? object : object[toKey(last(path))];
  20843. return func == null ? undefined : apply(func, object, args);
  20844. }
  20845. /**
  20846. * The base implementation of `_.isArguments`.
  20847. *
  20848. * @private
  20849. * @param {*} value The value to check.
  20850. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20851. */
  20852. function baseIsArguments(value) {
  20853. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20854. }
  20855. /**
  20856. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20857. *
  20858. * @private
  20859. * @param {*} value The value to check.
  20860. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20861. */
  20862. function baseIsArrayBuffer(value) {
  20863. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20864. }
  20865. /**
  20866. * The base implementation of `_.isDate` without Node.js optimizations.
  20867. *
  20868. * @private
  20869. * @param {*} value The value to check.
  20870. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20871. */
  20872. function baseIsDate(value) {
  20873. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20874. }
  20875. /**
  20876. * The base implementation of `_.isEqual` which supports partial comparisons
  20877. * and tracks traversed objects.
  20878. *
  20879. * @private
  20880. * @param {*} value The value to compare.
  20881. * @param {*} other The other value to compare.
  20882. * @param {boolean} bitmask The bitmask flags.
  20883. * 1 - Unordered comparison
  20884. * 2 - Partial comparison
  20885. * @param {Function} [customizer] The function to customize comparisons.
  20886. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20887. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20888. */
  20889. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20890. if (value === other) {
  20891. return true;
  20892. }
  20893. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20894. return value !== value && other !== other;
  20895. }
  20896. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20897. }
  20898. /**
  20899. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20900. * deep comparisons and tracks traversed objects enabling objects with circular
  20901. * references to be compared.
  20902. *
  20903. * @private
  20904. * @param {Object} object The object to compare.
  20905. * @param {Object} other The other object to compare.
  20906. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20907. * @param {Function} customizer The function to customize comparisons.
  20908. * @param {Function} equalFunc The function to determine equivalents of values.
  20909. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20910. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20911. */
  20912. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20913. var objIsArr = isArray(object),
  20914. othIsArr = isArray(other),
  20915. objTag = objIsArr ? arrayTag : getTag(object),
  20916. othTag = othIsArr ? arrayTag : getTag(other);
  20917. objTag = objTag == argsTag ? objectTag : objTag;
  20918. othTag = othTag == argsTag ? objectTag : othTag;
  20919. var objIsObj = objTag == objectTag,
  20920. othIsObj = othTag == objectTag,
  20921. isSameTag = objTag == othTag;
  20922. if (isSameTag && isBuffer(object)) {
  20923. if (!isBuffer(other)) {
  20924. return false;
  20925. }
  20926. objIsArr = true;
  20927. objIsObj = false;
  20928. }
  20929. if (isSameTag && !objIsObj) {
  20930. stack || (stack = new Stack);
  20931. return (objIsArr || isTypedArray(object))
  20932. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  20933. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  20934. }
  20935. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  20936. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  20937. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  20938. if (objIsWrapped || othIsWrapped) {
  20939. var objUnwrapped = objIsWrapped ? object.value() : object,
  20940. othUnwrapped = othIsWrapped ? other.value() : other;
  20941. stack || (stack = new Stack);
  20942. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  20943. }
  20944. }
  20945. if (!isSameTag) {
  20946. return false;
  20947. }
  20948. stack || (stack = new Stack);
  20949. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  20950. }
  20951. /**
  20952. * The base implementation of `_.isMap` without Node.js optimizations.
  20953. *
  20954. * @private
  20955. * @param {*} value The value to check.
  20956. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  20957. */
  20958. function baseIsMap(value) {
  20959. return isObjectLike(value) && getTag(value) == mapTag;
  20960. }
  20961. /**
  20962. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  20963. *
  20964. * @private
  20965. * @param {Object} object The object to inspect.
  20966. * @param {Object} source The object of property values to match.
  20967. * @param {Array} matchData The property names, values, and compare flags to match.
  20968. * @param {Function} [customizer] The function to customize comparisons.
  20969. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20970. */
  20971. function baseIsMatch(object, source, matchData, customizer) {
  20972. var index = matchData.length,
  20973. length = index,
  20974. noCustomizer = !customizer;
  20975. if (object == null) {
  20976. return !length;
  20977. }
  20978. object = Object(object);
  20979. while (index--) {
  20980. var data = matchData[index];
  20981. if ((noCustomizer && data[2])
  20982. ? data[1] !== object[data[0]]
  20983. : !(data[0] in object)
  20984. ) {
  20985. return false;
  20986. }
  20987. }
  20988. while (++index < length) {
  20989. data = matchData[index];
  20990. var key = data[0],
  20991. objValue = object[key],
  20992. srcValue = data[1];
  20993. if (noCustomizer && data[2]) {
  20994. if (objValue === undefined && !(key in object)) {
  20995. return false;
  20996. }
  20997. } else {
  20998. var stack = new Stack;
  20999. if (customizer) {
  21000. var result = customizer(objValue, srcValue, key, object, source, stack);
  21001. }
  21002. if (!(result === undefined
  21003. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21004. : result
  21005. )) {
  21006. return false;
  21007. }
  21008. }
  21009. }
  21010. return true;
  21011. }
  21012. /**
  21013. * The base implementation of `_.isNative` without bad shim checks.
  21014. *
  21015. * @private
  21016. * @param {*} value The value to check.
  21017. * @returns {boolean} Returns `true` if `value` is a native function,
  21018. * else `false`.
  21019. */
  21020. function baseIsNative(value) {
  21021. if (!isObject(value) || isMasked(value)) {
  21022. return false;
  21023. }
  21024. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21025. return pattern.test(toSource(value));
  21026. }
  21027. /**
  21028. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21029. *
  21030. * @private
  21031. * @param {*} value The value to check.
  21032. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21033. */
  21034. function baseIsRegExp(value) {
  21035. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21036. }
  21037. /**
  21038. * The base implementation of `_.isSet` without Node.js optimizations.
  21039. *
  21040. * @private
  21041. * @param {*} value The value to check.
  21042. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21043. */
  21044. function baseIsSet(value) {
  21045. return isObjectLike(value) && getTag(value) == setTag;
  21046. }
  21047. /**
  21048. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21049. *
  21050. * @private
  21051. * @param {*} value The value to check.
  21052. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21053. */
  21054. function baseIsTypedArray(value) {
  21055. return isObjectLike(value) &&
  21056. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21057. }
  21058. /**
  21059. * The base implementation of `_.iteratee`.
  21060. *
  21061. * @private
  21062. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21063. * @returns {Function} Returns the iteratee.
  21064. */
  21065. function baseIteratee(value) {
  21066. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21067. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21068. if (typeof value == 'function') {
  21069. return value;
  21070. }
  21071. if (value == null) {
  21072. return identity;
  21073. }
  21074. if (typeof value == 'object') {
  21075. return isArray(value)
  21076. ? baseMatchesProperty(value[0], value[1])
  21077. : baseMatches(value);
  21078. }
  21079. return property(value);
  21080. }
  21081. /**
  21082. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21083. *
  21084. * @private
  21085. * @param {Object} object The object to query.
  21086. * @returns {Array} Returns the array of property names.
  21087. */
  21088. function baseKeys(object) {
  21089. if (!isPrototype(object)) {
  21090. return nativeKeys(object);
  21091. }
  21092. var result = [];
  21093. for (var key in Object(object)) {
  21094. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21095. result.push(key);
  21096. }
  21097. }
  21098. return result;
  21099. }
  21100. /**
  21101. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21102. *
  21103. * @private
  21104. * @param {Object} object The object to query.
  21105. * @returns {Array} Returns the array of property names.
  21106. */
  21107. function baseKeysIn(object) {
  21108. if (!isObject(object)) {
  21109. return nativeKeysIn(object);
  21110. }
  21111. var isProto = isPrototype(object),
  21112. result = [];
  21113. for (var key in object) {
  21114. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21115. result.push(key);
  21116. }
  21117. }
  21118. return result;
  21119. }
  21120. /**
  21121. * The base implementation of `_.lt` which doesn't coerce arguments.
  21122. *
  21123. * @private
  21124. * @param {*} value The value to compare.
  21125. * @param {*} other The other value to compare.
  21126. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21127. * else `false`.
  21128. */
  21129. function baseLt(value, other) {
  21130. return value < other;
  21131. }
  21132. /**
  21133. * The base implementation of `_.map` without support for iteratee shorthands.
  21134. *
  21135. * @private
  21136. * @param {Array|Object} collection The collection to iterate over.
  21137. * @param {Function} iteratee The function invoked per iteration.
  21138. * @returns {Array} Returns the new mapped array.
  21139. */
  21140. function baseMap(collection, iteratee) {
  21141. var index = -1,
  21142. result = isArrayLike(collection) ? Array(collection.length) : [];
  21143. baseEach(collection, function(value, key, collection) {
  21144. result[++index] = iteratee(value, key, collection);
  21145. });
  21146. return result;
  21147. }
  21148. /**
  21149. * The base implementation of `_.matches` which doesn't clone `source`.
  21150. *
  21151. * @private
  21152. * @param {Object} source The object of property values to match.
  21153. * @returns {Function} Returns the new spec function.
  21154. */
  21155. function baseMatches(source) {
  21156. var matchData = getMatchData(source);
  21157. if (matchData.length == 1 && matchData[0][2]) {
  21158. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21159. }
  21160. return function(object) {
  21161. return object === source || baseIsMatch(object, source, matchData);
  21162. };
  21163. }
  21164. /**
  21165. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21166. *
  21167. * @private
  21168. * @param {string} path The path of the property to get.
  21169. * @param {*} srcValue The value to match.
  21170. * @returns {Function} Returns the new spec function.
  21171. */
  21172. function baseMatchesProperty(path, srcValue) {
  21173. if (isKey(path) && isStrictComparable(srcValue)) {
  21174. return matchesStrictComparable(toKey(path), srcValue);
  21175. }
  21176. return function(object) {
  21177. var objValue = get(object, path);
  21178. return (objValue === undefined && objValue === srcValue)
  21179. ? hasIn(object, path)
  21180. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21181. };
  21182. }
  21183. /**
  21184. * The base implementation of `_.merge` without support for multiple sources.
  21185. *
  21186. * @private
  21187. * @param {Object} object The destination object.
  21188. * @param {Object} source The source object.
  21189. * @param {number} srcIndex The index of `source`.
  21190. * @param {Function} [customizer] The function to customize merged values.
  21191. * @param {Object} [stack] Tracks traversed source values and their merged
  21192. * counterparts.
  21193. */
  21194. function baseMerge(object, source, srcIndex, customizer, stack) {
  21195. if (object === source) {
  21196. return;
  21197. }
  21198. baseFor(source, function(srcValue, key) {
  21199. stack || (stack = new Stack);
  21200. if (isObject(srcValue)) {
  21201. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21202. }
  21203. else {
  21204. var newValue = customizer
  21205. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21206. : undefined;
  21207. if (newValue === undefined) {
  21208. newValue = srcValue;
  21209. }
  21210. assignMergeValue(object, key, newValue);
  21211. }
  21212. }, keysIn);
  21213. }
  21214. /**
  21215. * A specialized version of `baseMerge` for arrays and objects which performs
  21216. * deep merges and tracks traversed objects enabling objects with circular
  21217. * references to be merged.
  21218. *
  21219. * @private
  21220. * @param {Object} object The destination object.
  21221. * @param {Object} source The source object.
  21222. * @param {string} key The key of the value to merge.
  21223. * @param {number} srcIndex The index of `source`.
  21224. * @param {Function} mergeFunc The function to merge values.
  21225. * @param {Function} [customizer] The function to customize assigned values.
  21226. * @param {Object} [stack] Tracks traversed source values and their merged
  21227. * counterparts.
  21228. */
  21229. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21230. var objValue = safeGet(object, key),
  21231. srcValue = safeGet(source, key),
  21232. stacked = stack.get(srcValue);
  21233. if (stacked) {
  21234. assignMergeValue(object, key, stacked);
  21235. return;
  21236. }
  21237. var newValue = customizer
  21238. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21239. : undefined;
  21240. var isCommon = newValue === undefined;
  21241. if (isCommon) {
  21242. var isArr = isArray(srcValue),
  21243. isBuff = !isArr && isBuffer(srcValue),
  21244. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21245. newValue = srcValue;
  21246. if (isArr || isBuff || isTyped) {
  21247. if (isArray(objValue)) {
  21248. newValue = objValue;
  21249. }
  21250. else if (isArrayLikeObject(objValue)) {
  21251. newValue = copyArray(objValue);
  21252. }
  21253. else if (isBuff) {
  21254. isCommon = false;
  21255. newValue = cloneBuffer(srcValue, true);
  21256. }
  21257. else if (isTyped) {
  21258. isCommon = false;
  21259. newValue = cloneTypedArray(srcValue, true);
  21260. }
  21261. else {
  21262. newValue = [];
  21263. }
  21264. }
  21265. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21266. newValue = objValue;
  21267. if (isArguments(objValue)) {
  21268. newValue = toPlainObject(objValue);
  21269. }
  21270. else if (!isObject(objValue) || isFunction(objValue)) {
  21271. newValue = initCloneObject(srcValue);
  21272. }
  21273. }
  21274. else {
  21275. isCommon = false;
  21276. }
  21277. }
  21278. if (isCommon) {
  21279. // Recursively merge objects and arrays (susceptible to call stack limits).
  21280. stack.set(srcValue, newValue);
  21281. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21282. stack['delete'](srcValue);
  21283. }
  21284. assignMergeValue(object, key, newValue);
  21285. }
  21286. /**
  21287. * The base implementation of `_.nth` which doesn't coerce arguments.
  21288. *
  21289. * @private
  21290. * @param {Array} array The array to query.
  21291. * @param {number} n The index of the element to return.
  21292. * @returns {*} Returns the nth element of `array`.
  21293. */
  21294. function baseNth(array, n) {
  21295. var length = array.length;
  21296. if (!length) {
  21297. return;
  21298. }
  21299. n += n < 0 ? length : 0;
  21300. return isIndex(n, length) ? array[n] : undefined;
  21301. }
  21302. /**
  21303. * The base implementation of `_.orderBy` without param guards.
  21304. *
  21305. * @private
  21306. * @param {Array|Object} collection The collection to iterate over.
  21307. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21308. * @param {string[]} orders The sort orders of `iteratees`.
  21309. * @returns {Array} Returns the new sorted array.
  21310. */
  21311. function baseOrderBy(collection, iteratees, orders) {
  21312. var index = -1;
  21313. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21314. var result = baseMap(collection, function(value, key, collection) {
  21315. var criteria = arrayMap(iteratees, function(iteratee) {
  21316. return iteratee(value);
  21317. });
  21318. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21319. });
  21320. return baseSortBy(result, function(object, other) {
  21321. return compareMultiple(object, other, orders);
  21322. });
  21323. }
  21324. /**
  21325. * The base implementation of `_.pick` without support for individual
  21326. * property identifiers.
  21327. *
  21328. * @private
  21329. * @param {Object} object The source object.
  21330. * @param {string[]} paths The property paths to pick.
  21331. * @returns {Object} Returns the new object.
  21332. */
  21333. function basePick(object, paths) {
  21334. return basePickBy(object, paths, function(value, path) {
  21335. return hasIn(object, path);
  21336. });
  21337. }
  21338. /**
  21339. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21340. *
  21341. * @private
  21342. * @param {Object} object The source object.
  21343. * @param {string[]} paths The property paths to pick.
  21344. * @param {Function} predicate The function invoked per property.
  21345. * @returns {Object} Returns the new object.
  21346. */
  21347. function basePickBy(object, paths, predicate) {
  21348. var index = -1,
  21349. length = paths.length,
  21350. result = {};
  21351. while (++index < length) {
  21352. var path = paths[index],
  21353. value = baseGet(object, path);
  21354. if (predicate(value, path)) {
  21355. baseSet(result, castPath(path, object), value);
  21356. }
  21357. }
  21358. return result;
  21359. }
  21360. /**
  21361. * A specialized version of `baseProperty` which supports deep paths.
  21362. *
  21363. * @private
  21364. * @param {Array|string} path The path of the property to get.
  21365. * @returns {Function} Returns the new accessor function.
  21366. */
  21367. function basePropertyDeep(path) {
  21368. return function(object) {
  21369. return baseGet(object, path);
  21370. };
  21371. }
  21372. /**
  21373. * The base implementation of `_.pullAllBy` without support for iteratee
  21374. * shorthands.
  21375. *
  21376. * @private
  21377. * @param {Array} array The array to modify.
  21378. * @param {Array} values The values to remove.
  21379. * @param {Function} [iteratee] The iteratee invoked per element.
  21380. * @param {Function} [comparator] The comparator invoked per element.
  21381. * @returns {Array} Returns `array`.
  21382. */
  21383. function basePullAll(array, values, iteratee, comparator) {
  21384. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21385. index = -1,
  21386. length = values.length,
  21387. seen = array;
  21388. if (array === values) {
  21389. values = copyArray(values);
  21390. }
  21391. if (iteratee) {
  21392. seen = arrayMap(array, baseUnary(iteratee));
  21393. }
  21394. while (++index < length) {
  21395. var fromIndex = 0,
  21396. value = values[index],
  21397. computed = iteratee ? iteratee(value) : value;
  21398. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21399. if (seen !== array) {
  21400. splice.call(seen, fromIndex, 1);
  21401. }
  21402. splice.call(array, fromIndex, 1);
  21403. }
  21404. }
  21405. return array;
  21406. }
  21407. /**
  21408. * The base implementation of `_.pullAt` without support for individual
  21409. * indexes or capturing the removed elements.
  21410. *
  21411. * @private
  21412. * @param {Array} array The array to modify.
  21413. * @param {number[]} indexes The indexes of elements to remove.
  21414. * @returns {Array} Returns `array`.
  21415. */
  21416. function basePullAt(array, indexes) {
  21417. var length = array ? indexes.length : 0,
  21418. lastIndex = length - 1;
  21419. while (length--) {
  21420. var index = indexes[length];
  21421. if (length == lastIndex || index !== previous) {
  21422. var previous = index;
  21423. if (isIndex(index)) {
  21424. splice.call(array, index, 1);
  21425. } else {
  21426. baseUnset(array, index);
  21427. }
  21428. }
  21429. }
  21430. return array;
  21431. }
  21432. /**
  21433. * The base implementation of `_.random` without support for returning
  21434. * floating-point numbers.
  21435. *
  21436. * @private
  21437. * @param {number} lower The lower bound.
  21438. * @param {number} upper The upper bound.
  21439. * @returns {number} Returns the random number.
  21440. */
  21441. function baseRandom(lower, upper) {
  21442. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21443. }
  21444. /**
  21445. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21446. * coerce arguments.
  21447. *
  21448. * @private
  21449. * @param {number} start The start of the range.
  21450. * @param {number} end The end of the range.
  21451. * @param {number} step The value to increment or decrement by.
  21452. * @param {boolean} [fromRight] Specify iterating from right to left.
  21453. * @returns {Array} Returns the range of numbers.
  21454. */
  21455. function baseRange(start, end, step, fromRight) {
  21456. var index = -1,
  21457. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21458. result = Array(length);
  21459. while (length--) {
  21460. result[fromRight ? length : ++index] = start;
  21461. start += step;
  21462. }
  21463. return result;
  21464. }
  21465. /**
  21466. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21467. *
  21468. * @private
  21469. * @param {string} string The string to repeat.
  21470. * @param {number} n The number of times to repeat the string.
  21471. * @returns {string} Returns the repeated string.
  21472. */
  21473. function baseRepeat(string, n) {
  21474. var result = '';
  21475. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21476. return result;
  21477. }
  21478. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21479. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21480. do {
  21481. if (n % 2) {
  21482. result += string;
  21483. }
  21484. n = nativeFloor(n / 2);
  21485. if (n) {
  21486. string += string;
  21487. }
  21488. } while (n);
  21489. return result;
  21490. }
  21491. /**
  21492. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21493. *
  21494. * @private
  21495. * @param {Function} func The function to apply a rest parameter to.
  21496. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21497. * @returns {Function} Returns the new function.
  21498. */
  21499. function baseRest(func, start) {
  21500. return setToString(overRest(func, start, identity), func + '');
  21501. }
  21502. /**
  21503. * The base implementation of `_.sample`.
  21504. *
  21505. * @private
  21506. * @param {Array|Object} collection The collection to sample.
  21507. * @returns {*} Returns the random element.
  21508. */
  21509. function baseSample(collection) {
  21510. return arraySample(values(collection));
  21511. }
  21512. /**
  21513. * The base implementation of `_.sampleSize` without param guards.
  21514. *
  21515. * @private
  21516. * @param {Array|Object} collection The collection to sample.
  21517. * @param {number} n The number of elements to sample.
  21518. * @returns {Array} Returns the random elements.
  21519. */
  21520. function baseSampleSize(collection, n) {
  21521. var array = values(collection);
  21522. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21523. }
  21524. /**
  21525. * The base implementation of `_.set`.
  21526. *
  21527. * @private
  21528. * @param {Object} object The object to modify.
  21529. * @param {Array|string} path The path of the property to set.
  21530. * @param {*} value The value to set.
  21531. * @param {Function} [customizer] The function to customize path creation.
  21532. * @returns {Object} Returns `object`.
  21533. */
  21534. function baseSet(object, path, value, customizer) {
  21535. if (!isObject(object)) {
  21536. return object;
  21537. }
  21538. path = castPath(path, object);
  21539. var index = -1,
  21540. length = path.length,
  21541. lastIndex = length - 1,
  21542. nested = object;
  21543. while (nested != null && ++index < length) {
  21544. var key = toKey(path[index]),
  21545. newValue = value;
  21546. if (index != lastIndex) {
  21547. var objValue = nested[key];
  21548. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21549. if (newValue === undefined) {
  21550. newValue = isObject(objValue)
  21551. ? objValue
  21552. : (isIndex(path[index + 1]) ? [] : {});
  21553. }
  21554. }
  21555. assignValue(nested, key, newValue);
  21556. nested = nested[key];
  21557. }
  21558. return object;
  21559. }
  21560. /**
  21561. * The base implementation of `setData` without support for hot loop shorting.
  21562. *
  21563. * @private
  21564. * @param {Function} func The function to associate metadata with.
  21565. * @param {*} data The metadata.
  21566. * @returns {Function} Returns `func`.
  21567. */
  21568. var baseSetData = !metaMap ? identity : function(func, data) {
  21569. metaMap.set(func, data);
  21570. return func;
  21571. };
  21572. /**
  21573. * The base implementation of `setToString` without support for hot loop shorting.
  21574. *
  21575. * @private
  21576. * @param {Function} func The function to modify.
  21577. * @param {Function} string The `toString` result.
  21578. * @returns {Function} Returns `func`.
  21579. */
  21580. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21581. return defineProperty(func, 'toString', {
  21582. 'configurable': true,
  21583. 'enumerable': false,
  21584. 'value': constant(string),
  21585. 'writable': true
  21586. });
  21587. };
  21588. /**
  21589. * The base implementation of `_.shuffle`.
  21590. *
  21591. * @private
  21592. * @param {Array|Object} collection The collection to shuffle.
  21593. * @returns {Array} Returns the new shuffled array.
  21594. */
  21595. function baseShuffle(collection) {
  21596. return shuffleSelf(values(collection));
  21597. }
  21598. /**
  21599. * The base implementation of `_.slice` without an iteratee call guard.
  21600. *
  21601. * @private
  21602. * @param {Array} array The array to slice.
  21603. * @param {number} [start=0] The start position.
  21604. * @param {number} [end=array.length] The end position.
  21605. * @returns {Array} Returns the slice of `array`.
  21606. */
  21607. function baseSlice(array, start, end) {
  21608. var index = -1,
  21609. length = array.length;
  21610. if (start < 0) {
  21611. start = -start > length ? 0 : (length + start);
  21612. }
  21613. end = end > length ? length : end;
  21614. if (end < 0) {
  21615. end += length;
  21616. }
  21617. length = start > end ? 0 : ((end - start) >>> 0);
  21618. start >>>= 0;
  21619. var result = Array(length);
  21620. while (++index < length) {
  21621. result[index] = array[index + start];
  21622. }
  21623. return result;
  21624. }
  21625. /**
  21626. * The base implementation of `_.some` without support for iteratee shorthands.
  21627. *
  21628. * @private
  21629. * @param {Array|Object} collection The collection to iterate over.
  21630. * @param {Function} predicate The function invoked per iteration.
  21631. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21632. * else `false`.
  21633. */
  21634. function baseSome(collection, predicate) {
  21635. var result;
  21636. baseEach(collection, function(value, index, collection) {
  21637. result = predicate(value, index, collection);
  21638. return !result;
  21639. });
  21640. return !!result;
  21641. }
  21642. /**
  21643. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21644. * performs a binary search of `array` to determine the index at which `value`
  21645. * should be inserted into `array` in order to maintain its sort order.
  21646. *
  21647. * @private
  21648. * @param {Array} array The sorted array to inspect.
  21649. * @param {*} value The value to evaluate.
  21650. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21651. * @returns {number} Returns the index at which `value` should be inserted
  21652. * into `array`.
  21653. */
  21654. function baseSortedIndex(array, value, retHighest) {
  21655. var low = 0,
  21656. high = array == null ? low : array.length;
  21657. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21658. while (low < high) {
  21659. var mid = (low + high) >>> 1,
  21660. computed = array[mid];
  21661. if (computed !== null && !isSymbol(computed) &&
  21662. (retHighest ? (computed <= value) : (computed < value))) {
  21663. low = mid + 1;
  21664. } else {
  21665. high = mid;
  21666. }
  21667. }
  21668. return high;
  21669. }
  21670. return baseSortedIndexBy(array, value, identity, retHighest);
  21671. }
  21672. /**
  21673. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21674. * which invokes `iteratee` for `value` and each element of `array` to compute
  21675. * their sort ranking. The iteratee is invoked with one argument; (value).
  21676. *
  21677. * @private
  21678. * @param {Array} array The sorted array to inspect.
  21679. * @param {*} value The value to evaluate.
  21680. * @param {Function} iteratee The iteratee invoked per element.
  21681. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21682. * @returns {number} Returns the index at which `value` should be inserted
  21683. * into `array`.
  21684. */
  21685. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21686. value = iteratee(value);
  21687. var low = 0,
  21688. high = array == null ? 0 : array.length,
  21689. valIsNaN = value !== value,
  21690. valIsNull = value === null,
  21691. valIsSymbol = isSymbol(value),
  21692. valIsUndefined = value === undefined;
  21693. while (low < high) {
  21694. var mid = nativeFloor((low + high) / 2),
  21695. computed = iteratee(array[mid]),
  21696. othIsDefined = computed !== undefined,
  21697. othIsNull = computed === null,
  21698. othIsReflexive = computed === computed,
  21699. othIsSymbol = isSymbol(computed);
  21700. if (valIsNaN) {
  21701. var setLow = retHighest || othIsReflexive;
  21702. } else if (valIsUndefined) {
  21703. setLow = othIsReflexive && (retHighest || othIsDefined);
  21704. } else if (valIsNull) {
  21705. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21706. } else if (valIsSymbol) {
  21707. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21708. } else if (othIsNull || othIsSymbol) {
  21709. setLow = false;
  21710. } else {
  21711. setLow = retHighest ? (computed <= value) : (computed < value);
  21712. }
  21713. if (setLow) {
  21714. low = mid + 1;
  21715. } else {
  21716. high = mid;
  21717. }
  21718. }
  21719. return nativeMin(high, MAX_ARRAY_INDEX);
  21720. }
  21721. /**
  21722. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21723. * support for iteratee shorthands.
  21724. *
  21725. * @private
  21726. * @param {Array} array The array to inspect.
  21727. * @param {Function} [iteratee] The iteratee invoked per element.
  21728. * @returns {Array} Returns the new duplicate free array.
  21729. */
  21730. function baseSortedUniq(array, iteratee) {
  21731. var index = -1,
  21732. length = array.length,
  21733. resIndex = 0,
  21734. result = [];
  21735. while (++index < length) {
  21736. var value = array[index],
  21737. computed = iteratee ? iteratee(value) : value;
  21738. if (!index || !eq(computed, seen)) {
  21739. var seen = computed;
  21740. result[resIndex++] = value === 0 ? 0 : value;
  21741. }
  21742. }
  21743. return result;
  21744. }
  21745. /**
  21746. * The base implementation of `_.toNumber` which doesn't ensure correct
  21747. * conversions of binary, hexadecimal, or octal string values.
  21748. *
  21749. * @private
  21750. * @param {*} value The value to process.
  21751. * @returns {number} Returns the number.
  21752. */
  21753. function baseToNumber(value) {
  21754. if (typeof value == 'number') {
  21755. return value;
  21756. }
  21757. if (isSymbol(value)) {
  21758. return NAN;
  21759. }
  21760. return +value;
  21761. }
  21762. /**
  21763. * The base implementation of `_.toString` which doesn't convert nullish
  21764. * values to empty strings.
  21765. *
  21766. * @private
  21767. * @param {*} value The value to process.
  21768. * @returns {string} Returns the string.
  21769. */
  21770. function baseToString(value) {
  21771. // Exit early for strings to avoid a performance hit in some environments.
  21772. if (typeof value == 'string') {
  21773. return value;
  21774. }
  21775. if (isArray(value)) {
  21776. // Recursively convert values (susceptible to call stack limits).
  21777. return arrayMap(value, baseToString) + '';
  21778. }
  21779. if (isSymbol(value)) {
  21780. return symbolToString ? symbolToString.call(value) : '';
  21781. }
  21782. var result = (value + '');
  21783. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21784. }
  21785. /**
  21786. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21787. *
  21788. * @private
  21789. * @param {Array} array The array to inspect.
  21790. * @param {Function} [iteratee] The iteratee invoked per element.
  21791. * @param {Function} [comparator] The comparator invoked per element.
  21792. * @returns {Array} Returns the new duplicate free array.
  21793. */
  21794. function baseUniq(array, iteratee, comparator) {
  21795. var index = -1,
  21796. includes = arrayIncludes,
  21797. length = array.length,
  21798. isCommon = true,
  21799. result = [],
  21800. seen = result;
  21801. if (comparator) {
  21802. isCommon = false;
  21803. includes = arrayIncludesWith;
  21804. }
  21805. else if (length >= LARGE_ARRAY_SIZE) {
  21806. var set = iteratee ? null : createSet(array);
  21807. if (set) {
  21808. return setToArray(set);
  21809. }
  21810. isCommon = false;
  21811. includes = cacheHas;
  21812. seen = new SetCache;
  21813. }
  21814. else {
  21815. seen = iteratee ? [] : result;
  21816. }
  21817. outer:
  21818. while (++index < length) {
  21819. var value = array[index],
  21820. computed = iteratee ? iteratee(value) : value;
  21821. value = (comparator || value !== 0) ? value : 0;
  21822. if (isCommon && computed === computed) {
  21823. var seenIndex = seen.length;
  21824. while (seenIndex--) {
  21825. if (seen[seenIndex] === computed) {
  21826. continue outer;
  21827. }
  21828. }
  21829. if (iteratee) {
  21830. seen.push(computed);
  21831. }
  21832. result.push(value);
  21833. }
  21834. else if (!includes(seen, computed, comparator)) {
  21835. if (seen !== result) {
  21836. seen.push(computed);
  21837. }
  21838. result.push(value);
  21839. }
  21840. }
  21841. return result;
  21842. }
  21843. /**
  21844. * The base implementation of `_.unset`.
  21845. *
  21846. * @private
  21847. * @param {Object} object The object to modify.
  21848. * @param {Array|string} path The property path to unset.
  21849. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21850. */
  21851. function baseUnset(object, path) {
  21852. path = castPath(path, object);
  21853. object = parent(object, path);
  21854. return object == null || delete object[toKey(last(path))];
  21855. }
  21856. /**
  21857. * The base implementation of `_.update`.
  21858. *
  21859. * @private
  21860. * @param {Object} object The object to modify.
  21861. * @param {Array|string} path The path of the property to update.
  21862. * @param {Function} updater The function to produce the updated value.
  21863. * @param {Function} [customizer] The function to customize path creation.
  21864. * @returns {Object} Returns `object`.
  21865. */
  21866. function baseUpdate(object, path, updater, customizer) {
  21867. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21868. }
  21869. /**
  21870. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21871. * without support for iteratee shorthands.
  21872. *
  21873. * @private
  21874. * @param {Array} array The array to query.
  21875. * @param {Function} predicate The function invoked per iteration.
  21876. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21877. * @param {boolean} [fromRight] Specify iterating from right to left.
  21878. * @returns {Array} Returns the slice of `array`.
  21879. */
  21880. function baseWhile(array, predicate, isDrop, fromRight) {
  21881. var length = array.length,
  21882. index = fromRight ? length : -1;
  21883. while ((fromRight ? index-- : ++index < length) &&
  21884. predicate(array[index], index, array)) {}
  21885. return isDrop
  21886. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21887. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21888. }
  21889. /**
  21890. * The base implementation of `wrapperValue` which returns the result of
  21891. * performing a sequence of actions on the unwrapped `value`, where each
  21892. * successive action is supplied the return value of the previous.
  21893. *
  21894. * @private
  21895. * @param {*} value The unwrapped value.
  21896. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21897. * @returns {*} Returns the resolved value.
  21898. */
  21899. function baseWrapperValue(value, actions) {
  21900. var result = value;
  21901. if (result instanceof LazyWrapper) {
  21902. result = result.value();
  21903. }
  21904. return arrayReduce(actions, function(result, action) {
  21905. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21906. }, result);
  21907. }
  21908. /**
  21909. * The base implementation of methods like `_.xor`, without support for
  21910. * iteratee shorthands, that accepts an array of arrays to inspect.
  21911. *
  21912. * @private
  21913. * @param {Array} arrays The arrays to inspect.
  21914. * @param {Function} [iteratee] The iteratee invoked per element.
  21915. * @param {Function} [comparator] The comparator invoked per element.
  21916. * @returns {Array} Returns the new array of values.
  21917. */
  21918. function baseXor(arrays, iteratee, comparator) {
  21919. var length = arrays.length;
  21920. if (length < 2) {
  21921. return length ? baseUniq(arrays[0]) : [];
  21922. }
  21923. var index = -1,
  21924. result = Array(length);
  21925. while (++index < length) {
  21926. var array = arrays[index],
  21927. othIndex = -1;
  21928. while (++othIndex < length) {
  21929. if (othIndex != index) {
  21930. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  21931. }
  21932. }
  21933. }
  21934. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  21935. }
  21936. /**
  21937. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  21938. *
  21939. * @private
  21940. * @param {Array} props The property identifiers.
  21941. * @param {Array} values The property values.
  21942. * @param {Function} assignFunc The function to assign values.
  21943. * @returns {Object} Returns the new object.
  21944. */
  21945. function baseZipObject(props, values, assignFunc) {
  21946. var index = -1,
  21947. length = props.length,
  21948. valsLength = values.length,
  21949. result = {};
  21950. while (++index < length) {
  21951. var value = index < valsLength ? values[index] : undefined;
  21952. assignFunc(result, props[index], value);
  21953. }
  21954. return result;
  21955. }
  21956. /**
  21957. * Casts `value` to an empty array if it's not an array like object.
  21958. *
  21959. * @private
  21960. * @param {*} value The value to inspect.
  21961. * @returns {Array|Object} Returns the cast array-like object.
  21962. */
  21963. function castArrayLikeObject(value) {
  21964. return isArrayLikeObject(value) ? value : [];
  21965. }
  21966. /**
  21967. * Casts `value` to `identity` if it's not a function.
  21968. *
  21969. * @private
  21970. * @param {*} value The value to inspect.
  21971. * @returns {Function} Returns cast function.
  21972. */
  21973. function castFunction(value) {
  21974. return typeof value == 'function' ? value : identity;
  21975. }
  21976. /**
  21977. * Casts `value` to a path array if it's not one.
  21978. *
  21979. * @private
  21980. * @param {*} value The value to inspect.
  21981. * @param {Object} [object] The object to query keys on.
  21982. * @returns {Array} Returns the cast property path array.
  21983. */
  21984. function castPath(value, object) {
  21985. if (isArray(value)) {
  21986. return value;
  21987. }
  21988. return isKey(value, object) ? [value] : stringToPath(toString(value));
  21989. }
  21990. /**
  21991. * A `baseRest` alias which can be replaced with `identity` by module
  21992. * replacement plugins.
  21993. *
  21994. * @private
  21995. * @type {Function}
  21996. * @param {Function} func The function to apply a rest parameter to.
  21997. * @returns {Function} Returns the new function.
  21998. */
  21999. var castRest = baseRest;
  22000. /**
  22001. * Casts `array` to a slice if it's needed.
  22002. *
  22003. * @private
  22004. * @param {Array} array The array to inspect.
  22005. * @param {number} start The start position.
  22006. * @param {number} [end=array.length] The end position.
  22007. * @returns {Array} Returns the cast slice.
  22008. */
  22009. function castSlice(array, start, end) {
  22010. var length = array.length;
  22011. end = end === undefined ? length : end;
  22012. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22013. }
  22014. /**
  22015. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22016. *
  22017. * @private
  22018. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22019. */
  22020. var clearTimeout = ctxClearTimeout || function(id) {
  22021. return root.clearTimeout(id);
  22022. };
  22023. /**
  22024. * Creates a clone of `buffer`.
  22025. *
  22026. * @private
  22027. * @param {Buffer} buffer The buffer to clone.
  22028. * @param {boolean} [isDeep] Specify a deep clone.
  22029. * @returns {Buffer} Returns the cloned buffer.
  22030. */
  22031. function cloneBuffer(buffer, isDeep) {
  22032. if (isDeep) {
  22033. return buffer.slice();
  22034. }
  22035. var length = buffer.length,
  22036. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22037. buffer.copy(result);
  22038. return result;
  22039. }
  22040. /**
  22041. * Creates a clone of `arrayBuffer`.
  22042. *
  22043. * @private
  22044. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22045. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22046. */
  22047. function cloneArrayBuffer(arrayBuffer) {
  22048. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22049. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22050. return result;
  22051. }
  22052. /**
  22053. * Creates a clone of `dataView`.
  22054. *
  22055. * @private
  22056. * @param {Object} dataView The data view to clone.
  22057. * @param {boolean} [isDeep] Specify a deep clone.
  22058. * @returns {Object} Returns the cloned data view.
  22059. */
  22060. function cloneDataView(dataView, isDeep) {
  22061. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22062. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22063. }
  22064. /**
  22065. * Creates a clone of `regexp`.
  22066. *
  22067. * @private
  22068. * @param {Object} regexp The regexp to clone.
  22069. * @returns {Object} Returns the cloned regexp.
  22070. */
  22071. function cloneRegExp(regexp) {
  22072. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22073. result.lastIndex = regexp.lastIndex;
  22074. return result;
  22075. }
  22076. /**
  22077. * Creates a clone of the `symbol` object.
  22078. *
  22079. * @private
  22080. * @param {Object} symbol The symbol object to clone.
  22081. * @returns {Object} Returns the cloned symbol object.
  22082. */
  22083. function cloneSymbol(symbol) {
  22084. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22085. }
  22086. /**
  22087. * Creates a clone of `typedArray`.
  22088. *
  22089. * @private
  22090. * @param {Object} typedArray The typed array to clone.
  22091. * @param {boolean} [isDeep] Specify a deep clone.
  22092. * @returns {Object} Returns the cloned typed array.
  22093. */
  22094. function cloneTypedArray(typedArray, isDeep) {
  22095. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22096. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22097. }
  22098. /**
  22099. * Compares values to sort them in ascending order.
  22100. *
  22101. * @private
  22102. * @param {*} value The value to compare.
  22103. * @param {*} other The other value to compare.
  22104. * @returns {number} Returns the sort order indicator for `value`.
  22105. */
  22106. function compareAscending(value, other) {
  22107. if (value !== other) {
  22108. var valIsDefined = value !== undefined,
  22109. valIsNull = value === null,
  22110. valIsReflexive = value === value,
  22111. valIsSymbol = isSymbol(value);
  22112. var othIsDefined = other !== undefined,
  22113. othIsNull = other === null,
  22114. othIsReflexive = other === other,
  22115. othIsSymbol = isSymbol(other);
  22116. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22117. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22118. (valIsNull && othIsDefined && othIsReflexive) ||
  22119. (!valIsDefined && othIsReflexive) ||
  22120. !valIsReflexive) {
  22121. return 1;
  22122. }
  22123. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22124. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22125. (othIsNull && valIsDefined && valIsReflexive) ||
  22126. (!othIsDefined && valIsReflexive) ||
  22127. !othIsReflexive) {
  22128. return -1;
  22129. }
  22130. }
  22131. return 0;
  22132. }
  22133. /**
  22134. * Used by `_.orderBy` to compare multiple properties of a value to another
  22135. * and stable sort them.
  22136. *
  22137. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22138. * specify an order of "desc" for descending or "asc" for ascending sort order
  22139. * of corresponding values.
  22140. *
  22141. * @private
  22142. * @param {Object} object The object to compare.
  22143. * @param {Object} other The other object to compare.
  22144. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22145. * @returns {number} Returns the sort order indicator for `object`.
  22146. */
  22147. function compareMultiple(object, other, orders) {
  22148. var index = -1,
  22149. objCriteria = object.criteria,
  22150. othCriteria = other.criteria,
  22151. length = objCriteria.length,
  22152. ordersLength = orders.length;
  22153. while (++index < length) {
  22154. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22155. if (result) {
  22156. if (index >= ordersLength) {
  22157. return result;
  22158. }
  22159. var order = orders[index];
  22160. return result * (order == 'desc' ? -1 : 1);
  22161. }
  22162. }
  22163. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22164. // that causes it, under certain circumstances, to provide the same value for
  22165. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22166. // for more details.
  22167. //
  22168. // This also ensures a stable sort in V8 and other engines.
  22169. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22170. return object.index - other.index;
  22171. }
  22172. /**
  22173. * Creates an array that is the composition of partially applied arguments,
  22174. * placeholders, and provided arguments into a single array of arguments.
  22175. *
  22176. * @private
  22177. * @param {Array} args The provided arguments.
  22178. * @param {Array} partials The arguments to prepend to those provided.
  22179. * @param {Array} holders The `partials` placeholder indexes.
  22180. * @params {boolean} [isCurried] Specify composing for a curried function.
  22181. * @returns {Array} Returns the new array of composed arguments.
  22182. */
  22183. function composeArgs(args, partials, holders, isCurried) {
  22184. var argsIndex = -1,
  22185. argsLength = args.length,
  22186. holdersLength = holders.length,
  22187. leftIndex = -1,
  22188. leftLength = partials.length,
  22189. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22190. result = Array(leftLength + rangeLength),
  22191. isUncurried = !isCurried;
  22192. while (++leftIndex < leftLength) {
  22193. result[leftIndex] = partials[leftIndex];
  22194. }
  22195. while (++argsIndex < holdersLength) {
  22196. if (isUncurried || argsIndex < argsLength) {
  22197. result[holders[argsIndex]] = args[argsIndex];
  22198. }
  22199. }
  22200. while (rangeLength--) {
  22201. result[leftIndex++] = args[argsIndex++];
  22202. }
  22203. return result;
  22204. }
  22205. /**
  22206. * This function is like `composeArgs` except that the arguments composition
  22207. * is tailored for `_.partialRight`.
  22208. *
  22209. * @private
  22210. * @param {Array} args The provided arguments.
  22211. * @param {Array} partials The arguments to append to those provided.
  22212. * @param {Array} holders The `partials` placeholder indexes.
  22213. * @params {boolean} [isCurried] Specify composing for a curried function.
  22214. * @returns {Array} Returns the new array of composed arguments.
  22215. */
  22216. function composeArgsRight(args, partials, holders, isCurried) {
  22217. var argsIndex = -1,
  22218. argsLength = args.length,
  22219. holdersIndex = -1,
  22220. holdersLength = holders.length,
  22221. rightIndex = -1,
  22222. rightLength = partials.length,
  22223. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22224. result = Array(rangeLength + rightLength),
  22225. isUncurried = !isCurried;
  22226. while (++argsIndex < rangeLength) {
  22227. result[argsIndex] = args[argsIndex];
  22228. }
  22229. var offset = argsIndex;
  22230. while (++rightIndex < rightLength) {
  22231. result[offset + rightIndex] = partials[rightIndex];
  22232. }
  22233. while (++holdersIndex < holdersLength) {
  22234. if (isUncurried || argsIndex < argsLength) {
  22235. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22236. }
  22237. }
  22238. return result;
  22239. }
  22240. /**
  22241. * Copies the values of `source` to `array`.
  22242. *
  22243. * @private
  22244. * @param {Array} source The array to copy values from.
  22245. * @param {Array} [array=[]] The array to copy values to.
  22246. * @returns {Array} Returns `array`.
  22247. */
  22248. function copyArray(source, array) {
  22249. var index = -1,
  22250. length = source.length;
  22251. array || (array = Array(length));
  22252. while (++index < length) {
  22253. array[index] = source[index];
  22254. }
  22255. return array;
  22256. }
  22257. /**
  22258. * Copies properties of `source` to `object`.
  22259. *
  22260. * @private
  22261. * @param {Object} source The object to copy properties from.
  22262. * @param {Array} props The property identifiers to copy.
  22263. * @param {Object} [object={}] The object to copy properties to.
  22264. * @param {Function} [customizer] The function to customize copied values.
  22265. * @returns {Object} Returns `object`.
  22266. */
  22267. function copyObject(source, props, object, customizer) {
  22268. var isNew = !object;
  22269. object || (object = {});
  22270. var index = -1,
  22271. length = props.length;
  22272. while (++index < length) {
  22273. var key = props[index];
  22274. var newValue = customizer
  22275. ? customizer(object[key], source[key], key, object, source)
  22276. : undefined;
  22277. if (newValue === undefined) {
  22278. newValue = source[key];
  22279. }
  22280. if (isNew) {
  22281. baseAssignValue(object, key, newValue);
  22282. } else {
  22283. assignValue(object, key, newValue);
  22284. }
  22285. }
  22286. return object;
  22287. }
  22288. /**
  22289. * Copies own symbols of `source` to `object`.
  22290. *
  22291. * @private
  22292. * @param {Object} source The object to copy symbols from.
  22293. * @param {Object} [object={}] The object to copy symbols to.
  22294. * @returns {Object} Returns `object`.
  22295. */
  22296. function copySymbols(source, object) {
  22297. return copyObject(source, getSymbols(source), object);
  22298. }
  22299. /**
  22300. * Copies own and inherited symbols of `source` to `object`.
  22301. *
  22302. * @private
  22303. * @param {Object} source The object to copy symbols from.
  22304. * @param {Object} [object={}] The object to copy symbols to.
  22305. * @returns {Object} Returns `object`.
  22306. */
  22307. function copySymbolsIn(source, object) {
  22308. return copyObject(source, getSymbolsIn(source), object);
  22309. }
  22310. /**
  22311. * Creates a function like `_.groupBy`.
  22312. *
  22313. * @private
  22314. * @param {Function} setter The function to set accumulator values.
  22315. * @param {Function} [initializer] The accumulator object initializer.
  22316. * @returns {Function} Returns the new aggregator function.
  22317. */
  22318. function createAggregator(setter, initializer) {
  22319. return function(collection, iteratee) {
  22320. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22321. accumulator = initializer ? initializer() : {};
  22322. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22323. };
  22324. }
  22325. /**
  22326. * Creates a function like `_.assign`.
  22327. *
  22328. * @private
  22329. * @param {Function} assigner The function to assign values.
  22330. * @returns {Function} Returns the new assigner function.
  22331. */
  22332. function createAssigner(assigner) {
  22333. return baseRest(function(object, sources) {
  22334. var index = -1,
  22335. length = sources.length,
  22336. customizer = length > 1 ? sources[length - 1] : undefined,
  22337. guard = length > 2 ? sources[2] : undefined;
  22338. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22339. ? (length--, customizer)
  22340. : undefined;
  22341. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22342. customizer = length < 3 ? undefined : customizer;
  22343. length = 1;
  22344. }
  22345. object = Object(object);
  22346. while (++index < length) {
  22347. var source = sources[index];
  22348. if (source) {
  22349. assigner(object, source, index, customizer);
  22350. }
  22351. }
  22352. return object;
  22353. });
  22354. }
  22355. /**
  22356. * Creates a `baseEach` or `baseEachRight` function.
  22357. *
  22358. * @private
  22359. * @param {Function} eachFunc The function to iterate over a collection.
  22360. * @param {boolean} [fromRight] Specify iterating from right to left.
  22361. * @returns {Function} Returns the new base function.
  22362. */
  22363. function createBaseEach(eachFunc, fromRight) {
  22364. return function(collection, iteratee) {
  22365. if (collection == null) {
  22366. return collection;
  22367. }
  22368. if (!isArrayLike(collection)) {
  22369. return eachFunc(collection, iteratee);
  22370. }
  22371. var length = collection.length,
  22372. index = fromRight ? length : -1,
  22373. iterable = Object(collection);
  22374. while ((fromRight ? index-- : ++index < length)) {
  22375. if (iteratee(iterable[index], index, iterable) === false) {
  22376. break;
  22377. }
  22378. }
  22379. return collection;
  22380. };
  22381. }
  22382. /**
  22383. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22384. *
  22385. * @private
  22386. * @param {boolean} [fromRight] Specify iterating from right to left.
  22387. * @returns {Function} Returns the new base function.
  22388. */
  22389. function createBaseFor(fromRight) {
  22390. return function(object, iteratee, keysFunc) {
  22391. var index = -1,
  22392. iterable = Object(object),
  22393. props = keysFunc(object),
  22394. length = props.length;
  22395. while (length--) {
  22396. var key = props[fromRight ? length : ++index];
  22397. if (iteratee(iterable[key], key, iterable) === false) {
  22398. break;
  22399. }
  22400. }
  22401. return object;
  22402. };
  22403. }
  22404. /**
  22405. * Creates a function that wraps `func` to invoke it with the optional `this`
  22406. * binding of `thisArg`.
  22407. *
  22408. * @private
  22409. * @param {Function} func The function to wrap.
  22410. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22411. * @param {*} [thisArg] The `this` binding of `func`.
  22412. * @returns {Function} Returns the new wrapped function.
  22413. */
  22414. function createBind(func, bitmask, thisArg) {
  22415. var isBind = bitmask & WRAP_BIND_FLAG,
  22416. Ctor = createCtor(func);
  22417. function wrapper() {
  22418. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22419. return fn.apply(isBind ? thisArg : this, arguments);
  22420. }
  22421. return wrapper;
  22422. }
  22423. /**
  22424. * Creates a function like `_.lowerFirst`.
  22425. *
  22426. * @private
  22427. * @param {string} methodName The name of the `String` case method to use.
  22428. * @returns {Function} Returns the new case function.
  22429. */
  22430. function createCaseFirst(methodName) {
  22431. return function(string) {
  22432. string = toString(string);
  22433. var strSymbols = hasUnicode(string)
  22434. ? stringToArray(string)
  22435. : undefined;
  22436. var chr = strSymbols
  22437. ? strSymbols[0]
  22438. : string.charAt(0);
  22439. var trailing = strSymbols
  22440. ? castSlice(strSymbols, 1).join('')
  22441. : string.slice(1);
  22442. return chr[methodName]() + trailing;
  22443. };
  22444. }
  22445. /**
  22446. * Creates a function like `_.camelCase`.
  22447. *
  22448. * @private
  22449. * @param {Function} callback The function to combine each word.
  22450. * @returns {Function} Returns the new compounder function.
  22451. */
  22452. function createCompounder(callback) {
  22453. return function(string) {
  22454. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22455. };
  22456. }
  22457. /**
  22458. * Creates a function that produces an instance of `Ctor` regardless of
  22459. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22460. *
  22461. * @private
  22462. * @param {Function} Ctor The constructor to wrap.
  22463. * @returns {Function} Returns the new wrapped function.
  22464. */
  22465. function createCtor(Ctor) {
  22466. return function() {
  22467. // Use a `switch` statement to work with class constructors. See
  22468. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22469. // for more details.
  22470. var args = arguments;
  22471. switch (args.length) {
  22472. case 0: return new Ctor;
  22473. case 1: return new Ctor(args[0]);
  22474. case 2: return new Ctor(args[0], args[1]);
  22475. case 3: return new Ctor(args[0], args[1], args[2]);
  22476. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22477. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22478. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22479. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22480. }
  22481. var thisBinding = baseCreate(Ctor.prototype),
  22482. result = Ctor.apply(thisBinding, args);
  22483. // Mimic the constructor's `return` behavior.
  22484. // See https://es5.github.io/#x13.2.2 for more details.
  22485. return isObject(result) ? result : thisBinding;
  22486. };
  22487. }
  22488. /**
  22489. * Creates a function that wraps `func` to enable currying.
  22490. *
  22491. * @private
  22492. * @param {Function} func The function to wrap.
  22493. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22494. * @param {number} arity The arity of `func`.
  22495. * @returns {Function} Returns the new wrapped function.
  22496. */
  22497. function createCurry(func, bitmask, arity) {
  22498. var Ctor = createCtor(func);
  22499. function wrapper() {
  22500. var length = arguments.length,
  22501. args = Array(length),
  22502. index = length,
  22503. placeholder = getHolder(wrapper);
  22504. while (index--) {
  22505. args[index] = arguments[index];
  22506. }
  22507. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22508. ? []
  22509. : replaceHolders(args, placeholder);
  22510. length -= holders.length;
  22511. if (length < arity) {
  22512. return createRecurry(
  22513. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22514. args, holders, undefined, undefined, arity - length);
  22515. }
  22516. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22517. return apply(fn, this, args);
  22518. }
  22519. return wrapper;
  22520. }
  22521. /**
  22522. * Creates a `_.find` or `_.findLast` function.
  22523. *
  22524. * @private
  22525. * @param {Function} findIndexFunc The function to find the collection index.
  22526. * @returns {Function} Returns the new find function.
  22527. */
  22528. function createFind(findIndexFunc) {
  22529. return function(collection, predicate, fromIndex) {
  22530. var iterable = Object(collection);
  22531. if (!isArrayLike(collection)) {
  22532. var iteratee = getIteratee(predicate, 3);
  22533. collection = keys(collection);
  22534. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22535. }
  22536. var index = findIndexFunc(collection, predicate, fromIndex);
  22537. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22538. };
  22539. }
  22540. /**
  22541. * Creates a `_.flow` or `_.flowRight` function.
  22542. *
  22543. * @private
  22544. * @param {boolean} [fromRight] Specify iterating from right to left.
  22545. * @returns {Function} Returns the new flow function.
  22546. */
  22547. function createFlow(fromRight) {
  22548. return flatRest(function(funcs) {
  22549. var length = funcs.length,
  22550. index = length,
  22551. prereq = LodashWrapper.prototype.thru;
  22552. if (fromRight) {
  22553. funcs.reverse();
  22554. }
  22555. while (index--) {
  22556. var func = funcs[index];
  22557. if (typeof func != 'function') {
  22558. throw new TypeError(FUNC_ERROR_TEXT);
  22559. }
  22560. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22561. var wrapper = new LodashWrapper([], true);
  22562. }
  22563. }
  22564. index = wrapper ? index : length;
  22565. while (++index < length) {
  22566. func = funcs[index];
  22567. var funcName = getFuncName(func),
  22568. data = funcName == 'wrapper' ? getData(func) : undefined;
  22569. if (data && isLaziable(data[0]) &&
  22570. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22571. !data[4].length && data[9] == 1
  22572. ) {
  22573. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22574. } else {
  22575. wrapper = (func.length == 1 && isLaziable(func))
  22576. ? wrapper[funcName]()
  22577. : wrapper.thru(func);
  22578. }
  22579. }
  22580. return function() {
  22581. var args = arguments,
  22582. value = args[0];
  22583. if (wrapper && args.length == 1 && isArray(value)) {
  22584. return wrapper.plant(value).value();
  22585. }
  22586. var index = 0,
  22587. result = length ? funcs[index].apply(this, args) : value;
  22588. while (++index < length) {
  22589. result = funcs[index].call(this, result);
  22590. }
  22591. return result;
  22592. };
  22593. });
  22594. }
  22595. /**
  22596. * Creates a function that wraps `func` to invoke it with optional `this`
  22597. * binding of `thisArg`, partial application, and currying.
  22598. *
  22599. * @private
  22600. * @param {Function|string} func The function or method name to wrap.
  22601. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22602. * @param {*} [thisArg] The `this` binding of `func`.
  22603. * @param {Array} [partials] The arguments to prepend to those provided to
  22604. * the new function.
  22605. * @param {Array} [holders] The `partials` placeholder indexes.
  22606. * @param {Array} [partialsRight] The arguments to append to those provided
  22607. * to the new function.
  22608. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22609. * @param {Array} [argPos] The argument positions of the new function.
  22610. * @param {number} [ary] The arity cap of `func`.
  22611. * @param {number} [arity] The arity of `func`.
  22612. * @returns {Function} Returns the new wrapped function.
  22613. */
  22614. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22615. var isAry = bitmask & WRAP_ARY_FLAG,
  22616. isBind = bitmask & WRAP_BIND_FLAG,
  22617. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22618. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22619. isFlip = bitmask & WRAP_FLIP_FLAG,
  22620. Ctor = isBindKey ? undefined : createCtor(func);
  22621. function wrapper() {
  22622. var length = arguments.length,
  22623. args = Array(length),
  22624. index = length;
  22625. while (index--) {
  22626. args[index] = arguments[index];
  22627. }
  22628. if (isCurried) {
  22629. var placeholder = getHolder(wrapper),
  22630. holdersCount = countHolders(args, placeholder);
  22631. }
  22632. if (partials) {
  22633. args = composeArgs(args, partials, holders, isCurried);
  22634. }
  22635. if (partialsRight) {
  22636. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22637. }
  22638. length -= holdersCount;
  22639. if (isCurried && length < arity) {
  22640. var newHolders = replaceHolders(args, placeholder);
  22641. return createRecurry(
  22642. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22643. args, newHolders, argPos, ary, arity - length
  22644. );
  22645. }
  22646. var thisBinding = isBind ? thisArg : this,
  22647. fn = isBindKey ? thisBinding[func] : func;
  22648. length = args.length;
  22649. if (argPos) {
  22650. args = reorder(args, argPos);
  22651. } else if (isFlip && length > 1) {
  22652. args.reverse();
  22653. }
  22654. if (isAry && ary < length) {
  22655. args.length = ary;
  22656. }
  22657. if (this && this !== root && this instanceof wrapper) {
  22658. fn = Ctor || createCtor(fn);
  22659. }
  22660. return fn.apply(thisBinding, args);
  22661. }
  22662. return wrapper;
  22663. }
  22664. /**
  22665. * Creates a function like `_.invertBy`.
  22666. *
  22667. * @private
  22668. * @param {Function} setter The function to set accumulator values.
  22669. * @param {Function} toIteratee The function to resolve iteratees.
  22670. * @returns {Function} Returns the new inverter function.
  22671. */
  22672. function createInverter(setter, toIteratee) {
  22673. return function(object, iteratee) {
  22674. return baseInverter(object, setter, toIteratee(iteratee), {});
  22675. };
  22676. }
  22677. /**
  22678. * Creates a function that performs a mathematical operation on two values.
  22679. *
  22680. * @private
  22681. * @param {Function} operator The function to perform the operation.
  22682. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22683. * @returns {Function} Returns the new mathematical operation function.
  22684. */
  22685. function createMathOperation(operator, defaultValue) {
  22686. return function(value, other) {
  22687. var result;
  22688. if (value === undefined && other === undefined) {
  22689. return defaultValue;
  22690. }
  22691. if (value !== undefined) {
  22692. result = value;
  22693. }
  22694. if (other !== undefined) {
  22695. if (result === undefined) {
  22696. return other;
  22697. }
  22698. if (typeof value == 'string' || typeof other == 'string') {
  22699. value = baseToString(value);
  22700. other = baseToString(other);
  22701. } else {
  22702. value = baseToNumber(value);
  22703. other = baseToNumber(other);
  22704. }
  22705. result = operator(value, other);
  22706. }
  22707. return result;
  22708. };
  22709. }
  22710. /**
  22711. * Creates a function like `_.over`.
  22712. *
  22713. * @private
  22714. * @param {Function} arrayFunc The function to iterate over iteratees.
  22715. * @returns {Function} Returns the new over function.
  22716. */
  22717. function createOver(arrayFunc) {
  22718. return flatRest(function(iteratees) {
  22719. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22720. return baseRest(function(args) {
  22721. var thisArg = this;
  22722. return arrayFunc(iteratees, function(iteratee) {
  22723. return apply(iteratee, thisArg, args);
  22724. });
  22725. });
  22726. });
  22727. }
  22728. /**
  22729. * Creates the padding for `string` based on `length`. The `chars` string
  22730. * is truncated if the number of characters exceeds `length`.
  22731. *
  22732. * @private
  22733. * @param {number} length The padding length.
  22734. * @param {string} [chars=' '] The string used as padding.
  22735. * @returns {string} Returns the padding for `string`.
  22736. */
  22737. function createPadding(length, chars) {
  22738. chars = chars === undefined ? ' ' : baseToString(chars);
  22739. var charsLength = chars.length;
  22740. if (charsLength < 2) {
  22741. return charsLength ? baseRepeat(chars, length) : chars;
  22742. }
  22743. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22744. return hasUnicode(chars)
  22745. ? castSlice(stringToArray(result), 0, length).join('')
  22746. : result.slice(0, length);
  22747. }
  22748. /**
  22749. * Creates a function that wraps `func` to invoke it with the `this` binding
  22750. * of `thisArg` and `partials` prepended to the arguments it receives.
  22751. *
  22752. * @private
  22753. * @param {Function} func The function to wrap.
  22754. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22755. * @param {*} thisArg The `this` binding of `func`.
  22756. * @param {Array} partials The arguments to prepend to those provided to
  22757. * the new function.
  22758. * @returns {Function} Returns the new wrapped function.
  22759. */
  22760. function createPartial(func, bitmask, thisArg, partials) {
  22761. var isBind = bitmask & WRAP_BIND_FLAG,
  22762. Ctor = createCtor(func);
  22763. function wrapper() {
  22764. var argsIndex = -1,
  22765. argsLength = arguments.length,
  22766. leftIndex = -1,
  22767. leftLength = partials.length,
  22768. args = Array(leftLength + argsLength),
  22769. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22770. while (++leftIndex < leftLength) {
  22771. args[leftIndex] = partials[leftIndex];
  22772. }
  22773. while (argsLength--) {
  22774. args[leftIndex++] = arguments[++argsIndex];
  22775. }
  22776. return apply(fn, isBind ? thisArg : this, args);
  22777. }
  22778. return wrapper;
  22779. }
  22780. /**
  22781. * Creates a `_.range` or `_.rangeRight` function.
  22782. *
  22783. * @private
  22784. * @param {boolean} [fromRight] Specify iterating from right to left.
  22785. * @returns {Function} Returns the new range function.
  22786. */
  22787. function createRange(fromRight) {
  22788. return function(start, end, step) {
  22789. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22790. end = step = undefined;
  22791. }
  22792. // Ensure the sign of `-0` is preserved.
  22793. start = toFinite(start);
  22794. if (end === undefined) {
  22795. end = start;
  22796. start = 0;
  22797. } else {
  22798. end = toFinite(end);
  22799. }
  22800. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22801. return baseRange(start, end, step, fromRight);
  22802. };
  22803. }
  22804. /**
  22805. * Creates a function that performs a relational operation on two values.
  22806. *
  22807. * @private
  22808. * @param {Function} operator The function to perform the operation.
  22809. * @returns {Function} Returns the new relational operation function.
  22810. */
  22811. function createRelationalOperation(operator) {
  22812. return function(value, other) {
  22813. if (!(typeof value == 'string' && typeof other == 'string')) {
  22814. value = toNumber(value);
  22815. other = toNumber(other);
  22816. }
  22817. return operator(value, other);
  22818. };
  22819. }
  22820. /**
  22821. * Creates a function that wraps `func` to continue currying.
  22822. *
  22823. * @private
  22824. * @param {Function} func The function to wrap.
  22825. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22826. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22827. * @param {*} placeholder The placeholder value.
  22828. * @param {*} [thisArg] The `this` binding of `func`.
  22829. * @param {Array} [partials] The arguments to prepend to those provided to
  22830. * the new function.
  22831. * @param {Array} [holders] The `partials` placeholder indexes.
  22832. * @param {Array} [argPos] The argument positions of the new function.
  22833. * @param {number} [ary] The arity cap of `func`.
  22834. * @param {number} [arity] The arity of `func`.
  22835. * @returns {Function} Returns the new wrapped function.
  22836. */
  22837. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22838. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22839. newHolders = isCurry ? holders : undefined,
  22840. newHoldersRight = isCurry ? undefined : holders,
  22841. newPartials = isCurry ? partials : undefined,
  22842. newPartialsRight = isCurry ? undefined : partials;
  22843. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22844. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22845. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22846. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22847. }
  22848. var newData = [
  22849. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22850. newHoldersRight, argPos, ary, arity
  22851. ];
  22852. var result = wrapFunc.apply(undefined, newData);
  22853. if (isLaziable(func)) {
  22854. setData(result, newData);
  22855. }
  22856. result.placeholder = placeholder;
  22857. return setWrapToString(result, func, bitmask);
  22858. }
  22859. /**
  22860. * Creates a function like `_.round`.
  22861. *
  22862. * @private
  22863. * @param {string} methodName The name of the `Math` method to use when rounding.
  22864. * @returns {Function} Returns the new round function.
  22865. */
  22866. function createRound(methodName) {
  22867. var func = Math[methodName];
  22868. return function(number, precision) {
  22869. number = toNumber(number);
  22870. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22871. if (precision && nativeIsFinite(number)) {
  22872. // Shift with exponential notation to avoid floating-point issues.
  22873. // See [MDN](https://mdn.io/round#Examples) for more details.
  22874. var pair = (toString(number) + 'e').split('e'),
  22875. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22876. pair = (toString(value) + 'e').split('e');
  22877. return +(pair[0] + 'e' + (+pair[1] - precision));
  22878. }
  22879. return func(number);
  22880. };
  22881. }
  22882. /**
  22883. * Creates a set object of `values`.
  22884. *
  22885. * @private
  22886. * @param {Array} values The values to add to the set.
  22887. * @returns {Object} Returns the new set.
  22888. */
  22889. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22890. return new Set(values);
  22891. };
  22892. /**
  22893. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22894. *
  22895. * @private
  22896. * @param {Function} keysFunc The function to get the keys of a given object.
  22897. * @returns {Function} Returns the new pairs function.
  22898. */
  22899. function createToPairs(keysFunc) {
  22900. return function(object) {
  22901. var tag = getTag(object);
  22902. if (tag == mapTag) {
  22903. return mapToArray(object);
  22904. }
  22905. if (tag == setTag) {
  22906. return setToPairs(object);
  22907. }
  22908. return baseToPairs(object, keysFunc(object));
  22909. };
  22910. }
  22911. /**
  22912. * Creates a function that either curries or invokes `func` with optional
  22913. * `this` binding and partially applied arguments.
  22914. *
  22915. * @private
  22916. * @param {Function|string} func The function or method name to wrap.
  22917. * @param {number} bitmask The bitmask flags.
  22918. * 1 - `_.bind`
  22919. * 2 - `_.bindKey`
  22920. * 4 - `_.curry` or `_.curryRight` of a bound function
  22921. * 8 - `_.curry`
  22922. * 16 - `_.curryRight`
  22923. * 32 - `_.partial`
  22924. * 64 - `_.partialRight`
  22925. * 128 - `_.rearg`
  22926. * 256 - `_.ary`
  22927. * 512 - `_.flip`
  22928. * @param {*} [thisArg] The `this` binding of `func`.
  22929. * @param {Array} [partials] The arguments to be partially applied.
  22930. * @param {Array} [holders] The `partials` placeholder indexes.
  22931. * @param {Array} [argPos] The argument positions of the new function.
  22932. * @param {number} [ary] The arity cap of `func`.
  22933. * @param {number} [arity] The arity of `func`.
  22934. * @returns {Function} Returns the new wrapped function.
  22935. */
  22936. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  22937. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  22938. if (!isBindKey && typeof func != 'function') {
  22939. throw new TypeError(FUNC_ERROR_TEXT);
  22940. }
  22941. var length = partials ? partials.length : 0;
  22942. if (!length) {
  22943. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  22944. partials = holders = undefined;
  22945. }
  22946. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  22947. arity = arity === undefined ? arity : toInteger(arity);
  22948. length -= holders ? holders.length : 0;
  22949. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  22950. var partialsRight = partials,
  22951. holdersRight = holders;
  22952. partials = holders = undefined;
  22953. }
  22954. var data = isBindKey ? undefined : getData(func);
  22955. var newData = [
  22956. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  22957. argPos, ary, arity
  22958. ];
  22959. if (data) {
  22960. mergeData(newData, data);
  22961. }
  22962. func = newData[0];
  22963. bitmask = newData[1];
  22964. thisArg = newData[2];
  22965. partials = newData[3];
  22966. holders = newData[4];
  22967. arity = newData[9] = newData[9] === undefined
  22968. ? (isBindKey ? 0 : func.length)
  22969. : nativeMax(newData[9] - length, 0);
  22970. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  22971. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  22972. }
  22973. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  22974. var result = createBind(func, bitmask, thisArg);
  22975. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  22976. result = createCurry(func, bitmask, arity);
  22977. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  22978. result = createPartial(func, bitmask, thisArg, partials);
  22979. } else {
  22980. result = createHybrid.apply(undefined, newData);
  22981. }
  22982. var setter = data ? baseSetData : setData;
  22983. return setWrapToString(setter(result, newData), func, bitmask);
  22984. }
  22985. /**
  22986. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  22987. * of source objects to the destination object for all destination properties
  22988. * that resolve to `undefined`.
  22989. *
  22990. * @private
  22991. * @param {*} objValue The destination value.
  22992. * @param {*} srcValue The source value.
  22993. * @param {string} key The key of the property to assign.
  22994. * @param {Object} object The parent object of `objValue`.
  22995. * @returns {*} Returns the value to assign.
  22996. */
  22997. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  22998. if (objValue === undefined ||
  22999. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23000. return srcValue;
  23001. }
  23002. return objValue;
  23003. }
  23004. /**
  23005. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23006. * objects into destination objects that are passed thru.
  23007. *
  23008. * @private
  23009. * @param {*} objValue The destination value.
  23010. * @param {*} srcValue The source value.
  23011. * @param {string} key The key of the property to merge.
  23012. * @param {Object} object The parent object of `objValue`.
  23013. * @param {Object} source The parent object of `srcValue`.
  23014. * @param {Object} [stack] Tracks traversed source values and their merged
  23015. * counterparts.
  23016. * @returns {*} Returns the value to assign.
  23017. */
  23018. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23019. if (isObject(objValue) && isObject(srcValue)) {
  23020. // Recursively merge objects and arrays (susceptible to call stack limits).
  23021. stack.set(srcValue, objValue);
  23022. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23023. stack['delete'](srcValue);
  23024. }
  23025. return objValue;
  23026. }
  23027. /**
  23028. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23029. * objects.
  23030. *
  23031. * @private
  23032. * @param {*} value The value to inspect.
  23033. * @param {string} key The key of the property to inspect.
  23034. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23035. */
  23036. function customOmitClone(value) {
  23037. return isPlainObject(value) ? undefined : value;
  23038. }
  23039. /**
  23040. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23041. * partial deep comparisons.
  23042. *
  23043. * @private
  23044. * @param {Array} array The array to compare.
  23045. * @param {Array} other The other array to compare.
  23046. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23047. * @param {Function} customizer The function to customize comparisons.
  23048. * @param {Function} equalFunc The function to determine equivalents of values.
  23049. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23050. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23051. */
  23052. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23053. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23054. arrLength = array.length,
  23055. othLength = other.length;
  23056. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23057. return false;
  23058. }
  23059. // Assume cyclic values are equal.
  23060. var stacked = stack.get(array);
  23061. if (stacked && stack.get(other)) {
  23062. return stacked == other;
  23063. }
  23064. var index = -1,
  23065. result = true,
  23066. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23067. stack.set(array, other);
  23068. stack.set(other, array);
  23069. // Ignore non-index properties.
  23070. while (++index < arrLength) {
  23071. var arrValue = array[index],
  23072. othValue = other[index];
  23073. if (customizer) {
  23074. var compared = isPartial
  23075. ? customizer(othValue, arrValue, index, other, array, stack)
  23076. : customizer(arrValue, othValue, index, array, other, stack);
  23077. }
  23078. if (compared !== undefined) {
  23079. if (compared) {
  23080. continue;
  23081. }
  23082. result = false;
  23083. break;
  23084. }
  23085. // Recursively compare arrays (susceptible to call stack limits).
  23086. if (seen) {
  23087. if (!arraySome(other, function(othValue, othIndex) {
  23088. if (!cacheHas(seen, othIndex) &&
  23089. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23090. return seen.push(othIndex);
  23091. }
  23092. })) {
  23093. result = false;
  23094. break;
  23095. }
  23096. } else if (!(
  23097. arrValue === othValue ||
  23098. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23099. )) {
  23100. result = false;
  23101. break;
  23102. }
  23103. }
  23104. stack['delete'](array);
  23105. stack['delete'](other);
  23106. return result;
  23107. }
  23108. /**
  23109. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23110. * the same `toStringTag`.
  23111. *
  23112. * **Note:** This function only supports comparing values with tags of
  23113. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23114. *
  23115. * @private
  23116. * @param {Object} object The object to compare.
  23117. * @param {Object} other The other object to compare.
  23118. * @param {string} tag The `toStringTag` of the objects to compare.
  23119. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23120. * @param {Function} customizer The function to customize comparisons.
  23121. * @param {Function} equalFunc The function to determine equivalents of values.
  23122. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23123. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23124. */
  23125. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23126. switch (tag) {
  23127. case dataViewTag:
  23128. if ((object.byteLength != other.byteLength) ||
  23129. (object.byteOffset != other.byteOffset)) {
  23130. return false;
  23131. }
  23132. object = object.buffer;
  23133. other = other.buffer;
  23134. case arrayBufferTag:
  23135. if ((object.byteLength != other.byteLength) ||
  23136. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23137. return false;
  23138. }
  23139. return true;
  23140. case boolTag:
  23141. case dateTag:
  23142. case numberTag:
  23143. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23144. // Invalid dates are coerced to `NaN`.
  23145. return eq(+object, +other);
  23146. case errorTag:
  23147. return object.name == other.name && object.message == other.message;
  23148. case regexpTag:
  23149. case stringTag:
  23150. // Coerce regexes to strings and treat strings, primitives and objects,
  23151. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23152. // for more details.
  23153. return object == (other + '');
  23154. case mapTag:
  23155. var convert = mapToArray;
  23156. case setTag:
  23157. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23158. convert || (convert = setToArray);
  23159. if (object.size != other.size && !isPartial) {
  23160. return false;
  23161. }
  23162. // Assume cyclic values are equal.
  23163. var stacked = stack.get(object);
  23164. if (stacked) {
  23165. return stacked == other;
  23166. }
  23167. bitmask |= COMPARE_UNORDERED_FLAG;
  23168. // Recursively compare objects (susceptible to call stack limits).
  23169. stack.set(object, other);
  23170. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23171. stack['delete'](object);
  23172. return result;
  23173. case symbolTag:
  23174. if (symbolValueOf) {
  23175. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23176. }
  23177. }
  23178. return false;
  23179. }
  23180. /**
  23181. * A specialized version of `baseIsEqualDeep` for objects with support for
  23182. * partial deep comparisons.
  23183. *
  23184. * @private
  23185. * @param {Object} object The object to compare.
  23186. * @param {Object} other The other object to compare.
  23187. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23188. * @param {Function} customizer The function to customize comparisons.
  23189. * @param {Function} equalFunc The function to determine equivalents of values.
  23190. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23191. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23192. */
  23193. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23194. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23195. objProps = getAllKeys(object),
  23196. objLength = objProps.length,
  23197. othProps = getAllKeys(other),
  23198. othLength = othProps.length;
  23199. if (objLength != othLength && !isPartial) {
  23200. return false;
  23201. }
  23202. var index = objLength;
  23203. while (index--) {
  23204. var key = objProps[index];
  23205. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23206. return false;
  23207. }
  23208. }
  23209. // Assume cyclic values are equal.
  23210. var stacked = stack.get(object);
  23211. if (stacked && stack.get(other)) {
  23212. return stacked == other;
  23213. }
  23214. var result = true;
  23215. stack.set(object, other);
  23216. stack.set(other, object);
  23217. var skipCtor = isPartial;
  23218. while (++index < objLength) {
  23219. key = objProps[index];
  23220. var objValue = object[key],
  23221. othValue = other[key];
  23222. if (customizer) {
  23223. var compared = isPartial
  23224. ? customizer(othValue, objValue, key, other, object, stack)
  23225. : customizer(objValue, othValue, key, object, other, stack);
  23226. }
  23227. // Recursively compare objects (susceptible to call stack limits).
  23228. if (!(compared === undefined
  23229. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23230. : compared
  23231. )) {
  23232. result = false;
  23233. break;
  23234. }
  23235. skipCtor || (skipCtor = key == 'constructor');
  23236. }
  23237. if (result && !skipCtor) {
  23238. var objCtor = object.constructor,
  23239. othCtor = other.constructor;
  23240. // Non `Object` object instances with different constructors are not equal.
  23241. if (objCtor != othCtor &&
  23242. ('constructor' in object && 'constructor' in other) &&
  23243. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23244. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23245. result = false;
  23246. }
  23247. }
  23248. stack['delete'](object);
  23249. stack['delete'](other);
  23250. return result;
  23251. }
  23252. /**
  23253. * A specialized version of `baseRest` which flattens the rest array.
  23254. *
  23255. * @private
  23256. * @param {Function} func The function to apply a rest parameter to.
  23257. * @returns {Function} Returns the new function.
  23258. */
  23259. function flatRest(func) {
  23260. return setToString(overRest(func, undefined, flatten), func + '');
  23261. }
  23262. /**
  23263. * Creates an array of own enumerable property names and symbols of `object`.
  23264. *
  23265. * @private
  23266. * @param {Object} object The object to query.
  23267. * @returns {Array} Returns the array of property names and symbols.
  23268. */
  23269. function getAllKeys(object) {
  23270. return baseGetAllKeys(object, keys, getSymbols);
  23271. }
  23272. /**
  23273. * Creates an array of own and inherited enumerable property names and
  23274. * symbols of `object`.
  23275. *
  23276. * @private
  23277. * @param {Object} object The object to query.
  23278. * @returns {Array} Returns the array of property names and symbols.
  23279. */
  23280. function getAllKeysIn(object) {
  23281. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23282. }
  23283. /**
  23284. * Gets metadata for `func`.
  23285. *
  23286. * @private
  23287. * @param {Function} func The function to query.
  23288. * @returns {*} Returns the metadata for `func`.
  23289. */
  23290. var getData = !metaMap ? noop : function(func) {
  23291. return metaMap.get(func);
  23292. };
  23293. /**
  23294. * Gets the name of `func`.
  23295. *
  23296. * @private
  23297. * @param {Function} func The function to query.
  23298. * @returns {string} Returns the function name.
  23299. */
  23300. function getFuncName(func) {
  23301. var result = (func.name + ''),
  23302. array = realNames[result],
  23303. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23304. while (length--) {
  23305. var data = array[length],
  23306. otherFunc = data.func;
  23307. if (otherFunc == null || otherFunc == func) {
  23308. return data.name;
  23309. }
  23310. }
  23311. return result;
  23312. }
  23313. /**
  23314. * Gets the argument placeholder value for `func`.
  23315. *
  23316. * @private
  23317. * @param {Function} func The function to inspect.
  23318. * @returns {*} Returns the placeholder value.
  23319. */
  23320. function getHolder(func) {
  23321. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23322. return object.placeholder;
  23323. }
  23324. /**
  23325. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23326. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23327. * If arguments are provided, the chosen function is invoked with them and
  23328. * its result is returned.
  23329. *
  23330. * @private
  23331. * @param {*} [value] The value to convert to an iteratee.
  23332. * @param {number} [arity] The arity of the created iteratee.
  23333. * @returns {Function} Returns the chosen function or its result.
  23334. */
  23335. function getIteratee() {
  23336. var result = lodash.iteratee || iteratee;
  23337. result = result === iteratee ? baseIteratee : result;
  23338. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23339. }
  23340. /**
  23341. * Gets the data for `map`.
  23342. *
  23343. * @private
  23344. * @param {Object} map The map to query.
  23345. * @param {string} key The reference key.
  23346. * @returns {*} Returns the map data.
  23347. */
  23348. function getMapData(map, key) {
  23349. var data = map.__data__;
  23350. return isKeyable(key)
  23351. ? data[typeof key == 'string' ? 'string' : 'hash']
  23352. : data.map;
  23353. }
  23354. /**
  23355. * Gets the property names, values, and compare flags of `object`.
  23356. *
  23357. * @private
  23358. * @param {Object} object The object to query.
  23359. * @returns {Array} Returns the match data of `object`.
  23360. */
  23361. function getMatchData(object) {
  23362. var result = keys(object),
  23363. length = result.length;
  23364. while (length--) {
  23365. var key = result[length],
  23366. value = object[key];
  23367. result[length] = [key, value, isStrictComparable(value)];
  23368. }
  23369. return result;
  23370. }
  23371. /**
  23372. * Gets the native function at `key` of `object`.
  23373. *
  23374. * @private
  23375. * @param {Object} object The object to query.
  23376. * @param {string} key The key of the method to get.
  23377. * @returns {*} Returns the function if it's native, else `undefined`.
  23378. */
  23379. function getNative(object, key) {
  23380. var value = getValue(object, key);
  23381. return baseIsNative(value) ? value : undefined;
  23382. }
  23383. /**
  23384. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23385. *
  23386. * @private
  23387. * @param {*} value The value to query.
  23388. * @returns {string} Returns the raw `toStringTag`.
  23389. */
  23390. function getRawTag(value) {
  23391. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23392. tag = value[symToStringTag];
  23393. try {
  23394. value[symToStringTag] = undefined;
  23395. var unmasked = true;
  23396. } catch (e) {}
  23397. var result = nativeObjectToString.call(value);
  23398. if (unmasked) {
  23399. if (isOwn) {
  23400. value[symToStringTag] = tag;
  23401. } else {
  23402. delete value[symToStringTag];
  23403. }
  23404. }
  23405. return result;
  23406. }
  23407. /**
  23408. * Creates an array of the own enumerable symbols of `object`.
  23409. *
  23410. * @private
  23411. * @param {Object} object The object to query.
  23412. * @returns {Array} Returns the array of symbols.
  23413. */
  23414. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23415. if (object == null) {
  23416. return [];
  23417. }
  23418. object = Object(object);
  23419. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23420. return propertyIsEnumerable.call(object, symbol);
  23421. });
  23422. };
  23423. /**
  23424. * Creates an array of the own and inherited enumerable symbols of `object`.
  23425. *
  23426. * @private
  23427. * @param {Object} object The object to query.
  23428. * @returns {Array} Returns the array of symbols.
  23429. */
  23430. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23431. var result = [];
  23432. while (object) {
  23433. arrayPush(result, getSymbols(object));
  23434. object = getPrototype(object);
  23435. }
  23436. return result;
  23437. };
  23438. /**
  23439. * Gets the `toStringTag` of `value`.
  23440. *
  23441. * @private
  23442. * @param {*} value The value to query.
  23443. * @returns {string} Returns the `toStringTag`.
  23444. */
  23445. var getTag = baseGetTag;
  23446. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23447. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23448. (Map && getTag(new Map) != mapTag) ||
  23449. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23450. (Set && getTag(new Set) != setTag) ||
  23451. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23452. getTag = function(value) {
  23453. var result = baseGetTag(value),
  23454. Ctor = result == objectTag ? value.constructor : undefined,
  23455. ctorString = Ctor ? toSource(Ctor) : '';
  23456. if (ctorString) {
  23457. switch (ctorString) {
  23458. case dataViewCtorString: return dataViewTag;
  23459. case mapCtorString: return mapTag;
  23460. case promiseCtorString: return promiseTag;
  23461. case setCtorString: return setTag;
  23462. case weakMapCtorString: return weakMapTag;
  23463. }
  23464. }
  23465. return result;
  23466. };
  23467. }
  23468. /**
  23469. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23470. *
  23471. * @private
  23472. * @param {number} start The start of the view.
  23473. * @param {number} end The end of the view.
  23474. * @param {Array} transforms The transformations to apply to the view.
  23475. * @returns {Object} Returns an object containing the `start` and `end`
  23476. * positions of the view.
  23477. */
  23478. function getView(start, end, transforms) {
  23479. var index = -1,
  23480. length = transforms.length;
  23481. while (++index < length) {
  23482. var data = transforms[index],
  23483. size = data.size;
  23484. switch (data.type) {
  23485. case 'drop': start += size; break;
  23486. case 'dropRight': end -= size; break;
  23487. case 'take': end = nativeMin(end, start + size); break;
  23488. case 'takeRight': start = nativeMax(start, end - size); break;
  23489. }
  23490. }
  23491. return { 'start': start, 'end': end };
  23492. }
  23493. /**
  23494. * Extracts wrapper details from the `source` body comment.
  23495. *
  23496. * @private
  23497. * @param {string} source The source to inspect.
  23498. * @returns {Array} Returns the wrapper details.
  23499. */
  23500. function getWrapDetails(source) {
  23501. var match = source.match(reWrapDetails);
  23502. return match ? match[1].split(reSplitDetails) : [];
  23503. }
  23504. /**
  23505. * Checks if `path` exists on `object`.
  23506. *
  23507. * @private
  23508. * @param {Object} object The object to query.
  23509. * @param {Array|string} path The path to check.
  23510. * @param {Function} hasFunc The function to check properties.
  23511. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23512. */
  23513. function hasPath(object, path, hasFunc) {
  23514. path = castPath(path, object);
  23515. var index = -1,
  23516. length = path.length,
  23517. result = false;
  23518. while (++index < length) {
  23519. var key = toKey(path[index]);
  23520. if (!(result = object != null && hasFunc(object, key))) {
  23521. break;
  23522. }
  23523. object = object[key];
  23524. }
  23525. if (result || ++index != length) {
  23526. return result;
  23527. }
  23528. length = object == null ? 0 : object.length;
  23529. return !!length && isLength(length) && isIndex(key, length) &&
  23530. (isArray(object) || isArguments(object));
  23531. }
  23532. /**
  23533. * Initializes an array clone.
  23534. *
  23535. * @private
  23536. * @param {Array} array The array to clone.
  23537. * @returns {Array} Returns the initialized clone.
  23538. */
  23539. function initCloneArray(array) {
  23540. var length = array.length,
  23541. result = new array.constructor(length);
  23542. // Add properties assigned by `RegExp#exec`.
  23543. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23544. result.index = array.index;
  23545. result.input = array.input;
  23546. }
  23547. return result;
  23548. }
  23549. /**
  23550. * Initializes an object clone.
  23551. *
  23552. * @private
  23553. * @param {Object} object The object to clone.
  23554. * @returns {Object} Returns the initialized clone.
  23555. */
  23556. function initCloneObject(object) {
  23557. return (typeof object.constructor == 'function' && !isPrototype(object))
  23558. ? baseCreate(getPrototype(object))
  23559. : {};
  23560. }
  23561. /**
  23562. * Initializes an object clone based on its `toStringTag`.
  23563. *
  23564. * **Note:** This function only supports cloning values with tags of
  23565. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23566. *
  23567. * @private
  23568. * @param {Object} object The object to clone.
  23569. * @param {string} tag The `toStringTag` of the object to clone.
  23570. * @param {boolean} [isDeep] Specify a deep clone.
  23571. * @returns {Object} Returns the initialized clone.
  23572. */
  23573. function initCloneByTag(object, tag, isDeep) {
  23574. var Ctor = object.constructor;
  23575. switch (tag) {
  23576. case arrayBufferTag:
  23577. return cloneArrayBuffer(object);
  23578. case boolTag:
  23579. case dateTag:
  23580. return new Ctor(+object);
  23581. case dataViewTag:
  23582. return cloneDataView(object, isDeep);
  23583. case float32Tag: case float64Tag:
  23584. case int8Tag: case int16Tag: case int32Tag:
  23585. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23586. return cloneTypedArray(object, isDeep);
  23587. case mapTag:
  23588. return new Ctor;
  23589. case numberTag:
  23590. case stringTag:
  23591. return new Ctor(object);
  23592. case regexpTag:
  23593. return cloneRegExp(object);
  23594. case setTag:
  23595. return new Ctor;
  23596. case symbolTag:
  23597. return cloneSymbol(object);
  23598. }
  23599. }
  23600. /**
  23601. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23602. *
  23603. * @private
  23604. * @param {string} source The source to modify.
  23605. * @returns {Array} details The details to insert.
  23606. * @returns {string} Returns the modified source.
  23607. */
  23608. function insertWrapDetails(source, details) {
  23609. var length = details.length;
  23610. if (!length) {
  23611. return source;
  23612. }
  23613. var lastIndex = length - 1;
  23614. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23615. details = details.join(length > 2 ? ', ' : ' ');
  23616. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23617. }
  23618. /**
  23619. * Checks if `value` is a flattenable `arguments` object or array.
  23620. *
  23621. * @private
  23622. * @param {*} value The value to check.
  23623. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23624. */
  23625. function isFlattenable(value) {
  23626. return isArray(value) || isArguments(value) ||
  23627. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23628. }
  23629. /**
  23630. * Checks if `value` is a valid array-like index.
  23631. *
  23632. * @private
  23633. * @param {*} value The value to check.
  23634. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23635. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23636. */
  23637. function isIndex(value, length) {
  23638. var type = typeof value;
  23639. length = length == null ? MAX_SAFE_INTEGER : length;
  23640. return !!length &&
  23641. (type == 'number' ||
  23642. (type != 'symbol' && reIsUint.test(value))) &&
  23643. (value > -1 && value % 1 == 0 && value < length);
  23644. }
  23645. /**
  23646. * Checks if the given arguments are from an iteratee call.
  23647. *
  23648. * @private
  23649. * @param {*} value The potential iteratee value argument.
  23650. * @param {*} index The potential iteratee index or key argument.
  23651. * @param {*} object The potential iteratee object argument.
  23652. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23653. * else `false`.
  23654. */
  23655. function isIterateeCall(value, index, object) {
  23656. if (!isObject(object)) {
  23657. return false;
  23658. }
  23659. var type = typeof index;
  23660. if (type == 'number'
  23661. ? (isArrayLike(object) && isIndex(index, object.length))
  23662. : (type == 'string' && index in object)
  23663. ) {
  23664. return eq(object[index], value);
  23665. }
  23666. return false;
  23667. }
  23668. /**
  23669. * Checks if `value` is a property name and not a property path.
  23670. *
  23671. * @private
  23672. * @param {*} value The value to check.
  23673. * @param {Object} [object] The object to query keys on.
  23674. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23675. */
  23676. function isKey(value, object) {
  23677. if (isArray(value)) {
  23678. return false;
  23679. }
  23680. var type = typeof value;
  23681. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23682. value == null || isSymbol(value)) {
  23683. return true;
  23684. }
  23685. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23686. (object != null && value in Object(object));
  23687. }
  23688. /**
  23689. * Checks if `value` is suitable for use as unique object key.
  23690. *
  23691. * @private
  23692. * @param {*} value The value to check.
  23693. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23694. */
  23695. function isKeyable(value) {
  23696. var type = typeof value;
  23697. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23698. ? (value !== '__proto__')
  23699. : (value === null);
  23700. }
  23701. /**
  23702. * Checks if `func` has a lazy counterpart.
  23703. *
  23704. * @private
  23705. * @param {Function} func The function to check.
  23706. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23707. * else `false`.
  23708. */
  23709. function isLaziable(func) {
  23710. var funcName = getFuncName(func),
  23711. other = lodash[funcName];
  23712. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23713. return false;
  23714. }
  23715. if (func === other) {
  23716. return true;
  23717. }
  23718. var data = getData(other);
  23719. return !!data && func === data[0];
  23720. }
  23721. /**
  23722. * Checks if `func` has its source masked.
  23723. *
  23724. * @private
  23725. * @param {Function} func The function to check.
  23726. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23727. */
  23728. function isMasked(func) {
  23729. return !!maskSrcKey && (maskSrcKey in func);
  23730. }
  23731. /**
  23732. * Checks if `func` is capable of being masked.
  23733. *
  23734. * @private
  23735. * @param {*} value The value to check.
  23736. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23737. */
  23738. var isMaskable = coreJsData ? isFunction : stubFalse;
  23739. /**
  23740. * Checks if `value` is likely a prototype object.
  23741. *
  23742. * @private
  23743. * @param {*} value The value to check.
  23744. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23745. */
  23746. function isPrototype(value) {
  23747. var Ctor = value && value.constructor,
  23748. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23749. return value === proto;
  23750. }
  23751. /**
  23752. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23753. *
  23754. * @private
  23755. * @param {*} value The value to check.
  23756. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23757. * equality comparisons, else `false`.
  23758. */
  23759. function isStrictComparable(value) {
  23760. return value === value && !isObject(value);
  23761. }
  23762. /**
  23763. * A specialized version of `matchesProperty` for source values suitable
  23764. * for strict equality comparisons, i.e. `===`.
  23765. *
  23766. * @private
  23767. * @param {string} key The key of the property to get.
  23768. * @param {*} srcValue The value to match.
  23769. * @returns {Function} Returns the new spec function.
  23770. */
  23771. function matchesStrictComparable(key, srcValue) {
  23772. return function(object) {
  23773. if (object == null) {
  23774. return false;
  23775. }
  23776. return object[key] === srcValue &&
  23777. (srcValue !== undefined || (key in Object(object)));
  23778. };
  23779. }
  23780. /**
  23781. * A specialized version of `_.memoize` which clears the memoized function's
  23782. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23783. *
  23784. * @private
  23785. * @param {Function} func The function to have its output memoized.
  23786. * @returns {Function} Returns the new memoized function.
  23787. */
  23788. function memoizeCapped(func) {
  23789. var result = memoize(func, function(key) {
  23790. if (cache.size === MAX_MEMOIZE_SIZE) {
  23791. cache.clear();
  23792. }
  23793. return key;
  23794. });
  23795. var cache = result.cache;
  23796. return result;
  23797. }
  23798. /**
  23799. * Merges the function metadata of `source` into `data`.
  23800. *
  23801. * Merging metadata reduces the number of wrappers used to invoke a function.
  23802. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23803. * may be applied regardless of execution order. Methods like `_.ary` and
  23804. * `_.rearg` modify function arguments, making the order in which they are
  23805. * executed important, preventing the merging of metadata. However, we make
  23806. * an exception for a safe combined case where curried functions have `_.ary`
  23807. * and or `_.rearg` applied.
  23808. *
  23809. * @private
  23810. * @param {Array} data The destination metadata.
  23811. * @param {Array} source The source metadata.
  23812. * @returns {Array} Returns `data`.
  23813. */
  23814. function mergeData(data, source) {
  23815. var bitmask = data[1],
  23816. srcBitmask = source[1],
  23817. newBitmask = bitmask | srcBitmask,
  23818. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23819. var isCombo =
  23820. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23821. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23822. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23823. // Exit early if metadata can't be merged.
  23824. if (!(isCommon || isCombo)) {
  23825. return data;
  23826. }
  23827. // Use source `thisArg` if available.
  23828. if (srcBitmask & WRAP_BIND_FLAG) {
  23829. data[2] = source[2];
  23830. // Set when currying a bound function.
  23831. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23832. }
  23833. // Compose partial arguments.
  23834. var value = source[3];
  23835. if (value) {
  23836. var partials = data[3];
  23837. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23838. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23839. }
  23840. // Compose partial right arguments.
  23841. value = source[5];
  23842. if (value) {
  23843. partials = data[5];
  23844. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23845. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23846. }
  23847. // Use source `argPos` if available.
  23848. value = source[7];
  23849. if (value) {
  23850. data[7] = value;
  23851. }
  23852. // Use source `ary` if it's smaller.
  23853. if (srcBitmask & WRAP_ARY_FLAG) {
  23854. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23855. }
  23856. // Use source `arity` if one is not provided.
  23857. if (data[9] == null) {
  23858. data[9] = source[9];
  23859. }
  23860. // Use source `func` and merge bitmasks.
  23861. data[0] = source[0];
  23862. data[1] = newBitmask;
  23863. return data;
  23864. }
  23865. /**
  23866. * This function is like
  23867. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23868. * except that it includes inherited enumerable properties.
  23869. *
  23870. * @private
  23871. * @param {Object} object The object to query.
  23872. * @returns {Array} Returns the array of property names.
  23873. */
  23874. function nativeKeysIn(object) {
  23875. var result = [];
  23876. if (object != null) {
  23877. for (var key in Object(object)) {
  23878. result.push(key);
  23879. }
  23880. }
  23881. return result;
  23882. }
  23883. /**
  23884. * Converts `value` to a string using `Object.prototype.toString`.
  23885. *
  23886. * @private
  23887. * @param {*} value The value to convert.
  23888. * @returns {string} Returns the converted string.
  23889. */
  23890. function objectToString(value) {
  23891. return nativeObjectToString.call(value);
  23892. }
  23893. /**
  23894. * A specialized version of `baseRest` which transforms the rest array.
  23895. *
  23896. * @private
  23897. * @param {Function} func The function to apply a rest parameter to.
  23898. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23899. * @param {Function} transform The rest array transform.
  23900. * @returns {Function} Returns the new function.
  23901. */
  23902. function overRest(func, start, transform) {
  23903. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23904. return function() {
  23905. var args = arguments,
  23906. index = -1,
  23907. length = nativeMax(args.length - start, 0),
  23908. array = Array(length);
  23909. while (++index < length) {
  23910. array[index] = args[start + index];
  23911. }
  23912. index = -1;
  23913. var otherArgs = Array(start + 1);
  23914. while (++index < start) {
  23915. otherArgs[index] = args[index];
  23916. }
  23917. otherArgs[start] = transform(array);
  23918. return apply(func, this, otherArgs);
  23919. };
  23920. }
  23921. /**
  23922. * Gets the parent value at `path` of `object`.
  23923. *
  23924. * @private
  23925. * @param {Object} object The object to query.
  23926. * @param {Array} path The path to get the parent value of.
  23927. * @returns {*} Returns the parent value.
  23928. */
  23929. function parent(object, path) {
  23930. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  23931. }
  23932. /**
  23933. * Reorder `array` according to the specified indexes where the element at
  23934. * the first index is assigned as the first element, the element at
  23935. * the second index is assigned as the second element, and so on.
  23936. *
  23937. * @private
  23938. * @param {Array} array The array to reorder.
  23939. * @param {Array} indexes The arranged array indexes.
  23940. * @returns {Array} Returns `array`.
  23941. */
  23942. function reorder(array, indexes) {
  23943. var arrLength = array.length,
  23944. length = nativeMin(indexes.length, arrLength),
  23945. oldArray = copyArray(array);
  23946. while (length--) {
  23947. var index = indexes[length];
  23948. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  23949. }
  23950. return array;
  23951. }
  23952. /**
  23953. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  23954. *
  23955. * @private
  23956. * @param {Object} object The object to query.
  23957. * @param {string} key The key of the property to get.
  23958. * @returns {*} Returns the property value.
  23959. */
  23960. function safeGet(object, key) {
  23961. if (key === 'constructor' && typeof object[key] === 'function') {
  23962. return;
  23963. }
  23964. if (key == '__proto__') {
  23965. return;
  23966. }
  23967. return object[key];
  23968. }
  23969. /**
  23970. * Sets metadata for `func`.
  23971. *
  23972. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  23973. * period of time, it will trip its breaker and transition to an identity
  23974. * function to avoid garbage collection pauses in V8. See
  23975. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  23976. * for more details.
  23977. *
  23978. * @private
  23979. * @param {Function} func The function to associate metadata with.
  23980. * @param {*} data The metadata.
  23981. * @returns {Function} Returns `func`.
  23982. */
  23983. var setData = shortOut(baseSetData);
  23984. /**
  23985. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  23986. *
  23987. * @private
  23988. * @param {Function} func The function to delay.
  23989. * @param {number} wait The number of milliseconds to delay invocation.
  23990. * @returns {number|Object} Returns the timer id or timeout object.
  23991. */
  23992. var setTimeout = ctxSetTimeout || function(func, wait) {
  23993. return root.setTimeout(func, wait);
  23994. };
  23995. /**
  23996. * Sets the `toString` method of `func` to return `string`.
  23997. *
  23998. * @private
  23999. * @param {Function} func The function to modify.
  24000. * @param {Function} string The `toString` result.
  24001. * @returns {Function} Returns `func`.
  24002. */
  24003. var setToString = shortOut(baseSetToString);
  24004. /**
  24005. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24006. * with wrapper details in a comment at the top of the source body.
  24007. *
  24008. * @private
  24009. * @param {Function} wrapper The function to modify.
  24010. * @param {Function} reference The reference function.
  24011. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24012. * @returns {Function} Returns `wrapper`.
  24013. */
  24014. function setWrapToString(wrapper, reference, bitmask) {
  24015. var source = (reference + '');
  24016. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24017. }
  24018. /**
  24019. * Creates a function that'll short out and invoke `identity` instead
  24020. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24021. * milliseconds.
  24022. *
  24023. * @private
  24024. * @param {Function} func The function to restrict.
  24025. * @returns {Function} Returns the new shortable function.
  24026. */
  24027. function shortOut(func) {
  24028. var count = 0,
  24029. lastCalled = 0;
  24030. return function() {
  24031. var stamp = nativeNow(),
  24032. remaining = HOT_SPAN - (stamp - lastCalled);
  24033. lastCalled = stamp;
  24034. if (remaining > 0) {
  24035. if (++count >= HOT_COUNT) {
  24036. return arguments[0];
  24037. }
  24038. } else {
  24039. count = 0;
  24040. }
  24041. return func.apply(undefined, arguments);
  24042. };
  24043. }
  24044. /**
  24045. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24046. *
  24047. * @private
  24048. * @param {Array} array The array to shuffle.
  24049. * @param {number} [size=array.length] The size of `array`.
  24050. * @returns {Array} Returns `array`.
  24051. */
  24052. function shuffleSelf(array, size) {
  24053. var index = -1,
  24054. length = array.length,
  24055. lastIndex = length - 1;
  24056. size = size === undefined ? length : size;
  24057. while (++index < size) {
  24058. var rand = baseRandom(index, lastIndex),
  24059. value = array[rand];
  24060. array[rand] = array[index];
  24061. array[index] = value;
  24062. }
  24063. array.length = size;
  24064. return array;
  24065. }
  24066. /**
  24067. * Converts `string` to a property path array.
  24068. *
  24069. * @private
  24070. * @param {string} string The string to convert.
  24071. * @returns {Array} Returns the property path array.
  24072. */
  24073. var stringToPath = memoizeCapped(function(string) {
  24074. var result = [];
  24075. if (string.charCodeAt(0) === 46 /* . */) {
  24076. result.push('');
  24077. }
  24078. string.replace(rePropName, function(match, number, quote, subString) {
  24079. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24080. });
  24081. return result;
  24082. });
  24083. /**
  24084. * Converts `value` to a string key if it's not a string or symbol.
  24085. *
  24086. * @private
  24087. * @param {*} value The value to inspect.
  24088. * @returns {string|symbol} Returns the key.
  24089. */
  24090. function toKey(value) {
  24091. if (typeof value == 'string' || isSymbol(value)) {
  24092. return value;
  24093. }
  24094. var result = (value + '');
  24095. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24096. }
  24097. /**
  24098. * Converts `func` to its source code.
  24099. *
  24100. * @private
  24101. * @param {Function} func The function to convert.
  24102. * @returns {string} Returns the source code.
  24103. */
  24104. function toSource(func) {
  24105. if (func != null) {
  24106. try {
  24107. return funcToString.call(func);
  24108. } catch (e) {}
  24109. try {
  24110. return (func + '');
  24111. } catch (e) {}
  24112. }
  24113. return '';
  24114. }
  24115. /**
  24116. * Updates wrapper `details` based on `bitmask` flags.
  24117. *
  24118. * @private
  24119. * @returns {Array} details The details to modify.
  24120. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24121. * @returns {Array} Returns `details`.
  24122. */
  24123. function updateWrapDetails(details, bitmask) {
  24124. arrayEach(wrapFlags, function(pair) {
  24125. var value = '_.' + pair[0];
  24126. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24127. details.push(value);
  24128. }
  24129. });
  24130. return details.sort();
  24131. }
  24132. /**
  24133. * Creates a clone of `wrapper`.
  24134. *
  24135. * @private
  24136. * @param {Object} wrapper The wrapper to clone.
  24137. * @returns {Object} Returns the cloned wrapper.
  24138. */
  24139. function wrapperClone(wrapper) {
  24140. if (wrapper instanceof LazyWrapper) {
  24141. return wrapper.clone();
  24142. }
  24143. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24144. result.__actions__ = copyArray(wrapper.__actions__);
  24145. result.__index__ = wrapper.__index__;
  24146. result.__values__ = wrapper.__values__;
  24147. return result;
  24148. }
  24149. /*------------------------------------------------------------------------*/
  24150. /**
  24151. * Creates an array of elements split into groups the length of `size`.
  24152. * If `array` can't be split evenly, the final chunk will be the remaining
  24153. * elements.
  24154. *
  24155. * @static
  24156. * @memberOf _
  24157. * @since 3.0.0
  24158. * @category Array
  24159. * @param {Array} array The array to process.
  24160. * @param {number} [size=1] The length of each chunk
  24161. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24162. * @returns {Array} Returns the new array of chunks.
  24163. * @example
  24164. *
  24165. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24166. * // => [['a', 'b'], ['c', 'd']]
  24167. *
  24168. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24169. * // => [['a', 'b', 'c'], ['d']]
  24170. */
  24171. function chunk(array, size, guard) {
  24172. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24173. size = 1;
  24174. } else {
  24175. size = nativeMax(toInteger(size), 0);
  24176. }
  24177. var length = array == null ? 0 : array.length;
  24178. if (!length || size < 1) {
  24179. return [];
  24180. }
  24181. var index = 0,
  24182. resIndex = 0,
  24183. result = Array(nativeCeil(length / size));
  24184. while (index < length) {
  24185. result[resIndex++] = baseSlice(array, index, (index += size));
  24186. }
  24187. return result;
  24188. }
  24189. /**
  24190. * Creates an array with all falsey values removed. The values `false`, `null`,
  24191. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24192. *
  24193. * @static
  24194. * @memberOf _
  24195. * @since 0.1.0
  24196. * @category Array
  24197. * @param {Array} array The array to compact.
  24198. * @returns {Array} Returns the new array of filtered values.
  24199. * @example
  24200. *
  24201. * _.compact([0, 1, false, 2, '', 3]);
  24202. * // => [1, 2, 3]
  24203. */
  24204. function compact(array) {
  24205. var index = -1,
  24206. length = array == null ? 0 : array.length,
  24207. resIndex = 0,
  24208. result = [];
  24209. while (++index < length) {
  24210. var value = array[index];
  24211. if (value) {
  24212. result[resIndex++] = value;
  24213. }
  24214. }
  24215. return result;
  24216. }
  24217. /**
  24218. * Creates a new array concatenating `array` with any additional arrays
  24219. * and/or values.
  24220. *
  24221. * @static
  24222. * @memberOf _
  24223. * @since 4.0.0
  24224. * @category Array
  24225. * @param {Array} array The array to concatenate.
  24226. * @param {...*} [values] The values to concatenate.
  24227. * @returns {Array} Returns the new concatenated array.
  24228. * @example
  24229. *
  24230. * var array = [1];
  24231. * var other = _.concat(array, 2, [3], [[4]]);
  24232. *
  24233. * console.log(other);
  24234. * // => [1, 2, 3, [4]]
  24235. *
  24236. * console.log(array);
  24237. * // => [1]
  24238. */
  24239. function concat() {
  24240. var length = arguments.length;
  24241. if (!length) {
  24242. return [];
  24243. }
  24244. var args = Array(length - 1),
  24245. array = arguments[0],
  24246. index = length;
  24247. while (index--) {
  24248. args[index - 1] = arguments[index];
  24249. }
  24250. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24251. }
  24252. /**
  24253. * Creates an array of `array` values not included in the other given arrays
  24254. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24255. * for equality comparisons. The order and references of result values are
  24256. * determined by the first array.
  24257. *
  24258. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24259. *
  24260. * @static
  24261. * @memberOf _
  24262. * @since 0.1.0
  24263. * @category Array
  24264. * @param {Array} array The array to inspect.
  24265. * @param {...Array} [values] The values to exclude.
  24266. * @returns {Array} Returns the new array of filtered values.
  24267. * @see _.without, _.xor
  24268. * @example
  24269. *
  24270. * _.difference([2, 1], [2, 3]);
  24271. * // => [1]
  24272. */
  24273. var difference = baseRest(function(array, values) {
  24274. return isArrayLikeObject(array)
  24275. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24276. : [];
  24277. });
  24278. /**
  24279. * This method is like `_.difference` except that it accepts `iteratee` which
  24280. * is invoked for each element of `array` and `values` to generate the criterion
  24281. * by which they're compared. The order and references of result values are
  24282. * determined by the first array. The iteratee is invoked with one argument:
  24283. * (value).
  24284. *
  24285. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24286. *
  24287. * @static
  24288. * @memberOf _
  24289. * @since 4.0.0
  24290. * @category Array
  24291. * @param {Array} array The array to inspect.
  24292. * @param {...Array} [values] The values to exclude.
  24293. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24294. * @returns {Array} Returns the new array of filtered values.
  24295. * @example
  24296. *
  24297. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24298. * // => [1.2]
  24299. *
  24300. * // The `_.property` iteratee shorthand.
  24301. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24302. * // => [{ 'x': 2 }]
  24303. */
  24304. var differenceBy = baseRest(function(array, values) {
  24305. var iteratee = last(values);
  24306. if (isArrayLikeObject(iteratee)) {
  24307. iteratee = undefined;
  24308. }
  24309. return isArrayLikeObject(array)
  24310. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24311. : [];
  24312. });
  24313. /**
  24314. * This method is like `_.difference` except that it accepts `comparator`
  24315. * which is invoked to compare elements of `array` to `values`. The order and
  24316. * references of result values are determined by the first array. The comparator
  24317. * is invoked with two arguments: (arrVal, othVal).
  24318. *
  24319. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24320. *
  24321. * @static
  24322. * @memberOf _
  24323. * @since 4.0.0
  24324. * @category Array
  24325. * @param {Array} array The array to inspect.
  24326. * @param {...Array} [values] The values to exclude.
  24327. * @param {Function} [comparator] The comparator invoked per element.
  24328. * @returns {Array} Returns the new array of filtered values.
  24329. * @example
  24330. *
  24331. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24332. *
  24333. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24334. * // => [{ 'x': 2, 'y': 1 }]
  24335. */
  24336. var differenceWith = baseRest(function(array, values) {
  24337. var comparator = last(values);
  24338. if (isArrayLikeObject(comparator)) {
  24339. comparator = undefined;
  24340. }
  24341. return isArrayLikeObject(array)
  24342. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24343. : [];
  24344. });
  24345. /**
  24346. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24347. *
  24348. * @static
  24349. * @memberOf _
  24350. * @since 0.5.0
  24351. * @category Array
  24352. * @param {Array} array The array to query.
  24353. * @param {number} [n=1] The number of elements to drop.
  24354. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24355. * @returns {Array} Returns the slice of `array`.
  24356. * @example
  24357. *
  24358. * _.drop([1, 2, 3]);
  24359. * // => [2, 3]
  24360. *
  24361. * _.drop([1, 2, 3], 2);
  24362. * // => [3]
  24363. *
  24364. * _.drop([1, 2, 3], 5);
  24365. * // => []
  24366. *
  24367. * _.drop([1, 2, 3], 0);
  24368. * // => [1, 2, 3]
  24369. */
  24370. function drop(array, n, guard) {
  24371. var length = array == null ? 0 : array.length;
  24372. if (!length) {
  24373. return [];
  24374. }
  24375. n = (guard || n === undefined) ? 1 : toInteger(n);
  24376. return baseSlice(array, n < 0 ? 0 : n, length);
  24377. }
  24378. /**
  24379. * Creates a slice of `array` with `n` elements dropped from the end.
  24380. *
  24381. * @static
  24382. * @memberOf _
  24383. * @since 3.0.0
  24384. * @category Array
  24385. * @param {Array} array The array to query.
  24386. * @param {number} [n=1] The number of elements to drop.
  24387. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24388. * @returns {Array} Returns the slice of `array`.
  24389. * @example
  24390. *
  24391. * _.dropRight([1, 2, 3]);
  24392. * // => [1, 2]
  24393. *
  24394. * _.dropRight([1, 2, 3], 2);
  24395. * // => [1]
  24396. *
  24397. * _.dropRight([1, 2, 3], 5);
  24398. * // => []
  24399. *
  24400. * _.dropRight([1, 2, 3], 0);
  24401. * // => [1, 2, 3]
  24402. */
  24403. function dropRight(array, n, guard) {
  24404. var length = array == null ? 0 : array.length;
  24405. if (!length) {
  24406. return [];
  24407. }
  24408. n = (guard || n === undefined) ? 1 : toInteger(n);
  24409. n = length - n;
  24410. return baseSlice(array, 0, n < 0 ? 0 : n);
  24411. }
  24412. /**
  24413. * Creates a slice of `array` excluding elements dropped from the end.
  24414. * Elements are dropped until `predicate` returns falsey. The predicate is
  24415. * invoked with three arguments: (value, index, array).
  24416. *
  24417. * @static
  24418. * @memberOf _
  24419. * @since 3.0.0
  24420. * @category Array
  24421. * @param {Array} array The array to query.
  24422. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24423. * @returns {Array} Returns the slice of `array`.
  24424. * @example
  24425. *
  24426. * var users = [
  24427. * { 'user': 'barney', 'active': true },
  24428. * { 'user': 'fred', 'active': false },
  24429. * { 'user': 'pebbles', 'active': false }
  24430. * ];
  24431. *
  24432. * _.dropRightWhile(users, function(o) { return !o.active; });
  24433. * // => objects for ['barney']
  24434. *
  24435. * // The `_.matches` iteratee shorthand.
  24436. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24437. * // => objects for ['barney', 'fred']
  24438. *
  24439. * // The `_.matchesProperty` iteratee shorthand.
  24440. * _.dropRightWhile(users, ['active', false]);
  24441. * // => objects for ['barney']
  24442. *
  24443. * // The `_.property` iteratee shorthand.
  24444. * _.dropRightWhile(users, 'active');
  24445. * // => objects for ['barney', 'fred', 'pebbles']
  24446. */
  24447. function dropRightWhile(array, predicate) {
  24448. return (array && array.length)
  24449. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24450. : [];
  24451. }
  24452. /**
  24453. * Creates a slice of `array` excluding elements dropped from the beginning.
  24454. * Elements are dropped until `predicate` returns falsey. The predicate is
  24455. * invoked with three arguments: (value, index, array).
  24456. *
  24457. * @static
  24458. * @memberOf _
  24459. * @since 3.0.0
  24460. * @category Array
  24461. * @param {Array} array The array to query.
  24462. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24463. * @returns {Array} Returns the slice of `array`.
  24464. * @example
  24465. *
  24466. * var users = [
  24467. * { 'user': 'barney', 'active': false },
  24468. * { 'user': 'fred', 'active': false },
  24469. * { 'user': 'pebbles', 'active': true }
  24470. * ];
  24471. *
  24472. * _.dropWhile(users, function(o) { return !o.active; });
  24473. * // => objects for ['pebbles']
  24474. *
  24475. * // The `_.matches` iteratee shorthand.
  24476. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24477. * // => objects for ['fred', 'pebbles']
  24478. *
  24479. * // The `_.matchesProperty` iteratee shorthand.
  24480. * _.dropWhile(users, ['active', false]);
  24481. * // => objects for ['pebbles']
  24482. *
  24483. * // The `_.property` iteratee shorthand.
  24484. * _.dropWhile(users, 'active');
  24485. * // => objects for ['barney', 'fred', 'pebbles']
  24486. */
  24487. function dropWhile(array, predicate) {
  24488. return (array && array.length)
  24489. ? baseWhile(array, getIteratee(predicate, 3), true)
  24490. : [];
  24491. }
  24492. /**
  24493. * Fills elements of `array` with `value` from `start` up to, but not
  24494. * including, `end`.
  24495. *
  24496. * **Note:** This method mutates `array`.
  24497. *
  24498. * @static
  24499. * @memberOf _
  24500. * @since 3.2.0
  24501. * @category Array
  24502. * @param {Array} array The array to fill.
  24503. * @param {*} value The value to fill `array` with.
  24504. * @param {number} [start=0] The start position.
  24505. * @param {number} [end=array.length] The end position.
  24506. * @returns {Array} Returns `array`.
  24507. * @example
  24508. *
  24509. * var array = [1, 2, 3];
  24510. *
  24511. * _.fill(array, 'a');
  24512. * console.log(array);
  24513. * // => ['a', 'a', 'a']
  24514. *
  24515. * _.fill(Array(3), 2);
  24516. * // => [2, 2, 2]
  24517. *
  24518. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24519. * // => [4, '*', '*', 10]
  24520. */
  24521. function fill(array, value, start, end) {
  24522. var length = array == null ? 0 : array.length;
  24523. if (!length) {
  24524. return [];
  24525. }
  24526. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24527. start = 0;
  24528. end = length;
  24529. }
  24530. return baseFill(array, value, start, end);
  24531. }
  24532. /**
  24533. * This method is like `_.find` except that it returns the index of the first
  24534. * element `predicate` returns truthy for instead of the element itself.
  24535. *
  24536. * @static
  24537. * @memberOf _
  24538. * @since 1.1.0
  24539. * @category Array
  24540. * @param {Array} array The array to inspect.
  24541. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24542. * @param {number} [fromIndex=0] The index to search from.
  24543. * @returns {number} Returns the index of the found element, else `-1`.
  24544. * @example
  24545. *
  24546. * var users = [
  24547. * { 'user': 'barney', 'active': false },
  24548. * { 'user': 'fred', 'active': false },
  24549. * { 'user': 'pebbles', 'active': true }
  24550. * ];
  24551. *
  24552. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24553. * // => 0
  24554. *
  24555. * // The `_.matches` iteratee shorthand.
  24556. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24557. * // => 1
  24558. *
  24559. * // The `_.matchesProperty` iteratee shorthand.
  24560. * _.findIndex(users, ['active', false]);
  24561. * // => 0
  24562. *
  24563. * // The `_.property` iteratee shorthand.
  24564. * _.findIndex(users, 'active');
  24565. * // => 2
  24566. */
  24567. function findIndex(array, predicate, fromIndex) {
  24568. var length = array == null ? 0 : array.length;
  24569. if (!length) {
  24570. return -1;
  24571. }
  24572. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24573. if (index < 0) {
  24574. index = nativeMax(length + index, 0);
  24575. }
  24576. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24577. }
  24578. /**
  24579. * This method is like `_.findIndex` except that it iterates over elements
  24580. * of `collection` from right to left.
  24581. *
  24582. * @static
  24583. * @memberOf _
  24584. * @since 2.0.0
  24585. * @category Array
  24586. * @param {Array} array The array to inspect.
  24587. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24588. * @param {number} [fromIndex=array.length-1] The index to search from.
  24589. * @returns {number} Returns the index of the found element, else `-1`.
  24590. * @example
  24591. *
  24592. * var users = [
  24593. * { 'user': 'barney', 'active': true },
  24594. * { 'user': 'fred', 'active': false },
  24595. * { 'user': 'pebbles', 'active': false }
  24596. * ];
  24597. *
  24598. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24599. * // => 2
  24600. *
  24601. * // The `_.matches` iteratee shorthand.
  24602. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24603. * // => 0
  24604. *
  24605. * // The `_.matchesProperty` iteratee shorthand.
  24606. * _.findLastIndex(users, ['active', false]);
  24607. * // => 2
  24608. *
  24609. * // The `_.property` iteratee shorthand.
  24610. * _.findLastIndex(users, 'active');
  24611. * // => 0
  24612. */
  24613. function findLastIndex(array, predicate, fromIndex) {
  24614. var length = array == null ? 0 : array.length;
  24615. if (!length) {
  24616. return -1;
  24617. }
  24618. var index = length - 1;
  24619. if (fromIndex !== undefined) {
  24620. index = toInteger(fromIndex);
  24621. index = fromIndex < 0
  24622. ? nativeMax(length + index, 0)
  24623. : nativeMin(index, length - 1);
  24624. }
  24625. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24626. }
  24627. /**
  24628. * Flattens `array` a single level deep.
  24629. *
  24630. * @static
  24631. * @memberOf _
  24632. * @since 0.1.0
  24633. * @category Array
  24634. * @param {Array} array The array to flatten.
  24635. * @returns {Array} Returns the new flattened array.
  24636. * @example
  24637. *
  24638. * _.flatten([1, [2, [3, [4]], 5]]);
  24639. * // => [1, 2, [3, [4]], 5]
  24640. */
  24641. function flatten(array) {
  24642. var length = array == null ? 0 : array.length;
  24643. return length ? baseFlatten(array, 1) : [];
  24644. }
  24645. /**
  24646. * Recursively flattens `array`.
  24647. *
  24648. * @static
  24649. * @memberOf _
  24650. * @since 3.0.0
  24651. * @category Array
  24652. * @param {Array} array The array to flatten.
  24653. * @returns {Array} Returns the new flattened array.
  24654. * @example
  24655. *
  24656. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24657. * // => [1, 2, 3, 4, 5]
  24658. */
  24659. function flattenDeep(array) {
  24660. var length = array == null ? 0 : array.length;
  24661. return length ? baseFlatten(array, INFINITY) : [];
  24662. }
  24663. /**
  24664. * Recursively flatten `array` up to `depth` times.
  24665. *
  24666. * @static
  24667. * @memberOf _
  24668. * @since 4.4.0
  24669. * @category Array
  24670. * @param {Array} array The array to flatten.
  24671. * @param {number} [depth=1] The maximum recursion depth.
  24672. * @returns {Array} Returns the new flattened array.
  24673. * @example
  24674. *
  24675. * var array = [1, [2, [3, [4]], 5]];
  24676. *
  24677. * _.flattenDepth(array, 1);
  24678. * // => [1, 2, [3, [4]], 5]
  24679. *
  24680. * _.flattenDepth(array, 2);
  24681. * // => [1, 2, 3, [4], 5]
  24682. */
  24683. function flattenDepth(array, depth) {
  24684. var length = array == null ? 0 : array.length;
  24685. if (!length) {
  24686. return [];
  24687. }
  24688. depth = depth === undefined ? 1 : toInteger(depth);
  24689. return baseFlatten(array, depth);
  24690. }
  24691. /**
  24692. * The inverse of `_.toPairs`; this method returns an object composed
  24693. * from key-value `pairs`.
  24694. *
  24695. * @static
  24696. * @memberOf _
  24697. * @since 4.0.0
  24698. * @category Array
  24699. * @param {Array} pairs The key-value pairs.
  24700. * @returns {Object} Returns the new object.
  24701. * @example
  24702. *
  24703. * _.fromPairs([['a', 1], ['b', 2]]);
  24704. * // => { 'a': 1, 'b': 2 }
  24705. */
  24706. function fromPairs(pairs) {
  24707. var index = -1,
  24708. length = pairs == null ? 0 : pairs.length,
  24709. result = {};
  24710. while (++index < length) {
  24711. var pair = pairs[index];
  24712. result[pair[0]] = pair[1];
  24713. }
  24714. return result;
  24715. }
  24716. /**
  24717. * Gets the first element of `array`.
  24718. *
  24719. * @static
  24720. * @memberOf _
  24721. * @since 0.1.0
  24722. * @alias first
  24723. * @category Array
  24724. * @param {Array} array The array to query.
  24725. * @returns {*} Returns the first element of `array`.
  24726. * @example
  24727. *
  24728. * _.head([1, 2, 3]);
  24729. * // => 1
  24730. *
  24731. * _.head([]);
  24732. * // => undefined
  24733. */
  24734. function head(array) {
  24735. return (array && array.length) ? array[0] : undefined;
  24736. }
  24737. /**
  24738. * Gets the index at which the first occurrence of `value` is found in `array`
  24739. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24740. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24741. * offset from the end of `array`.
  24742. *
  24743. * @static
  24744. * @memberOf _
  24745. * @since 0.1.0
  24746. * @category Array
  24747. * @param {Array} array The array to inspect.
  24748. * @param {*} value The value to search for.
  24749. * @param {number} [fromIndex=0] The index to search from.
  24750. * @returns {number} Returns the index of the matched value, else `-1`.
  24751. * @example
  24752. *
  24753. * _.indexOf([1, 2, 1, 2], 2);
  24754. * // => 1
  24755. *
  24756. * // Search from the `fromIndex`.
  24757. * _.indexOf([1, 2, 1, 2], 2, 2);
  24758. * // => 3
  24759. */
  24760. function indexOf(array, value, fromIndex) {
  24761. var length = array == null ? 0 : array.length;
  24762. if (!length) {
  24763. return -1;
  24764. }
  24765. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24766. if (index < 0) {
  24767. index = nativeMax(length + index, 0);
  24768. }
  24769. return baseIndexOf(array, value, index);
  24770. }
  24771. /**
  24772. * Gets all but the last element of `array`.
  24773. *
  24774. * @static
  24775. * @memberOf _
  24776. * @since 0.1.0
  24777. * @category Array
  24778. * @param {Array} array The array to query.
  24779. * @returns {Array} Returns the slice of `array`.
  24780. * @example
  24781. *
  24782. * _.initial([1, 2, 3]);
  24783. * // => [1, 2]
  24784. */
  24785. function initial(array) {
  24786. var length = array == null ? 0 : array.length;
  24787. return length ? baseSlice(array, 0, -1) : [];
  24788. }
  24789. /**
  24790. * Creates an array of unique values that are included in all given arrays
  24791. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24792. * for equality comparisons. The order and references of result values are
  24793. * determined by the first array.
  24794. *
  24795. * @static
  24796. * @memberOf _
  24797. * @since 0.1.0
  24798. * @category Array
  24799. * @param {...Array} [arrays] The arrays to inspect.
  24800. * @returns {Array} Returns the new array of intersecting values.
  24801. * @example
  24802. *
  24803. * _.intersection([2, 1], [2, 3]);
  24804. * // => [2]
  24805. */
  24806. var intersection = baseRest(function(arrays) {
  24807. var mapped = arrayMap(arrays, castArrayLikeObject);
  24808. return (mapped.length && mapped[0] === arrays[0])
  24809. ? baseIntersection(mapped)
  24810. : [];
  24811. });
  24812. /**
  24813. * This method is like `_.intersection` except that it accepts `iteratee`
  24814. * which is invoked for each element of each `arrays` to generate the criterion
  24815. * by which they're compared. The order and references of result values are
  24816. * determined by the first array. The iteratee is invoked with one argument:
  24817. * (value).
  24818. *
  24819. * @static
  24820. * @memberOf _
  24821. * @since 4.0.0
  24822. * @category Array
  24823. * @param {...Array} [arrays] The arrays to inspect.
  24824. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24825. * @returns {Array} Returns the new array of intersecting values.
  24826. * @example
  24827. *
  24828. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24829. * // => [2.1]
  24830. *
  24831. * // The `_.property` iteratee shorthand.
  24832. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24833. * // => [{ 'x': 1 }]
  24834. */
  24835. var intersectionBy = baseRest(function(arrays) {
  24836. var iteratee = last(arrays),
  24837. mapped = arrayMap(arrays, castArrayLikeObject);
  24838. if (iteratee === last(mapped)) {
  24839. iteratee = undefined;
  24840. } else {
  24841. mapped.pop();
  24842. }
  24843. return (mapped.length && mapped[0] === arrays[0])
  24844. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24845. : [];
  24846. });
  24847. /**
  24848. * This method is like `_.intersection` except that it accepts `comparator`
  24849. * which is invoked to compare elements of `arrays`. The order and references
  24850. * of result values are determined by the first array. The comparator is
  24851. * invoked with two arguments: (arrVal, othVal).
  24852. *
  24853. * @static
  24854. * @memberOf _
  24855. * @since 4.0.0
  24856. * @category Array
  24857. * @param {...Array} [arrays] The arrays to inspect.
  24858. * @param {Function} [comparator] The comparator invoked per element.
  24859. * @returns {Array} Returns the new array of intersecting values.
  24860. * @example
  24861. *
  24862. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24863. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24864. *
  24865. * _.intersectionWith(objects, others, _.isEqual);
  24866. * // => [{ 'x': 1, 'y': 2 }]
  24867. */
  24868. var intersectionWith = baseRest(function(arrays) {
  24869. var comparator = last(arrays),
  24870. mapped = arrayMap(arrays, castArrayLikeObject);
  24871. comparator = typeof comparator == 'function' ? comparator : undefined;
  24872. if (comparator) {
  24873. mapped.pop();
  24874. }
  24875. return (mapped.length && mapped[0] === arrays[0])
  24876. ? baseIntersection(mapped, undefined, comparator)
  24877. : [];
  24878. });
  24879. /**
  24880. * Converts all elements in `array` into a string separated by `separator`.
  24881. *
  24882. * @static
  24883. * @memberOf _
  24884. * @since 4.0.0
  24885. * @category Array
  24886. * @param {Array} array The array to convert.
  24887. * @param {string} [separator=','] The element separator.
  24888. * @returns {string} Returns the joined string.
  24889. * @example
  24890. *
  24891. * _.join(['a', 'b', 'c'], '~');
  24892. * // => 'a~b~c'
  24893. */
  24894. function join(array, separator) {
  24895. return array == null ? '' : nativeJoin.call(array, separator);
  24896. }
  24897. /**
  24898. * Gets the last element of `array`.
  24899. *
  24900. * @static
  24901. * @memberOf _
  24902. * @since 0.1.0
  24903. * @category Array
  24904. * @param {Array} array The array to query.
  24905. * @returns {*} Returns the last element of `array`.
  24906. * @example
  24907. *
  24908. * _.last([1, 2, 3]);
  24909. * // => 3
  24910. */
  24911. function last(array) {
  24912. var length = array == null ? 0 : array.length;
  24913. return length ? array[length - 1] : undefined;
  24914. }
  24915. /**
  24916. * This method is like `_.indexOf` except that it iterates over elements of
  24917. * `array` from right to left.
  24918. *
  24919. * @static
  24920. * @memberOf _
  24921. * @since 0.1.0
  24922. * @category Array
  24923. * @param {Array} array The array to inspect.
  24924. * @param {*} value The value to search for.
  24925. * @param {number} [fromIndex=array.length-1] The index to search from.
  24926. * @returns {number} Returns the index of the matched value, else `-1`.
  24927. * @example
  24928. *
  24929. * _.lastIndexOf([1, 2, 1, 2], 2);
  24930. * // => 3
  24931. *
  24932. * // Search from the `fromIndex`.
  24933. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  24934. * // => 1
  24935. */
  24936. function lastIndexOf(array, value, fromIndex) {
  24937. var length = array == null ? 0 : array.length;
  24938. if (!length) {
  24939. return -1;
  24940. }
  24941. var index = length;
  24942. if (fromIndex !== undefined) {
  24943. index = toInteger(fromIndex);
  24944. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  24945. }
  24946. return value === value
  24947. ? strictLastIndexOf(array, value, index)
  24948. : baseFindIndex(array, baseIsNaN, index, true);
  24949. }
  24950. /**
  24951. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  24952. * element from the end is returned.
  24953. *
  24954. * @static
  24955. * @memberOf _
  24956. * @since 4.11.0
  24957. * @category Array
  24958. * @param {Array} array The array to query.
  24959. * @param {number} [n=0] The index of the element to return.
  24960. * @returns {*} Returns the nth element of `array`.
  24961. * @example
  24962. *
  24963. * var array = ['a', 'b', 'c', 'd'];
  24964. *
  24965. * _.nth(array, 1);
  24966. * // => 'b'
  24967. *
  24968. * _.nth(array, -2);
  24969. * // => 'c';
  24970. */
  24971. function nth(array, n) {
  24972. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  24973. }
  24974. /**
  24975. * Removes all given values from `array` using
  24976. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24977. * for equality comparisons.
  24978. *
  24979. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  24980. * to remove elements from an array by predicate.
  24981. *
  24982. * @static
  24983. * @memberOf _
  24984. * @since 2.0.0
  24985. * @category Array
  24986. * @param {Array} array The array to modify.
  24987. * @param {...*} [values] The values to remove.
  24988. * @returns {Array} Returns `array`.
  24989. * @example
  24990. *
  24991. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24992. *
  24993. * _.pull(array, 'a', 'c');
  24994. * console.log(array);
  24995. * // => ['b', 'b']
  24996. */
  24997. var pull = baseRest(pullAll);
  24998. /**
  24999. * This method is like `_.pull` except that it accepts an array of values to remove.
  25000. *
  25001. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25002. *
  25003. * @static
  25004. * @memberOf _
  25005. * @since 4.0.0
  25006. * @category Array
  25007. * @param {Array} array The array to modify.
  25008. * @param {Array} values The values to remove.
  25009. * @returns {Array} Returns `array`.
  25010. * @example
  25011. *
  25012. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25013. *
  25014. * _.pullAll(array, ['a', 'c']);
  25015. * console.log(array);
  25016. * // => ['b', 'b']
  25017. */
  25018. function pullAll(array, values) {
  25019. return (array && array.length && values && values.length)
  25020. ? basePullAll(array, values)
  25021. : array;
  25022. }
  25023. /**
  25024. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25025. * invoked for each element of `array` and `values` to generate the criterion
  25026. * by which they're compared. The iteratee is invoked with one argument: (value).
  25027. *
  25028. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25029. *
  25030. * @static
  25031. * @memberOf _
  25032. * @since 4.0.0
  25033. * @category Array
  25034. * @param {Array} array The array to modify.
  25035. * @param {Array} values The values to remove.
  25036. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25037. * @returns {Array} Returns `array`.
  25038. * @example
  25039. *
  25040. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25041. *
  25042. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25043. * console.log(array);
  25044. * // => [{ 'x': 2 }]
  25045. */
  25046. function pullAllBy(array, values, iteratee) {
  25047. return (array && array.length && values && values.length)
  25048. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25049. : array;
  25050. }
  25051. /**
  25052. * This method is like `_.pullAll` except that it accepts `comparator` which
  25053. * is invoked to compare elements of `array` to `values`. The comparator is
  25054. * invoked with two arguments: (arrVal, othVal).
  25055. *
  25056. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25057. *
  25058. * @static
  25059. * @memberOf _
  25060. * @since 4.6.0
  25061. * @category Array
  25062. * @param {Array} array The array to modify.
  25063. * @param {Array} values The values to remove.
  25064. * @param {Function} [comparator] The comparator invoked per element.
  25065. * @returns {Array} Returns `array`.
  25066. * @example
  25067. *
  25068. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25069. *
  25070. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25071. * console.log(array);
  25072. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25073. */
  25074. function pullAllWith(array, values, comparator) {
  25075. return (array && array.length && values && values.length)
  25076. ? basePullAll(array, values, undefined, comparator)
  25077. : array;
  25078. }
  25079. /**
  25080. * Removes elements from `array` corresponding to `indexes` and returns an
  25081. * array of removed elements.
  25082. *
  25083. * **Note:** Unlike `_.at`, this method mutates `array`.
  25084. *
  25085. * @static
  25086. * @memberOf _
  25087. * @since 3.0.0
  25088. * @category Array
  25089. * @param {Array} array The array to modify.
  25090. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25091. * @returns {Array} Returns the new array of removed elements.
  25092. * @example
  25093. *
  25094. * var array = ['a', 'b', 'c', 'd'];
  25095. * var pulled = _.pullAt(array, [1, 3]);
  25096. *
  25097. * console.log(array);
  25098. * // => ['a', 'c']
  25099. *
  25100. * console.log(pulled);
  25101. * // => ['b', 'd']
  25102. */
  25103. var pullAt = flatRest(function(array, indexes) {
  25104. var length = array == null ? 0 : array.length,
  25105. result = baseAt(array, indexes);
  25106. basePullAt(array, arrayMap(indexes, function(index) {
  25107. return isIndex(index, length) ? +index : index;
  25108. }).sort(compareAscending));
  25109. return result;
  25110. });
  25111. /**
  25112. * Removes all elements from `array` that `predicate` returns truthy for
  25113. * and returns an array of the removed elements. The predicate is invoked
  25114. * with three arguments: (value, index, array).
  25115. *
  25116. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25117. * to pull elements from an array by value.
  25118. *
  25119. * @static
  25120. * @memberOf _
  25121. * @since 2.0.0
  25122. * @category Array
  25123. * @param {Array} array The array to modify.
  25124. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25125. * @returns {Array} Returns the new array of removed elements.
  25126. * @example
  25127. *
  25128. * var array = [1, 2, 3, 4];
  25129. * var evens = _.remove(array, function(n) {
  25130. * return n % 2 == 0;
  25131. * });
  25132. *
  25133. * console.log(array);
  25134. * // => [1, 3]
  25135. *
  25136. * console.log(evens);
  25137. * // => [2, 4]
  25138. */
  25139. function remove(array, predicate) {
  25140. var result = [];
  25141. if (!(array && array.length)) {
  25142. return result;
  25143. }
  25144. var index = -1,
  25145. indexes = [],
  25146. length = array.length;
  25147. predicate = getIteratee(predicate, 3);
  25148. while (++index < length) {
  25149. var value = array[index];
  25150. if (predicate(value, index, array)) {
  25151. result.push(value);
  25152. indexes.push(index);
  25153. }
  25154. }
  25155. basePullAt(array, indexes);
  25156. return result;
  25157. }
  25158. /**
  25159. * Reverses `array` so that the first element becomes the last, the second
  25160. * element becomes the second to last, and so on.
  25161. *
  25162. * **Note:** This method mutates `array` and is based on
  25163. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25164. *
  25165. * @static
  25166. * @memberOf _
  25167. * @since 4.0.0
  25168. * @category Array
  25169. * @param {Array} array The array to modify.
  25170. * @returns {Array} Returns `array`.
  25171. * @example
  25172. *
  25173. * var array = [1, 2, 3];
  25174. *
  25175. * _.reverse(array);
  25176. * // => [3, 2, 1]
  25177. *
  25178. * console.log(array);
  25179. * // => [3, 2, 1]
  25180. */
  25181. function reverse(array) {
  25182. return array == null ? array : nativeReverse.call(array);
  25183. }
  25184. /**
  25185. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25186. *
  25187. * **Note:** This method is used instead of
  25188. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25189. * returned.
  25190. *
  25191. * @static
  25192. * @memberOf _
  25193. * @since 3.0.0
  25194. * @category Array
  25195. * @param {Array} array The array to slice.
  25196. * @param {number} [start=0] The start position.
  25197. * @param {number} [end=array.length] The end position.
  25198. * @returns {Array} Returns the slice of `array`.
  25199. */
  25200. function slice(array, start, end) {
  25201. var length = array == null ? 0 : array.length;
  25202. if (!length) {
  25203. return [];
  25204. }
  25205. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25206. start = 0;
  25207. end = length;
  25208. }
  25209. else {
  25210. start = start == null ? 0 : toInteger(start);
  25211. end = end === undefined ? length : toInteger(end);
  25212. }
  25213. return baseSlice(array, start, end);
  25214. }
  25215. /**
  25216. * Uses a binary search to determine the lowest index at which `value`
  25217. * should be inserted into `array` in order to maintain its sort order.
  25218. *
  25219. * @static
  25220. * @memberOf _
  25221. * @since 0.1.0
  25222. * @category Array
  25223. * @param {Array} array The sorted array to inspect.
  25224. * @param {*} value The value to evaluate.
  25225. * @returns {number} Returns the index at which `value` should be inserted
  25226. * into `array`.
  25227. * @example
  25228. *
  25229. * _.sortedIndex([30, 50], 40);
  25230. * // => 1
  25231. */
  25232. function sortedIndex(array, value) {
  25233. return baseSortedIndex(array, value);
  25234. }
  25235. /**
  25236. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25237. * which is invoked for `value` and each element of `array` to compute their
  25238. * sort ranking. The iteratee is invoked with one argument: (value).
  25239. *
  25240. * @static
  25241. * @memberOf _
  25242. * @since 4.0.0
  25243. * @category Array
  25244. * @param {Array} array The sorted array to inspect.
  25245. * @param {*} value The value to evaluate.
  25246. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25247. * @returns {number} Returns the index at which `value` should be inserted
  25248. * into `array`.
  25249. * @example
  25250. *
  25251. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25252. *
  25253. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25254. * // => 0
  25255. *
  25256. * // The `_.property` iteratee shorthand.
  25257. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25258. * // => 0
  25259. */
  25260. function sortedIndexBy(array, value, iteratee) {
  25261. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25262. }
  25263. /**
  25264. * This method is like `_.indexOf` except that it performs a binary
  25265. * search on a sorted `array`.
  25266. *
  25267. * @static
  25268. * @memberOf _
  25269. * @since 4.0.0
  25270. * @category Array
  25271. * @param {Array} array The array to inspect.
  25272. * @param {*} value The value to search for.
  25273. * @returns {number} Returns the index of the matched value, else `-1`.
  25274. * @example
  25275. *
  25276. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25277. * // => 1
  25278. */
  25279. function sortedIndexOf(array, value) {
  25280. var length = array == null ? 0 : array.length;
  25281. if (length) {
  25282. var index = baseSortedIndex(array, value);
  25283. if (index < length && eq(array[index], value)) {
  25284. return index;
  25285. }
  25286. }
  25287. return -1;
  25288. }
  25289. /**
  25290. * This method is like `_.sortedIndex` except that it returns the highest
  25291. * index at which `value` should be inserted into `array` in order to
  25292. * maintain its sort order.
  25293. *
  25294. * @static
  25295. * @memberOf _
  25296. * @since 3.0.0
  25297. * @category Array
  25298. * @param {Array} array The sorted array to inspect.
  25299. * @param {*} value The value to evaluate.
  25300. * @returns {number} Returns the index at which `value` should be inserted
  25301. * into `array`.
  25302. * @example
  25303. *
  25304. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25305. * // => 4
  25306. */
  25307. function sortedLastIndex(array, value) {
  25308. return baseSortedIndex(array, value, true);
  25309. }
  25310. /**
  25311. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25312. * which is invoked for `value` and each element of `array` to compute their
  25313. * sort ranking. The iteratee is invoked with one argument: (value).
  25314. *
  25315. * @static
  25316. * @memberOf _
  25317. * @since 4.0.0
  25318. * @category Array
  25319. * @param {Array} array The sorted array to inspect.
  25320. * @param {*} value The value to evaluate.
  25321. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25322. * @returns {number} Returns the index at which `value` should be inserted
  25323. * into `array`.
  25324. * @example
  25325. *
  25326. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25327. *
  25328. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25329. * // => 1
  25330. *
  25331. * // The `_.property` iteratee shorthand.
  25332. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25333. * // => 1
  25334. */
  25335. function sortedLastIndexBy(array, value, iteratee) {
  25336. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25337. }
  25338. /**
  25339. * This method is like `_.lastIndexOf` except that it performs a binary
  25340. * search on a sorted `array`.
  25341. *
  25342. * @static
  25343. * @memberOf _
  25344. * @since 4.0.0
  25345. * @category Array
  25346. * @param {Array} array The array to inspect.
  25347. * @param {*} value The value to search for.
  25348. * @returns {number} Returns the index of the matched value, else `-1`.
  25349. * @example
  25350. *
  25351. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25352. * // => 3
  25353. */
  25354. function sortedLastIndexOf(array, value) {
  25355. var length = array == null ? 0 : array.length;
  25356. if (length) {
  25357. var index = baseSortedIndex(array, value, true) - 1;
  25358. if (eq(array[index], value)) {
  25359. return index;
  25360. }
  25361. }
  25362. return -1;
  25363. }
  25364. /**
  25365. * This method is like `_.uniq` except that it's designed and optimized
  25366. * for sorted arrays.
  25367. *
  25368. * @static
  25369. * @memberOf _
  25370. * @since 4.0.0
  25371. * @category Array
  25372. * @param {Array} array The array to inspect.
  25373. * @returns {Array} Returns the new duplicate free array.
  25374. * @example
  25375. *
  25376. * _.sortedUniq([1, 1, 2]);
  25377. * // => [1, 2]
  25378. */
  25379. function sortedUniq(array) {
  25380. return (array && array.length)
  25381. ? baseSortedUniq(array)
  25382. : [];
  25383. }
  25384. /**
  25385. * This method is like `_.uniqBy` except that it's designed and optimized
  25386. * for sorted arrays.
  25387. *
  25388. * @static
  25389. * @memberOf _
  25390. * @since 4.0.0
  25391. * @category Array
  25392. * @param {Array} array The array to inspect.
  25393. * @param {Function} [iteratee] The iteratee invoked per element.
  25394. * @returns {Array} Returns the new duplicate free array.
  25395. * @example
  25396. *
  25397. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25398. * // => [1.1, 2.3]
  25399. */
  25400. function sortedUniqBy(array, iteratee) {
  25401. return (array && array.length)
  25402. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25403. : [];
  25404. }
  25405. /**
  25406. * Gets all but the first element of `array`.
  25407. *
  25408. * @static
  25409. * @memberOf _
  25410. * @since 4.0.0
  25411. * @category Array
  25412. * @param {Array} array The array to query.
  25413. * @returns {Array} Returns the slice of `array`.
  25414. * @example
  25415. *
  25416. * _.tail([1, 2, 3]);
  25417. * // => [2, 3]
  25418. */
  25419. function tail(array) {
  25420. var length = array == null ? 0 : array.length;
  25421. return length ? baseSlice(array, 1, length) : [];
  25422. }
  25423. /**
  25424. * Creates a slice of `array` with `n` elements taken from the beginning.
  25425. *
  25426. * @static
  25427. * @memberOf _
  25428. * @since 0.1.0
  25429. * @category Array
  25430. * @param {Array} array The array to query.
  25431. * @param {number} [n=1] The number of elements to take.
  25432. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25433. * @returns {Array} Returns the slice of `array`.
  25434. * @example
  25435. *
  25436. * _.take([1, 2, 3]);
  25437. * // => [1]
  25438. *
  25439. * _.take([1, 2, 3], 2);
  25440. * // => [1, 2]
  25441. *
  25442. * _.take([1, 2, 3], 5);
  25443. * // => [1, 2, 3]
  25444. *
  25445. * _.take([1, 2, 3], 0);
  25446. * // => []
  25447. */
  25448. function take(array, n, guard) {
  25449. if (!(array && array.length)) {
  25450. return [];
  25451. }
  25452. n = (guard || n === undefined) ? 1 : toInteger(n);
  25453. return baseSlice(array, 0, n < 0 ? 0 : n);
  25454. }
  25455. /**
  25456. * Creates a slice of `array` with `n` elements taken from the end.
  25457. *
  25458. * @static
  25459. * @memberOf _
  25460. * @since 3.0.0
  25461. * @category Array
  25462. * @param {Array} array The array to query.
  25463. * @param {number} [n=1] The number of elements to take.
  25464. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25465. * @returns {Array} Returns the slice of `array`.
  25466. * @example
  25467. *
  25468. * _.takeRight([1, 2, 3]);
  25469. * // => [3]
  25470. *
  25471. * _.takeRight([1, 2, 3], 2);
  25472. * // => [2, 3]
  25473. *
  25474. * _.takeRight([1, 2, 3], 5);
  25475. * // => [1, 2, 3]
  25476. *
  25477. * _.takeRight([1, 2, 3], 0);
  25478. * // => []
  25479. */
  25480. function takeRight(array, n, guard) {
  25481. var length = array == null ? 0 : array.length;
  25482. if (!length) {
  25483. return [];
  25484. }
  25485. n = (guard || n === undefined) ? 1 : toInteger(n);
  25486. n = length - n;
  25487. return baseSlice(array, n < 0 ? 0 : n, length);
  25488. }
  25489. /**
  25490. * Creates a slice of `array` with elements taken from the end. Elements are
  25491. * taken until `predicate` returns falsey. The predicate is invoked with
  25492. * three arguments: (value, index, array).
  25493. *
  25494. * @static
  25495. * @memberOf _
  25496. * @since 3.0.0
  25497. * @category Array
  25498. * @param {Array} array The array to query.
  25499. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25500. * @returns {Array} Returns the slice of `array`.
  25501. * @example
  25502. *
  25503. * var users = [
  25504. * { 'user': 'barney', 'active': true },
  25505. * { 'user': 'fred', 'active': false },
  25506. * { 'user': 'pebbles', 'active': false }
  25507. * ];
  25508. *
  25509. * _.takeRightWhile(users, function(o) { return !o.active; });
  25510. * // => objects for ['fred', 'pebbles']
  25511. *
  25512. * // The `_.matches` iteratee shorthand.
  25513. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25514. * // => objects for ['pebbles']
  25515. *
  25516. * // The `_.matchesProperty` iteratee shorthand.
  25517. * _.takeRightWhile(users, ['active', false]);
  25518. * // => objects for ['fred', 'pebbles']
  25519. *
  25520. * // The `_.property` iteratee shorthand.
  25521. * _.takeRightWhile(users, 'active');
  25522. * // => []
  25523. */
  25524. function takeRightWhile(array, predicate) {
  25525. return (array && array.length)
  25526. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25527. : [];
  25528. }
  25529. /**
  25530. * Creates a slice of `array` with elements taken from the beginning. Elements
  25531. * are taken until `predicate` returns falsey. The predicate is invoked with
  25532. * three arguments: (value, index, array).
  25533. *
  25534. * @static
  25535. * @memberOf _
  25536. * @since 3.0.0
  25537. * @category Array
  25538. * @param {Array} array The array to query.
  25539. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25540. * @returns {Array} Returns the slice of `array`.
  25541. * @example
  25542. *
  25543. * var users = [
  25544. * { 'user': 'barney', 'active': false },
  25545. * { 'user': 'fred', 'active': false },
  25546. * { 'user': 'pebbles', 'active': true }
  25547. * ];
  25548. *
  25549. * _.takeWhile(users, function(o) { return !o.active; });
  25550. * // => objects for ['barney', 'fred']
  25551. *
  25552. * // The `_.matches` iteratee shorthand.
  25553. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25554. * // => objects for ['barney']
  25555. *
  25556. * // The `_.matchesProperty` iteratee shorthand.
  25557. * _.takeWhile(users, ['active', false]);
  25558. * // => objects for ['barney', 'fred']
  25559. *
  25560. * // The `_.property` iteratee shorthand.
  25561. * _.takeWhile(users, 'active');
  25562. * // => []
  25563. */
  25564. function takeWhile(array, predicate) {
  25565. return (array && array.length)
  25566. ? baseWhile(array, getIteratee(predicate, 3))
  25567. : [];
  25568. }
  25569. /**
  25570. * Creates an array of unique values, in order, from all given arrays using
  25571. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25572. * for equality comparisons.
  25573. *
  25574. * @static
  25575. * @memberOf _
  25576. * @since 0.1.0
  25577. * @category Array
  25578. * @param {...Array} [arrays] The arrays to inspect.
  25579. * @returns {Array} Returns the new array of combined values.
  25580. * @example
  25581. *
  25582. * _.union([2], [1, 2]);
  25583. * // => [2, 1]
  25584. */
  25585. var union = baseRest(function(arrays) {
  25586. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25587. });
  25588. /**
  25589. * This method is like `_.union` except that it accepts `iteratee` which is
  25590. * invoked for each element of each `arrays` to generate the criterion by
  25591. * which uniqueness is computed. Result values are chosen from the first
  25592. * array in which the value occurs. The iteratee is invoked with one argument:
  25593. * (value).
  25594. *
  25595. * @static
  25596. * @memberOf _
  25597. * @since 4.0.0
  25598. * @category Array
  25599. * @param {...Array} [arrays] The arrays to inspect.
  25600. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25601. * @returns {Array} Returns the new array of combined values.
  25602. * @example
  25603. *
  25604. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25605. * // => [2.1, 1.2]
  25606. *
  25607. * // The `_.property` iteratee shorthand.
  25608. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25609. * // => [{ 'x': 1 }, { 'x': 2 }]
  25610. */
  25611. var unionBy = baseRest(function(arrays) {
  25612. var iteratee = last(arrays);
  25613. if (isArrayLikeObject(iteratee)) {
  25614. iteratee = undefined;
  25615. }
  25616. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25617. });
  25618. /**
  25619. * This method is like `_.union` except that it accepts `comparator` which
  25620. * is invoked to compare elements of `arrays`. Result values are chosen from
  25621. * the first array in which the value occurs. The comparator is invoked
  25622. * with two arguments: (arrVal, othVal).
  25623. *
  25624. * @static
  25625. * @memberOf _
  25626. * @since 4.0.0
  25627. * @category Array
  25628. * @param {...Array} [arrays] The arrays to inspect.
  25629. * @param {Function} [comparator] The comparator invoked per element.
  25630. * @returns {Array} Returns the new array of combined values.
  25631. * @example
  25632. *
  25633. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25634. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25635. *
  25636. * _.unionWith(objects, others, _.isEqual);
  25637. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25638. */
  25639. var unionWith = baseRest(function(arrays) {
  25640. var comparator = last(arrays);
  25641. comparator = typeof comparator == 'function' ? comparator : undefined;
  25642. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25643. });
  25644. /**
  25645. * Creates a duplicate-free version of an array, using
  25646. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25647. * for equality comparisons, in which only the first occurrence of each element
  25648. * is kept. The order of result values is determined by the order they occur
  25649. * in the array.
  25650. *
  25651. * @static
  25652. * @memberOf _
  25653. * @since 0.1.0
  25654. * @category Array
  25655. * @param {Array} array The array to inspect.
  25656. * @returns {Array} Returns the new duplicate free array.
  25657. * @example
  25658. *
  25659. * _.uniq([2, 1, 2]);
  25660. * // => [2, 1]
  25661. */
  25662. function uniq(array) {
  25663. return (array && array.length) ? baseUniq(array) : [];
  25664. }
  25665. /**
  25666. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25667. * invoked for each element in `array` to generate the criterion by which
  25668. * uniqueness is computed. The order of result values is determined by the
  25669. * order they occur in the array. The iteratee is invoked with one argument:
  25670. * (value).
  25671. *
  25672. * @static
  25673. * @memberOf _
  25674. * @since 4.0.0
  25675. * @category Array
  25676. * @param {Array} array The array to inspect.
  25677. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25678. * @returns {Array} Returns the new duplicate free array.
  25679. * @example
  25680. *
  25681. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25682. * // => [2.1, 1.2]
  25683. *
  25684. * // The `_.property` iteratee shorthand.
  25685. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25686. * // => [{ 'x': 1 }, { 'x': 2 }]
  25687. */
  25688. function uniqBy(array, iteratee) {
  25689. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25690. }
  25691. /**
  25692. * This method is like `_.uniq` except that it accepts `comparator` which
  25693. * is invoked to compare elements of `array`. The order of result values is
  25694. * determined by the order they occur in the array.The comparator is invoked
  25695. * with two arguments: (arrVal, othVal).
  25696. *
  25697. * @static
  25698. * @memberOf _
  25699. * @since 4.0.0
  25700. * @category Array
  25701. * @param {Array} array The array to inspect.
  25702. * @param {Function} [comparator] The comparator invoked per element.
  25703. * @returns {Array} Returns the new duplicate free array.
  25704. * @example
  25705. *
  25706. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25707. *
  25708. * _.uniqWith(objects, _.isEqual);
  25709. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25710. */
  25711. function uniqWith(array, comparator) {
  25712. comparator = typeof comparator == 'function' ? comparator : undefined;
  25713. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25714. }
  25715. /**
  25716. * This method is like `_.zip` except that it accepts an array of grouped
  25717. * elements and creates an array regrouping the elements to their pre-zip
  25718. * configuration.
  25719. *
  25720. * @static
  25721. * @memberOf _
  25722. * @since 1.2.0
  25723. * @category Array
  25724. * @param {Array} array The array of grouped elements to process.
  25725. * @returns {Array} Returns the new array of regrouped elements.
  25726. * @example
  25727. *
  25728. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25729. * // => [['a', 1, true], ['b', 2, false]]
  25730. *
  25731. * _.unzip(zipped);
  25732. * // => [['a', 'b'], [1, 2], [true, false]]
  25733. */
  25734. function unzip(array) {
  25735. if (!(array && array.length)) {
  25736. return [];
  25737. }
  25738. var length = 0;
  25739. array = arrayFilter(array, function(group) {
  25740. if (isArrayLikeObject(group)) {
  25741. length = nativeMax(group.length, length);
  25742. return true;
  25743. }
  25744. });
  25745. return baseTimes(length, function(index) {
  25746. return arrayMap(array, baseProperty(index));
  25747. });
  25748. }
  25749. /**
  25750. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25751. * how regrouped values should be combined. The iteratee is invoked with the
  25752. * elements of each group: (...group).
  25753. *
  25754. * @static
  25755. * @memberOf _
  25756. * @since 3.8.0
  25757. * @category Array
  25758. * @param {Array} array The array of grouped elements to process.
  25759. * @param {Function} [iteratee=_.identity] The function to combine
  25760. * regrouped values.
  25761. * @returns {Array} Returns the new array of regrouped elements.
  25762. * @example
  25763. *
  25764. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25765. * // => [[1, 10, 100], [2, 20, 200]]
  25766. *
  25767. * _.unzipWith(zipped, _.add);
  25768. * // => [3, 30, 300]
  25769. */
  25770. function unzipWith(array, iteratee) {
  25771. if (!(array && array.length)) {
  25772. return [];
  25773. }
  25774. var result = unzip(array);
  25775. if (iteratee == null) {
  25776. return result;
  25777. }
  25778. return arrayMap(result, function(group) {
  25779. return apply(iteratee, undefined, group);
  25780. });
  25781. }
  25782. /**
  25783. * Creates an array excluding all given values using
  25784. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25785. * for equality comparisons.
  25786. *
  25787. * **Note:** Unlike `_.pull`, this method returns a new array.
  25788. *
  25789. * @static
  25790. * @memberOf _
  25791. * @since 0.1.0
  25792. * @category Array
  25793. * @param {Array} array The array to inspect.
  25794. * @param {...*} [values] The values to exclude.
  25795. * @returns {Array} Returns the new array of filtered values.
  25796. * @see _.difference, _.xor
  25797. * @example
  25798. *
  25799. * _.without([2, 1, 2, 3], 1, 2);
  25800. * // => [3]
  25801. */
  25802. var without = baseRest(function(array, values) {
  25803. return isArrayLikeObject(array)
  25804. ? baseDifference(array, values)
  25805. : [];
  25806. });
  25807. /**
  25808. * Creates an array of unique values that is the
  25809. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25810. * of the given arrays. The order of result values is determined by the order
  25811. * they occur in the arrays.
  25812. *
  25813. * @static
  25814. * @memberOf _
  25815. * @since 2.4.0
  25816. * @category Array
  25817. * @param {...Array} [arrays] The arrays to inspect.
  25818. * @returns {Array} Returns the new array of filtered values.
  25819. * @see _.difference, _.without
  25820. * @example
  25821. *
  25822. * _.xor([2, 1], [2, 3]);
  25823. * // => [1, 3]
  25824. */
  25825. var xor = baseRest(function(arrays) {
  25826. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25827. });
  25828. /**
  25829. * This method is like `_.xor` except that it accepts `iteratee` which is
  25830. * invoked for each element of each `arrays` to generate the criterion by
  25831. * which by which they're compared. The order of result values is determined
  25832. * by the order they occur in the arrays. The iteratee is invoked with one
  25833. * argument: (value).
  25834. *
  25835. * @static
  25836. * @memberOf _
  25837. * @since 4.0.0
  25838. * @category Array
  25839. * @param {...Array} [arrays] The arrays to inspect.
  25840. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25841. * @returns {Array} Returns the new array of filtered values.
  25842. * @example
  25843. *
  25844. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25845. * // => [1.2, 3.4]
  25846. *
  25847. * // The `_.property` iteratee shorthand.
  25848. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25849. * // => [{ 'x': 2 }]
  25850. */
  25851. var xorBy = baseRest(function(arrays) {
  25852. var iteratee = last(arrays);
  25853. if (isArrayLikeObject(iteratee)) {
  25854. iteratee = undefined;
  25855. }
  25856. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25857. });
  25858. /**
  25859. * This method is like `_.xor` except that it accepts `comparator` which is
  25860. * invoked to compare elements of `arrays`. The order of result values is
  25861. * determined by the order they occur in the arrays. The comparator is invoked
  25862. * with two arguments: (arrVal, othVal).
  25863. *
  25864. * @static
  25865. * @memberOf _
  25866. * @since 4.0.0
  25867. * @category Array
  25868. * @param {...Array} [arrays] The arrays to inspect.
  25869. * @param {Function} [comparator] The comparator invoked per element.
  25870. * @returns {Array} Returns the new array of filtered values.
  25871. * @example
  25872. *
  25873. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25874. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25875. *
  25876. * _.xorWith(objects, others, _.isEqual);
  25877. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25878. */
  25879. var xorWith = baseRest(function(arrays) {
  25880. var comparator = last(arrays);
  25881. comparator = typeof comparator == 'function' ? comparator : undefined;
  25882. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25883. });
  25884. /**
  25885. * Creates an array of grouped elements, the first of which contains the
  25886. * first elements of the given arrays, the second of which contains the
  25887. * second elements of the given arrays, and so on.
  25888. *
  25889. * @static
  25890. * @memberOf _
  25891. * @since 0.1.0
  25892. * @category Array
  25893. * @param {...Array} [arrays] The arrays to process.
  25894. * @returns {Array} Returns the new array of grouped elements.
  25895. * @example
  25896. *
  25897. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25898. * // => [['a', 1, true], ['b', 2, false]]
  25899. */
  25900. var zip = baseRest(unzip);
  25901. /**
  25902. * This method is like `_.fromPairs` except that it accepts two arrays,
  25903. * one of property identifiers and one of corresponding values.
  25904. *
  25905. * @static
  25906. * @memberOf _
  25907. * @since 0.4.0
  25908. * @category Array
  25909. * @param {Array} [props=[]] The property identifiers.
  25910. * @param {Array} [values=[]] The property values.
  25911. * @returns {Object} Returns the new object.
  25912. * @example
  25913. *
  25914. * _.zipObject(['a', 'b'], [1, 2]);
  25915. * // => { 'a': 1, 'b': 2 }
  25916. */
  25917. function zipObject(props, values) {
  25918. return baseZipObject(props || [], values || [], assignValue);
  25919. }
  25920. /**
  25921. * This method is like `_.zipObject` except that it supports property paths.
  25922. *
  25923. * @static
  25924. * @memberOf _
  25925. * @since 4.1.0
  25926. * @category Array
  25927. * @param {Array} [props=[]] The property identifiers.
  25928. * @param {Array} [values=[]] The property values.
  25929. * @returns {Object} Returns the new object.
  25930. * @example
  25931. *
  25932. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  25933. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  25934. */
  25935. function zipObjectDeep(props, values) {
  25936. return baseZipObject(props || [], values || [], baseSet);
  25937. }
  25938. /**
  25939. * This method is like `_.zip` except that it accepts `iteratee` to specify
  25940. * how grouped values should be combined. The iteratee is invoked with the
  25941. * elements of each group: (...group).
  25942. *
  25943. * @static
  25944. * @memberOf _
  25945. * @since 3.8.0
  25946. * @category Array
  25947. * @param {...Array} [arrays] The arrays to process.
  25948. * @param {Function} [iteratee=_.identity] The function to combine
  25949. * grouped values.
  25950. * @returns {Array} Returns the new array of grouped elements.
  25951. * @example
  25952. *
  25953. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  25954. * return a + b + c;
  25955. * });
  25956. * // => [111, 222]
  25957. */
  25958. var zipWith = baseRest(function(arrays) {
  25959. var length = arrays.length,
  25960. iteratee = length > 1 ? arrays[length - 1] : undefined;
  25961. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  25962. return unzipWith(arrays, iteratee);
  25963. });
  25964. /*------------------------------------------------------------------------*/
  25965. /**
  25966. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  25967. * chain sequences enabled. The result of such sequences must be unwrapped
  25968. * with `_#value`.
  25969. *
  25970. * @static
  25971. * @memberOf _
  25972. * @since 1.3.0
  25973. * @category Seq
  25974. * @param {*} value The value to wrap.
  25975. * @returns {Object} Returns the new `lodash` wrapper instance.
  25976. * @example
  25977. *
  25978. * var users = [
  25979. * { 'user': 'barney', 'age': 36 },
  25980. * { 'user': 'fred', 'age': 40 },
  25981. * { 'user': 'pebbles', 'age': 1 }
  25982. * ];
  25983. *
  25984. * var youngest = _
  25985. * .chain(users)
  25986. * .sortBy('age')
  25987. * .map(function(o) {
  25988. * return o.user + ' is ' + o.age;
  25989. * })
  25990. * .head()
  25991. * .value();
  25992. * // => 'pebbles is 1'
  25993. */
  25994. function chain(value) {
  25995. var result = lodash(value);
  25996. result.__chain__ = true;
  25997. return result;
  25998. }
  25999. /**
  26000. * This method invokes `interceptor` and returns `value`. The interceptor
  26001. * is invoked with one argument; (value). The purpose of this method is to
  26002. * "tap into" a method chain sequence in order to modify intermediate results.
  26003. *
  26004. * @static
  26005. * @memberOf _
  26006. * @since 0.1.0
  26007. * @category Seq
  26008. * @param {*} value The value to provide to `interceptor`.
  26009. * @param {Function} interceptor The function to invoke.
  26010. * @returns {*} Returns `value`.
  26011. * @example
  26012. *
  26013. * _([1, 2, 3])
  26014. * .tap(function(array) {
  26015. * // Mutate input array.
  26016. * array.pop();
  26017. * })
  26018. * .reverse()
  26019. * .value();
  26020. * // => [2, 1]
  26021. */
  26022. function tap(value, interceptor) {
  26023. interceptor(value);
  26024. return value;
  26025. }
  26026. /**
  26027. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26028. * The purpose of this method is to "pass thru" values replacing intermediate
  26029. * results in a method chain sequence.
  26030. *
  26031. * @static
  26032. * @memberOf _
  26033. * @since 3.0.0
  26034. * @category Seq
  26035. * @param {*} value The value to provide to `interceptor`.
  26036. * @param {Function} interceptor The function to invoke.
  26037. * @returns {*} Returns the result of `interceptor`.
  26038. * @example
  26039. *
  26040. * _(' abc ')
  26041. * .chain()
  26042. * .trim()
  26043. * .thru(function(value) {
  26044. * return [value];
  26045. * })
  26046. * .value();
  26047. * // => ['abc']
  26048. */
  26049. function thru(value, interceptor) {
  26050. return interceptor(value);
  26051. }
  26052. /**
  26053. * This method is the wrapper version of `_.at`.
  26054. *
  26055. * @name at
  26056. * @memberOf _
  26057. * @since 1.0.0
  26058. * @category Seq
  26059. * @param {...(string|string[])} [paths] The property paths to pick.
  26060. * @returns {Object} Returns the new `lodash` wrapper instance.
  26061. * @example
  26062. *
  26063. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26064. *
  26065. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26066. * // => [3, 4]
  26067. */
  26068. var wrapperAt = flatRest(function(paths) {
  26069. var length = paths.length,
  26070. start = length ? paths[0] : 0,
  26071. value = this.__wrapped__,
  26072. interceptor = function(object) { return baseAt(object, paths); };
  26073. if (length > 1 || this.__actions__.length ||
  26074. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26075. return this.thru(interceptor);
  26076. }
  26077. value = value.slice(start, +start + (length ? 1 : 0));
  26078. value.__actions__.push({
  26079. 'func': thru,
  26080. 'args': [interceptor],
  26081. 'thisArg': undefined
  26082. });
  26083. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26084. if (length && !array.length) {
  26085. array.push(undefined);
  26086. }
  26087. return array;
  26088. });
  26089. });
  26090. /**
  26091. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26092. *
  26093. * @name chain
  26094. * @memberOf _
  26095. * @since 0.1.0
  26096. * @category Seq
  26097. * @returns {Object} Returns the new `lodash` wrapper instance.
  26098. * @example
  26099. *
  26100. * var users = [
  26101. * { 'user': 'barney', 'age': 36 },
  26102. * { 'user': 'fred', 'age': 40 }
  26103. * ];
  26104. *
  26105. * // A sequence without explicit chaining.
  26106. * _(users).head();
  26107. * // => { 'user': 'barney', 'age': 36 }
  26108. *
  26109. * // A sequence with explicit chaining.
  26110. * _(users)
  26111. * .chain()
  26112. * .head()
  26113. * .pick('user')
  26114. * .value();
  26115. * // => { 'user': 'barney' }
  26116. */
  26117. function wrapperChain() {
  26118. return chain(this);
  26119. }
  26120. /**
  26121. * Executes the chain sequence and returns the wrapped result.
  26122. *
  26123. * @name commit
  26124. * @memberOf _
  26125. * @since 3.2.0
  26126. * @category Seq
  26127. * @returns {Object} Returns the new `lodash` wrapper instance.
  26128. * @example
  26129. *
  26130. * var array = [1, 2];
  26131. * var wrapped = _(array).push(3);
  26132. *
  26133. * console.log(array);
  26134. * // => [1, 2]
  26135. *
  26136. * wrapped = wrapped.commit();
  26137. * console.log(array);
  26138. * // => [1, 2, 3]
  26139. *
  26140. * wrapped.last();
  26141. * // => 3
  26142. *
  26143. * console.log(array);
  26144. * // => [1, 2, 3]
  26145. */
  26146. function wrapperCommit() {
  26147. return new LodashWrapper(this.value(), this.__chain__);
  26148. }
  26149. /**
  26150. * Gets the next value on a wrapped object following the
  26151. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26152. *
  26153. * @name next
  26154. * @memberOf _
  26155. * @since 4.0.0
  26156. * @category Seq
  26157. * @returns {Object} Returns the next iterator value.
  26158. * @example
  26159. *
  26160. * var wrapped = _([1, 2]);
  26161. *
  26162. * wrapped.next();
  26163. * // => { 'done': false, 'value': 1 }
  26164. *
  26165. * wrapped.next();
  26166. * // => { 'done': false, 'value': 2 }
  26167. *
  26168. * wrapped.next();
  26169. * // => { 'done': true, 'value': undefined }
  26170. */
  26171. function wrapperNext() {
  26172. if (this.__values__ === undefined) {
  26173. this.__values__ = toArray(this.value());
  26174. }
  26175. var done = this.__index__ >= this.__values__.length,
  26176. value = done ? undefined : this.__values__[this.__index__++];
  26177. return { 'done': done, 'value': value };
  26178. }
  26179. /**
  26180. * Enables the wrapper to be iterable.
  26181. *
  26182. * @name Symbol.iterator
  26183. * @memberOf _
  26184. * @since 4.0.0
  26185. * @category Seq
  26186. * @returns {Object} Returns the wrapper object.
  26187. * @example
  26188. *
  26189. * var wrapped = _([1, 2]);
  26190. *
  26191. * wrapped[Symbol.iterator]() === wrapped;
  26192. * // => true
  26193. *
  26194. * Array.from(wrapped);
  26195. * // => [1, 2]
  26196. */
  26197. function wrapperToIterator() {
  26198. return this;
  26199. }
  26200. /**
  26201. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26202. *
  26203. * @name plant
  26204. * @memberOf _
  26205. * @since 3.2.0
  26206. * @category Seq
  26207. * @param {*} value The value to plant.
  26208. * @returns {Object} Returns the new `lodash` wrapper instance.
  26209. * @example
  26210. *
  26211. * function square(n) {
  26212. * return n * n;
  26213. * }
  26214. *
  26215. * var wrapped = _([1, 2]).map(square);
  26216. * var other = wrapped.plant([3, 4]);
  26217. *
  26218. * other.value();
  26219. * // => [9, 16]
  26220. *
  26221. * wrapped.value();
  26222. * // => [1, 4]
  26223. */
  26224. function wrapperPlant(value) {
  26225. var result,
  26226. parent = this;
  26227. while (parent instanceof baseLodash) {
  26228. var clone = wrapperClone(parent);
  26229. clone.__index__ = 0;
  26230. clone.__values__ = undefined;
  26231. if (result) {
  26232. previous.__wrapped__ = clone;
  26233. } else {
  26234. result = clone;
  26235. }
  26236. var previous = clone;
  26237. parent = parent.__wrapped__;
  26238. }
  26239. previous.__wrapped__ = value;
  26240. return result;
  26241. }
  26242. /**
  26243. * This method is the wrapper version of `_.reverse`.
  26244. *
  26245. * **Note:** This method mutates the wrapped array.
  26246. *
  26247. * @name reverse
  26248. * @memberOf _
  26249. * @since 0.1.0
  26250. * @category Seq
  26251. * @returns {Object} Returns the new `lodash` wrapper instance.
  26252. * @example
  26253. *
  26254. * var array = [1, 2, 3];
  26255. *
  26256. * _(array).reverse().value()
  26257. * // => [3, 2, 1]
  26258. *
  26259. * console.log(array);
  26260. * // => [3, 2, 1]
  26261. */
  26262. function wrapperReverse() {
  26263. var value = this.__wrapped__;
  26264. if (value instanceof LazyWrapper) {
  26265. var wrapped = value;
  26266. if (this.__actions__.length) {
  26267. wrapped = new LazyWrapper(this);
  26268. }
  26269. wrapped = wrapped.reverse();
  26270. wrapped.__actions__.push({
  26271. 'func': thru,
  26272. 'args': [reverse],
  26273. 'thisArg': undefined
  26274. });
  26275. return new LodashWrapper(wrapped, this.__chain__);
  26276. }
  26277. return this.thru(reverse);
  26278. }
  26279. /**
  26280. * Executes the chain sequence to resolve the unwrapped value.
  26281. *
  26282. * @name value
  26283. * @memberOf _
  26284. * @since 0.1.0
  26285. * @alias toJSON, valueOf
  26286. * @category Seq
  26287. * @returns {*} Returns the resolved unwrapped value.
  26288. * @example
  26289. *
  26290. * _([1, 2, 3]).value();
  26291. * // => [1, 2, 3]
  26292. */
  26293. function wrapperValue() {
  26294. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26295. }
  26296. /*------------------------------------------------------------------------*/
  26297. /**
  26298. * Creates an object composed of keys generated from the results of running
  26299. * each element of `collection` thru `iteratee`. The corresponding value of
  26300. * each key is the number of times the key was returned by `iteratee`. The
  26301. * iteratee is invoked with one argument: (value).
  26302. *
  26303. * @static
  26304. * @memberOf _
  26305. * @since 0.5.0
  26306. * @category Collection
  26307. * @param {Array|Object} collection The collection to iterate over.
  26308. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26309. * @returns {Object} Returns the composed aggregate object.
  26310. * @example
  26311. *
  26312. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26313. * // => { '4': 1, '6': 2 }
  26314. *
  26315. * // The `_.property` iteratee shorthand.
  26316. * _.countBy(['one', 'two', 'three'], 'length');
  26317. * // => { '3': 2, '5': 1 }
  26318. */
  26319. var countBy = createAggregator(function(result, value, key) {
  26320. if (hasOwnProperty.call(result, key)) {
  26321. ++result[key];
  26322. } else {
  26323. baseAssignValue(result, key, 1);
  26324. }
  26325. });
  26326. /**
  26327. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26328. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26329. * invoked with three arguments: (value, index|key, collection).
  26330. *
  26331. * **Note:** This method returns `true` for
  26332. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26333. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26334. * elements of empty collections.
  26335. *
  26336. * @static
  26337. * @memberOf _
  26338. * @since 0.1.0
  26339. * @category Collection
  26340. * @param {Array|Object} collection The collection to iterate over.
  26341. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26342. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26343. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26344. * else `false`.
  26345. * @example
  26346. *
  26347. * _.every([true, 1, null, 'yes'], Boolean);
  26348. * // => false
  26349. *
  26350. * var users = [
  26351. * { 'user': 'barney', 'age': 36, 'active': false },
  26352. * { 'user': 'fred', 'age': 40, 'active': false }
  26353. * ];
  26354. *
  26355. * // The `_.matches` iteratee shorthand.
  26356. * _.every(users, { 'user': 'barney', 'active': false });
  26357. * // => false
  26358. *
  26359. * // The `_.matchesProperty` iteratee shorthand.
  26360. * _.every(users, ['active', false]);
  26361. * // => true
  26362. *
  26363. * // The `_.property` iteratee shorthand.
  26364. * _.every(users, 'active');
  26365. * // => false
  26366. */
  26367. function every(collection, predicate, guard) {
  26368. var func = isArray(collection) ? arrayEvery : baseEvery;
  26369. if (guard && isIterateeCall(collection, predicate, guard)) {
  26370. predicate = undefined;
  26371. }
  26372. return func(collection, getIteratee(predicate, 3));
  26373. }
  26374. /**
  26375. * Iterates over elements of `collection`, returning an array of all elements
  26376. * `predicate` returns truthy for. The predicate is invoked with three
  26377. * arguments: (value, index|key, collection).
  26378. *
  26379. * **Note:** Unlike `_.remove`, this method returns a new array.
  26380. *
  26381. * @static
  26382. * @memberOf _
  26383. * @since 0.1.0
  26384. * @category Collection
  26385. * @param {Array|Object} collection The collection to iterate over.
  26386. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26387. * @returns {Array} Returns the new filtered array.
  26388. * @see _.reject
  26389. * @example
  26390. *
  26391. * var users = [
  26392. * { 'user': 'barney', 'age': 36, 'active': true },
  26393. * { 'user': 'fred', 'age': 40, 'active': false }
  26394. * ];
  26395. *
  26396. * _.filter(users, function(o) { return !o.active; });
  26397. * // => objects for ['fred']
  26398. *
  26399. * // The `_.matches` iteratee shorthand.
  26400. * _.filter(users, { 'age': 36, 'active': true });
  26401. * // => objects for ['barney']
  26402. *
  26403. * // The `_.matchesProperty` iteratee shorthand.
  26404. * _.filter(users, ['active', false]);
  26405. * // => objects for ['fred']
  26406. *
  26407. * // The `_.property` iteratee shorthand.
  26408. * _.filter(users, 'active');
  26409. * // => objects for ['barney']
  26410. */
  26411. function filter(collection, predicate) {
  26412. var func = isArray(collection) ? arrayFilter : baseFilter;
  26413. return func(collection, getIteratee(predicate, 3));
  26414. }
  26415. /**
  26416. * Iterates over elements of `collection`, returning the first element
  26417. * `predicate` returns truthy for. The predicate is invoked with three
  26418. * arguments: (value, index|key, collection).
  26419. *
  26420. * @static
  26421. * @memberOf _
  26422. * @since 0.1.0
  26423. * @category Collection
  26424. * @param {Array|Object} collection The collection to inspect.
  26425. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26426. * @param {number} [fromIndex=0] The index to search from.
  26427. * @returns {*} Returns the matched element, else `undefined`.
  26428. * @example
  26429. *
  26430. * var users = [
  26431. * { 'user': 'barney', 'age': 36, 'active': true },
  26432. * { 'user': 'fred', 'age': 40, 'active': false },
  26433. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26434. * ];
  26435. *
  26436. * _.find(users, function(o) { return o.age < 40; });
  26437. * // => object for 'barney'
  26438. *
  26439. * // The `_.matches` iteratee shorthand.
  26440. * _.find(users, { 'age': 1, 'active': true });
  26441. * // => object for 'pebbles'
  26442. *
  26443. * // The `_.matchesProperty` iteratee shorthand.
  26444. * _.find(users, ['active', false]);
  26445. * // => object for 'fred'
  26446. *
  26447. * // The `_.property` iteratee shorthand.
  26448. * _.find(users, 'active');
  26449. * // => object for 'barney'
  26450. */
  26451. var find = createFind(findIndex);
  26452. /**
  26453. * This method is like `_.find` except that it iterates over elements of
  26454. * `collection` from right to left.
  26455. *
  26456. * @static
  26457. * @memberOf _
  26458. * @since 2.0.0
  26459. * @category Collection
  26460. * @param {Array|Object} collection The collection to inspect.
  26461. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26462. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26463. * @returns {*} Returns the matched element, else `undefined`.
  26464. * @example
  26465. *
  26466. * _.findLast([1, 2, 3, 4], function(n) {
  26467. * return n % 2 == 1;
  26468. * });
  26469. * // => 3
  26470. */
  26471. var findLast = createFind(findLastIndex);
  26472. /**
  26473. * Creates a flattened array of values by running each element in `collection`
  26474. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26475. * with three arguments: (value, index|key, collection).
  26476. *
  26477. * @static
  26478. * @memberOf _
  26479. * @since 4.0.0
  26480. * @category Collection
  26481. * @param {Array|Object} collection The collection to iterate over.
  26482. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26483. * @returns {Array} Returns the new flattened array.
  26484. * @example
  26485. *
  26486. * function duplicate(n) {
  26487. * return [n, n];
  26488. * }
  26489. *
  26490. * _.flatMap([1, 2], duplicate);
  26491. * // => [1, 1, 2, 2]
  26492. */
  26493. function flatMap(collection, iteratee) {
  26494. return baseFlatten(map(collection, iteratee), 1);
  26495. }
  26496. /**
  26497. * This method is like `_.flatMap` except that it recursively flattens the
  26498. * mapped results.
  26499. *
  26500. * @static
  26501. * @memberOf _
  26502. * @since 4.7.0
  26503. * @category Collection
  26504. * @param {Array|Object} collection The collection to iterate over.
  26505. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26506. * @returns {Array} Returns the new flattened array.
  26507. * @example
  26508. *
  26509. * function duplicate(n) {
  26510. * return [[[n, n]]];
  26511. * }
  26512. *
  26513. * _.flatMapDeep([1, 2], duplicate);
  26514. * // => [1, 1, 2, 2]
  26515. */
  26516. function flatMapDeep(collection, iteratee) {
  26517. return baseFlatten(map(collection, iteratee), INFINITY);
  26518. }
  26519. /**
  26520. * This method is like `_.flatMap` except that it recursively flattens the
  26521. * mapped results up to `depth` times.
  26522. *
  26523. * @static
  26524. * @memberOf _
  26525. * @since 4.7.0
  26526. * @category Collection
  26527. * @param {Array|Object} collection The collection to iterate over.
  26528. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26529. * @param {number} [depth=1] The maximum recursion depth.
  26530. * @returns {Array} Returns the new flattened array.
  26531. * @example
  26532. *
  26533. * function duplicate(n) {
  26534. * return [[[n, n]]];
  26535. * }
  26536. *
  26537. * _.flatMapDepth([1, 2], duplicate, 2);
  26538. * // => [[1, 1], [2, 2]]
  26539. */
  26540. function flatMapDepth(collection, iteratee, depth) {
  26541. depth = depth === undefined ? 1 : toInteger(depth);
  26542. return baseFlatten(map(collection, iteratee), depth);
  26543. }
  26544. /**
  26545. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26546. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26547. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26548. *
  26549. * **Note:** As with other "Collections" methods, objects with a "length"
  26550. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26551. * or `_.forOwn` for object iteration.
  26552. *
  26553. * @static
  26554. * @memberOf _
  26555. * @since 0.1.0
  26556. * @alias each
  26557. * @category Collection
  26558. * @param {Array|Object} collection The collection to iterate over.
  26559. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26560. * @returns {Array|Object} Returns `collection`.
  26561. * @see _.forEachRight
  26562. * @example
  26563. *
  26564. * _.forEach([1, 2], function(value) {
  26565. * console.log(value);
  26566. * });
  26567. * // => Logs `1` then `2`.
  26568. *
  26569. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26570. * console.log(key);
  26571. * });
  26572. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26573. */
  26574. function forEach(collection, iteratee) {
  26575. var func = isArray(collection) ? arrayEach : baseEach;
  26576. return func(collection, getIteratee(iteratee, 3));
  26577. }
  26578. /**
  26579. * This method is like `_.forEach` except that it iterates over elements of
  26580. * `collection` from right to left.
  26581. *
  26582. * @static
  26583. * @memberOf _
  26584. * @since 2.0.0
  26585. * @alias eachRight
  26586. * @category Collection
  26587. * @param {Array|Object} collection The collection to iterate over.
  26588. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26589. * @returns {Array|Object} Returns `collection`.
  26590. * @see _.forEach
  26591. * @example
  26592. *
  26593. * _.forEachRight([1, 2], function(value) {
  26594. * console.log(value);
  26595. * });
  26596. * // => Logs `2` then `1`.
  26597. */
  26598. function forEachRight(collection, iteratee) {
  26599. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26600. return func(collection, getIteratee(iteratee, 3));
  26601. }
  26602. /**
  26603. * Creates an object composed of keys generated from the results of running
  26604. * each element of `collection` thru `iteratee`. The order of grouped values
  26605. * is determined by the order they occur in `collection`. The corresponding
  26606. * value of each key is an array of elements responsible for generating the
  26607. * key. The iteratee is invoked with one argument: (value).
  26608. *
  26609. * @static
  26610. * @memberOf _
  26611. * @since 0.1.0
  26612. * @category Collection
  26613. * @param {Array|Object} collection The collection to iterate over.
  26614. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26615. * @returns {Object} Returns the composed aggregate object.
  26616. * @example
  26617. *
  26618. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26619. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26620. *
  26621. * // The `_.property` iteratee shorthand.
  26622. * _.groupBy(['one', 'two', 'three'], 'length');
  26623. * // => { '3': ['one', 'two'], '5': ['three'] }
  26624. */
  26625. var groupBy = createAggregator(function(result, value, key) {
  26626. if (hasOwnProperty.call(result, key)) {
  26627. result[key].push(value);
  26628. } else {
  26629. baseAssignValue(result, key, [value]);
  26630. }
  26631. });
  26632. /**
  26633. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26634. * checked for a substring of `value`, otherwise
  26635. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26636. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26637. * the offset from the end of `collection`.
  26638. *
  26639. * @static
  26640. * @memberOf _
  26641. * @since 0.1.0
  26642. * @category Collection
  26643. * @param {Array|Object|string} collection The collection to inspect.
  26644. * @param {*} value The value to search for.
  26645. * @param {number} [fromIndex=0] The index to search from.
  26646. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26647. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26648. * @example
  26649. *
  26650. * _.includes([1, 2, 3], 1);
  26651. * // => true
  26652. *
  26653. * _.includes([1, 2, 3], 1, 2);
  26654. * // => false
  26655. *
  26656. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26657. * // => true
  26658. *
  26659. * _.includes('abcd', 'bc');
  26660. * // => true
  26661. */
  26662. function includes(collection, value, fromIndex, guard) {
  26663. collection = isArrayLike(collection) ? collection : values(collection);
  26664. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26665. var length = collection.length;
  26666. if (fromIndex < 0) {
  26667. fromIndex = nativeMax(length + fromIndex, 0);
  26668. }
  26669. return isString(collection)
  26670. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26671. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26672. }
  26673. /**
  26674. * Invokes the method at `path` of each element in `collection`, returning
  26675. * an array of the results of each invoked method. Any additional arguments
  26676. * are provided to each invoked method. If `path` is a function, it's invoked
  26677. * for, and `this` bound to, each element in `collection`.
  26678. *
  26679. * @static
  26680. * @memberOf _
  26681. * @since 4.0.0
  26682. * @category Collection
  26683. * @param {Array|Object} collection The collection to iterate over.
  26684. * @param {Array|Function|string} path The path of the method to invoke or
  26685. * the function invoked per iteration.
  26686. * @param {...*} [args] The arguments to invoke each method with.
  26687. * @returns {Array} Returns the array of results.
  26688. * @example
  26689. *
  26690. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26691. * // => [[1, 5, 7], [1, 2, 3]]
  26692. *
  26693. * _.invokeMap([123, 456], String.prototype.split, '');
  26694. * // => [['1', '2', '3'], ['4', '5', '6']]
  26695. */
  26696. var invokeMap = baseRest(function(collection, path, args) {
  26697. var index = -1,
  26698. isFunc = typeof path == 'function',
  26699. result = isArrayLike(collection) ? Array(collection.length) : [];
  26700. baseEach(collection, function(value) {
  26701. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26702. });
  26703. return result;
  26704. });
  26705. /**
  26706. * Creates an object composed of keys generated from the results of running
  26707. * each element of `collection` thru `iteratee`. The corresponding value of
  26708. * each key is the last element responsible for generating the key. The
  26709. * iteratee is invoked with one argument: (value).
  26710. *
  26711. * @static
  26712. * @memberOf _
  26713. * @since 4.0.0
  26714. * @category Collection
  26715. * @param {Array|Object} collection The collection to iterate over.
  26716. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26717. * @returns {Object} Returns the composed aggregate object.
  26718. * @example
  26719. *
  26720. * var array = [
  26721. * { 'dir': 'left', 'code': 97 },
  26722. * { 'dir': 'right', 'code': 100 }
  26723. * ];
  26724. *
  26725. * _.keyBy(array, function(o) {
  26726. * return String.fromCharCode(o.code);
  26727. * });
  26728. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26729. *
  26730. * _.keyBy(array, 'dir');
  26731. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26732. */
  26733. var keyBy = createAggregator(function(result, value, key) {
  26734. baseAssignValue(result, key, value);
  26735. });
  26736. /**
  26737. * Creates an array of values by running each element in `collection` thru
  26738. * `iteratee`. The iteratee is invoked with three arguments:
  26739. * (value, index|key, collection).
  26740. *
  26741. * Many lodash methods are guarded to work as iteratees for methods like
  26742. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26743. *
  26744. * The guarded methods are:
  26745. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26746. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26747. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26748. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26749. *
  26750. * @static
  26751. * @memberOf _
  26752. * @since 0.1.0
  26753. * @category Collection
  26754. * @param {Array|Object} collection The collection to iterate over.
  26755. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26756. * @returns {Array} Returns the new mapped array.
  26757. * @example
  26758. *
  26759. * function square(n) {
  26760. * return n * n;
  26761. * }
  26762. *
  26763. * _.map([4, 8], square);
  26764. * // => [16, 64]
  26765. *
  26766. * _.map({ 'a': 4, 'b': 8 }, square);
  26767. * // => [16, 64] (iteration order is not guaranteed)
  26768. *
  26769. * var users = [
  26770. * { 'user': 'barney' },
  26771. * { 'user': 'fred' }
  26772. * ];
  26773. *
  26774. * // The `_.property` iteratee shorthand.
  26775. * _.map(users, 'user');
  26776. * // => ['barney', 'fred']
  26777. */
  26778. function map(collection, iteratee) {
  26779. var func = isArray(collection) ? arrayMap : baseMap;
  26780. return func(collection, getIteratee(iteratee, 3));
  26781. }
  26782. /**
  26783. * This method is like `_.sortBy` except that it allows specifying the sort
  26784. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26785. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26786. * descending or "asc" for ascending sort order of corresponding values.
  26787. *
  26788. * @static
  26789. * @memberOf _
  26790. * @since 4.0.0
  26791. * @category Collection
  26792. * @param {Array|Object} collection The collection to iterate over.
  26793. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26794. * The iteratees to sort by.
  26795. * @param {string[]} [orders] The sort orders of `iteratees`.
  26796. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26797. * @returns {Array} Returns the new sorted array.
  26798. * @example
  26799. *
  26800. * var users = [
  26801. * { 'user': 'fred', 'age': 48 },
  26802. * { 'user': 'barney', 'age': 34 },
  26803. * { 'user': 'fred', 'age': 40 },
  26804. * { 'user': 'barney', 'age': 36 }
  26805. * ];
  26806. *
  26807. * // Sort by `user` in ascending order and by `age` in descending order.
  26808. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26809. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26810. */
  26811. function orderBy(collection, iteratees, orders, guard) {
  26812. if (collection == null) {
  26813. return [];
  26814. }
  26815. if (!isArray(iteratees)) {
  26816. iteratees = iteratees == null ? [] : [iteratees];
  26817. }
  26818. orders = guard ? undefined : orders;
  26819. if (!isArray(orders)) {
  26820. orders = orders == null ? [] : [orders];
  26821. }
  26822. return baseOrderBy(collection, iteratees, orders);
  26823. }
  26824. /**
  26825. * Creates an array of elements split into two groups, the first of which
  26826. * contains elements `predicate` returns truthy for, the second of which
  26827. * contains elements `predicate` returns falsey for. The predicate is
  26828. * invoked with one argument: (value).
  26829. *
  26830. * @static
  26831. * @memberOf _
  26832. * @since 3.0.0
  26833. * @category Collection
  26834. * @param {Array|Object} collection The collection to iterate over.
  26835. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26836. * @returns {Array} Returns the array of grouped elements.
  26837. * @example
  26838. *
  26839. * var users = [
  26840. * { 'user': 'barney', 'age': 36, 'active': false },
  26841. * { 'user': 'fred', 'age': 40, 'active': true },
  26842. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26843. * ];
  26844. *
  26845. * _.partition(users, function(o) { return o.active; });
  26846. * // => objects for [['fred'], ['barney', 'pebbles']]
  26847. *
  26848. * // The `_.matches` iteratee shorthand.
  26849. * _.partition(users, { 'age': 1, 'active': false });
  26850. * // => objects for [['pebbles'], ['barney', 'fred']]
  26851. *
  26852. * // The `_.matchesProperty` iteratee shorthand.
  26853. * _.partition(users, ['active', false]);
  26854. * // => objects for [['barney', 'pebbles'], ['fred']]
  26855. *
  26856. * // The `_.property` iteratee shorthand.
  26857. * _.partition(users, 'active');
  26858. * // => objects for [['fred'], ['barney', 'pebbles']]
  26859. */
  26860. var partition = createAggregator(function(result, value, key) {
  26861. result[key ? 0 : 1].push(value);
  26862. }, function() { return [[], []]; });
  26863. /**
  26864. * Reduces `collection` to a value which is the accumulated result of running
  26865. * each element in `collection` thru `iteratee`, where each successive
  26866. * invocation is supplied the return value of the previous. If `accumulator`
  26867. * is not given, the first element of `collection` is used as the initial
  26868. * value. The iteratee is invoked with four arguments:
  26869. * (accumulator, value, index|key, collection).
  26870. *
  26871. * Many lodash methods are guarded to work as iteratees for methods like
  26872. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26873. *
  26874. * The guarded methods are:
  26875. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26876. * and `sortBy`
  26877. *
  26878. * @static
  26879. * @memberOf _
  26880. * @since 0.1.0
  26881. * @category Collection
  26882. * @param {Array|Object} collection The collection to iterate over.
  26883. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26884. * @param {*} [accumulator] The initial value.
  26885. * @returns {*} Returns the accumulated value.
  26886. * @see _.reduceRight
  26887. * @example
  26888. *
  26889. * _.reduce([1, 2], function(sum, n) {
  26890. * return sum + n;
  26891. * }, 0);
  26892. * // => 3
  26893. *
  26894. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26895. * (result[value] || (result[value] = [])).push(key);
  26896. * return result;
  26897. * }, {});
  26898. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26899. */
  26900. function reduce(collection, iteratee, accumulator) {
  26901. var func = isArray(collection) ? arrayReduce : baseReduce,
  26902. initAccum = arguments.length < 3;
  26903. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26904. }
  26905. /**
  26906. * This method is like `_.reduce` except that it iterates over elements of
  26907. * `collection` from right to left.
  26908. *
  26909. * @static
  26910. * @memberOf _
  26911. * @since 0.1.0
  26912. * @category Collection
  26913. * @param {Array|Object} collection The collection to iterate over.
  26914. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26915. * @param {*} [accumulator] The initial value.
  26916. * @returns {*} Returns the accumulated value.
  26917. * @see _.reduce
  26918. * @example
  26919. *
  26920. * var array = [[0, 1], [2, 3], [4, 5]];
  26921. *
  26922. * _.reduceRight(array, function(flattened, other) {
  26923. * return flattened.concat(other);
  26924. * }, []);
  26925. * // => [4, 5, 2, 3, 0, 1]
  26926. */
  26927. function reduceRight(collection, iteratee, accumulator) {
  26928. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  26929. initAccum = arguments.length < 3;
  26930. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  26931. }
  26932. /**
  26933. * The opposite of `_.filter`; this method returns the elements of `collection`
  26934. * that `predicate` does **not** return truthy for.
  26935. *
  26936. * @static
  26937. * @memberOf _
  26938. * @since 0.1.0
  26939. * @category Collection
  26940. * @param {Array|Object} collection The collection to iterate over.
  26941. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26942. * @returns {Array} Returns the new filtered array.
  26943. * @see _.filter
  26944. * @example
  26945. *
  26946. * var users = [
  26947. * { 'user': 'barney', 'age': 36, 'active': false },
  26948. * { 'user': 'fred', 'age': 40, 'active': true }
  26949. * ];
  26950. *
  26951. * _.reject(users, function(o) { return !o.active; });
  26952. * // => objects for ['fred']
  26953. *
  26954. * // The `_.matches` iteratee shorthand.
  26955. * _.reject(users, { 'age': 40, 'active': true });
  26956. * // => objects for ['barney']
  26957. *
  26958. * // The `_.matchesProperty` iteratee shorthand.
  26959. * _.reject(users, ['active', false]);
  26960. * // => objects for ['fred']
  26961. *
  26962. * // The `_.property` iteratee shorthand.
  26963. * _.reject(users, 'active');
  26964. * // => objects for ['barney']
  26965. */
  26966. function reject(collection, predicate) {
  26967. var func = isArray(collection) ? arrayFilter : baseFilter;
  26968. return func(collection, negate(getIteratee(predicate, 3)));
  26969. }
  26970. /**
  26971. * Gets a random element from `collection`.
  26972. *
  26973. * @static
  26974. * @memberOf _
  26975. * @since 2.0.0
  26976. * @category Collection
  26977. * @param {Array|Object} collection The collection to sample.
  26978. * @returns {*} Returns the random element.
  26979. * @example
  26980. *
  26981. * _.sample([1, 2, 3, 4]);
  26982. * // => 2
  26983. */
  26984. function sample(collection) {
  26985. var func = isArray(collection) ? arraySample : baseSample;
  26986. return func(collection);
  26987. }
  26988. /**
  26989. * Gets `n` random elements at unique keys from `collection` up to the
  26990. * size of `collection`.
  26991. *
  26992. * @static
  26993. * @memberOf _
  26994. * @since 4.0.0
  26995. * @category Collection
  26996. * @param {Array|Object} collection The collection to sample.
  26997. * @param {number} [n=1] The number of elements to sample.
  26998. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26999. * @returns {Array} Returns the random elements.
  27000. * @example
  27001. *
  27002. * _.sampleSize([1, 2, 3], 2);
  27003. * // => [3, 1]
  27004. *
  27005. * _.sampleSize([1, 2, 3], 4);
  27006. * // => [2, 3, 1]
  27007. */
  27008. function sampleSize(collection, n, guard) {
  27009. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27010. n = 1;
  27011. } else {
  27012. n = toInteger(n);
  27013. }
  27014. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27015. return func(collection, n);
  27016. }
  27017. /**
  27018. * Creates an array of shuffled values, using a version of the
  27019. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27020. *
  27021. * @static
  27022. * @memberOf _
  27023. * @since 0.1.0
  27024. * @category Collection
  27025. * @param {Array|Object} collection The collection to shuffle.
  27026. * @returns {Array} Returns the new shuffled array.
  27027. * @example
  27028. *
  27029. * _.shuffle([1, 2, 3, 4]);
  27030. * // => [4, 1, 3, 2]
  27031. */
  27032. function shuffle(collection) {
  27033. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27034. return func(collection);
  27035. }
  27036. /**
  27037. * Gets the size of `collection` by returning its length for array-like
  27038. * values or the number of own enumerable string keyed properties for objects.
  27039. *
  27040. * @static
  27041. * @memberOf _
  27042. * @since 0.1.0
  27043. * @category Collection
  27044. * @param {Array|Object|string} collection The collection to inspect.
  27045. * @returns {number} Returns the collection size.
  27046. * @example
  27047. *
  27048. * _.size([1, 2, 3]);
  27049. * // => 3
  27050. *
  27051. * _.size({ 'a': 1, 'b': 2 });
  27052. * // => 2
  27053. *
  27054. * _.size('pebbles');
  27055. * // => 7
  27056. */
  27057. function size(collection) {
  27058. if (collection == null) {
  27059. return 0;
  27060. }
  27061. if (isArrayLike(collection)) {
  27062. return isString(collection) ? stringSize(collection) : collection.length;
  27063. }
  27064. var tag = getTag(collection);
  27065. if (tag == mapTag || tag == setTag) {
  27066. return collection.size;
  27067. }
  27068. return baseKeys(collection).length;
  27069. }
  27070. /**
  27071. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27072. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27073. * invoked with three arguments: (value, index|key, collection).
  27074. *
  27075. * @static
  27076. * @memberOf _
  27077. * @since 0.1.0
  27078. * @category Collection
  27079. * @param {Array|Object} collection The collection to iterate over.
  27080. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27081. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27082. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27083. * else `false`.
  27084. * @example
  27085. *
  27086. * _.some([null, 0, 'yes', false], Boolean);
  27087. * // => true
  27088. *
  27089. * var users = [
  27090. * { 'user': 'barney', 'active': true },
  27091. * { 'user': 'fred', 'active': false }
  27092. * ];
  27093. *
  27094. * // The `_.matches` iteratee shorthand.
  27095. * _.some(users, { 'user': 'barney', 'active': false });
  27096. * // => false
  27097. *
  27098. * // The `_.matchesProperty` iteratee shorthand.
  27099. * _.some(users, ['active', false]);
  27100. * // => true
  27101. *
  27102. * // The `_.property` iteratee shorthand.
  27103. * _.some(users, 'active');
  27104. * // => true
  27105. */
  27106. function some(collection, predicate, guard) {
  27107. var func = isArray(collection) ? arraySome : baseSome;
  27108. if (guard && isIterateeCall(collection, predicate, guard)) {
  27109. predicate = undefined;
  27110. }
  27111. return func(collection, getIteratee(predicate, 3));
  27112. }
  27113. /**
  27114. * Creates an array of elements, sorted in ascending order by the results of
  27115. * running each element in a collection thru each iteratee. This method
  27116. * performs a stable sort, that is, it preserves the original sort order of
  27117. * equal elements. The iteratees are invoked with one argument: (value).
  27118. *
  27119. * @static
  27120. * @memberOf _
  27121. * @since 0.1.0
  27122. * @category Collection
  27123. * @param {Array|Object} collection The collection to iterate over.
  27124. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27125. * The iteratees to sort by.
  27126. * @returns {Array} Returns the new sorted array.
  27127. * @example
  27128. *
  27129. * var users = [
  27130. * { 'user': 'fred', 'age': 48 },
  27131. * { 'user': 'barney', 'age': 36 },
  27132. * { 'user': 'fred', 'age': 40 },
  27133. * { 'user': 'barney', 'age': 34 }
  27134. * ];
  27135. *
  27136. * _.sortBy(users, [function(o) { return o.user; }]);
  27137. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27138. *
  27139. * _.sortBy(users, ['user', 'age']);
  27140. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27141. */
  27142. var sortBy = baseRest(function(collection, iteratees) {
  27143. if (collection == null) {
  27144. return [];
  27145. }
  27146. var length = iteratees.length;
  27147. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27148. iteratees = [];
  27149. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27150. iteratees = [iteratees[0]];
  27151. }
  27152. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27153. });
  27154. /*------------------------------------------------------------------------*/
  27155. /**
  27156. * Gets the timestamp of the number of milliseconds that have elapsed since
  27157. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27158. *
  27159. * @static
  27160. * @memberOf _
  27161. * @since 2.4.0
  27162. * @category Date
  27163. * @returns {number} Returns the timestamp.
  27164. * @example
  27165. *
  27166. * _.defer(function(stamp) {
  27167. * console.log(_.now() - stamp);
  27168. * }, _.now());
  27169. * // => Logs the number of milliseconds it took for the deferred invocation.
  27170. */
  27171. var now = ctxNow || function() {
  27172. return root.Date.now();
  27173. };
  27174. /*------------------------------------------------------------------------*/
  27175. /**
  27176. * The opposite of `_.before`; this method creates a function that invokes
  27177. * `func` once it's called `n` or more times.
  27178. *
  27179. * @static
  27180. * @memberOf _
  27181. * @since 0.1.0
  27182. * @category Function
  27183. * @param {number} n The number of calls before `func` is invoked.
  27184. * @param {Function} func The function to restrict.
  27185. * @returns {Function} Returns the new restricted function.
  27186. * @example
  27187. *
  27188. * var saves = ['profile', 'settings'];
  27189. *
  27190. * var done = _.after(saves.length, function() {
  27191. * console.log('done saving!');
  27192. * });
  27193. *
  27194. * _.forEach(saves, function(type) {
  27195. * asyncSave({ 'type': type, 'complete': done });
  27196. * });
  27197. * // => Logs 'done saving!' after the two async saves have completed.
  27198. */
  27199. function after(n, func) {
  27200. if (typeof func != 'function') {
  27201. throw new TypeError(FUNC_ERROR_TEXT);
  27202. }
  27203. n = toInteger(n);
  27204. return function() {
  27205. if (--n < 1) {
  27206. return func.apply(this, arguments);
  27207. }
  27208. };
  27209. }
  27210. /**
  27211. * Creates a function that invokes `func`, with up to `n` arguments,
  27212. * ignoring any additional arguments.
  27213. *
  27214. * @static
  27215. * @memberOf _
  27216. * @since 3.0.0
  27217. * @category Function
  27218. * @param {Function} func The function to cap arguments for.
  27219. * @param {number} [n=func.length] The arity cap.
  27220. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27221. * @returns {Function} Returns the new capped function.
  27222. * @example
  27223. *
  27224. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27225. * // => [6, 8, 10]
  27226. */
  27227. function ary(func, n, guard) {
  27228. n = guard ? undefined : n;
  27229. n = (func && n == null) ? func.length : n;
  27230. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27231. }
  27232. /**
  27233. * Creates a function that invokes `func`, with the `this` binding and arguments
  27234. * of the created function, while it's called less than `n` times. Subsequent
  27235. * calls to the created function return the result of the last `func` invocation.
  27236. *
  27237. * @static
  27238. * @memberOf _
  27239. * @since 3.0.0
  27240. * @category Function
  27241. * @param {number} n The number of calls at which `func` is no longer invoked.
  27242. * @param {Function} func The function to restrict.
  27243. * @returns {Function} Returns the new restricted function.
  27244. * @example
  27245. *
  27246. * jQuery(element).on('click', _.before(5, addContactToList));
  27247. * // => Allows adding up to 4 contacts to the list.
  27248. */
  27249. function before(n, func) {
  27250. var result;
  27251. if (typeof func != 'function') {
  27252. throw new TypeError(FUNC_ERROR_TEXT);
  27253. }
  27254. n = toInteger(n);
  27255. return function() {
  27256. if (--n > 0) {
  27257. result = func.apply(this, arguments);
  27258. }
  27259. if (n <= 1) {
  27260. func = undefined;
  27261. }
  27262. return result;
  27263. };
  27264. }
  27265. /**
  27266. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27267. * and `partials` prepended to the arguments it receives.
  27268. *
  27269. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27270. * may be used as a placeholder for partially applied arguments.
  27271. *
  27272. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27273. * property of bound functions.
  27274. *
  27275. * @static
  27276. * @memberOf _
  27277. * @since 0.1.0
  27278. * @category Function
  27279. * @param {Function} func The function to bind.
  27280. * @param {*} thisArg The `this` binding of `func`.
  27281. * @param {...*} [partials] The arguments to be partially applied.
  27282. * @returns {Function} Returns the new bound function.
  27283. * @example
  27284. *
  27285. * function greet(greeting, punctuation) {
  27286. * return greeting + ' ' + this.user + punctuation;
  27287. * }
  27288. *
  27289. * var object = { 'user': 'fred' };
  27290. *
  27291. * var bound = _.bind(greet, object, 'hi');
  27292. * bound('!');
  27293. * // => 'hi fred!'
  27294. *
  27295. * // Bound with placeholders.
  27296. * var bound = _.bind(greet, object, _, '!');
  27297. * bound('hi');
  27298. * // => 'hi fred!'
  27299. */
  27300. var bind = baseRest(function(func, thisArg, partials) {
  27301. var bitmask = WRAP_BIND_FLAG;
  27302. if (partials.length) {
  27303. var holders = replaceHolders(partials, getHolder(bind));
  27304. bitmask |= WRAP_PARTIAL_FLAG;
  27305. }
  27306. return createWrap(func, bitmask, thisArg, partials, holders);
  27307. });
  27308. /**
  27309. * Creates a function that invokes the method at `object[key]` with `partials`
  27310. * prepended to the arguments it receives.
  27311. *
  27312. * This method differs from `_.bind` by allowing bound functions to reference
  27313. * methods that may be redefined or don't yet exist. See
  27314. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27315. * for more details.
  27316. *
  27317. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27318. * builds, may be used as a placeholder for partially applied arguments.
  27319. *
  27320. * @static
  27321. * @memberOf _
  27322. * @since 0.10.0
  27323. * @category Function
  27324. * @param {Object} object The object to invoke the method on.
  27325. * @param {string} key The key of the method.
  27326. * @param {...*} [partials] The arguments to be partially applied.
  27327. * @returns {Function} Returns the new bound function.
  27328. * @example
  27329. *
  27330. * var object = {
  27331. * 'user': 'fred',
  27332. * 'greet': function(greeting, punctuation) {
  27333. * return greeting + ' ' + this.user + punctuation;
  27334. * }
  27335. * };
  27336. *
  27337. * var bound = _.bindKey(object, 'greet', 'hi');
  27338. * bound('!');
  27339. * // => 'hi fred!'
  27340. *
  27341. * object.greet = function(greeting, punctuation) {
  27342. * return greeting + 'ya ' + this.user + punctuation;
  27343. * };
  27344. *
  27345. * bound('!');
  27346. * // => 'hiya fred!'
  27347. *
  27348. * // Bound with placeholders.
  27349. * var bound = _.bindKey(object, 'greet', _, '!');
  27350. * bound('hi');
  27351. * // => 'hiya fred!'
  27352. */
  27353. var bindKey = baseRest(function(object, key, partials) {
  27354. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27355. if (partials.length) {
  27356. var holders = replaceHolders(partials, getHolder(bindKey));
  27357. bitmask |= WRAP_PARTIAL_FLAG;
  27358. }
  27359. return createWrap(key, bitmask, object, partials, holders);
  27360. });
  27361. /**
  27362. * Creates a function that accepts arguments of `func` and either invokes
  27363. * `func` returning its result, if at least `arity` number of arguments have
  27364. * been provided, or returns a function that accepts the remaining `func`
  27365. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27366. * is not sufficient.
  27367. *
  27368. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27369. * may be used as a placeholder for provided arguments.
  27370. *
  27371. * **Note:** This method doesn't set the "length" property of curried functions.
  27372. *
  27373. * @static
  27374. * @memberOf _
  27375. * @since 2.0.0
  27376. * @category Function
  27377. * @param {Function} func The function to curry.
  27378. * @param {number} [arity=func.length] The arity of `func`.
  27379. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27380. * @returns {Function} Returns the new curried function.
  27381. * @example
  27382. *
  27383. * var abc = function(a, b, c) {
  27384. * return [a, b, c];
  27385. * };
  27386. *
  27387. * var curried = _.curry(abc);
  27388. *
  27389. * curried(1)(2)(3);
  27390. * // => [1, 2, 3]
  27391. *
  27392. * curried(1, 2)(3);
  27393. * // => [1, 2, 3]
  27394. *
  27395. * curried(1, 2, 3);
  27396. * // => [1, 2, 3]
  27397. *
  27398. * // Curried with placeholders.
  27399. * curried(1)(_, 3)(2);
  27400. * // => [1, 2, 3]
  27401. */
  27402. function curry(func, arity, guard) {
  27403. arity = guard ? undefined : arity;
  27404. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27405. result.placeholder = curry.placeholder;
  27406. return result;
  27407. }
  27408. /**
  27409. * This method is like `_.curry` except that arguments are applied to `func`
  27410. * in the manner of `_.partialRight` instead of `_.partial`.
  27411. *
  27412. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27413. * builds, may be used as a placeholder for provided arguments.
  27414. *
  27415. * **Note:** This method doesn't set the "length" property of curried functions.
  27416. *
  27417. * @static
  27418. * @memberOf _
  27419. * @since 3.0.0
  27420. * @category Function
  27421. * @param {Function} func The function to curry.
  27422. * @param {number} [arity=func.length] The arity of `func`.
  27423. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27424. * @returns {Function} Returns the new curried function.
  27425. * @example
  27426. *
  27427. * var abc = function(a, b, c) {
  27428. * return [a, b, c];
  27429. * };
  27430. *
  27431. * var curried = _.curryRight(abc);
  27432. *
  27433. * curried(3)(2)(1);
  27434. * // => [1, 2, 3]
  27435. *
  27436. * curried(2, 3)(1);
  27437. * // => [1, 2, 3]
  27438. *
  27439. * curried(1, 2, 3);
  27440. * // => [1, 2, 3]
  27441. *
  27442. * // Curried with placeholders.
  27443. * curried(3)(1, _)(2);
  27444. * // => [1, 2, 3]
  27445. */
  27446. function curryRight(func, arity, guard) {
  27447. arity = guard ? undefined : arity;
  27448. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27449. result.placeholder = curryRight.placeholder;
  27450. return result;
  27451. }
  27452. /**
  27453. * Creates a debounced function that delays invoking `func` until after `wait`
  27454. * milliseconds have elapsed since the last time the debounced function was
  27455. * invoked. The debounced function comes with a `cancel` method to cancel
  27456. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27457. * Provide `options` to indicate whether `func` should be invoked on the
  27458. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27459. * with the last arguments provided to the debounced function. Subsequent
  27460. * calls to the debounced function return the result of the last `func`
  27461. * invocation.
  27462. *
  27463. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27464. * invoked on the trailing edge of the timeout only if the debounced function
  27465. * is invoked more than once during the `wait` timeout.
  27466. *
  27467. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27468. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27469. *
  27470. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27471. * for details over the differences between `_.debounce` and `_.throttle`.
  27472. *
  27473. * @static
  27474. * @memberOf _
  27475. * @since 0.1.0
  27476. * @category Function
  27477. * @param {Function} func The function to debounce.
  27478. * @param {number} [wait=0] The number of milliseconds to delay.
  27479. * @param {Object} [options={}] The options object.
  27480. * @param {boolean} [options.leading=false]
  27481. * Specify invoking on the leading edge of the timeout.
  27482. * @param {number} [options.maxWait]
  27483. * The maximum time `func` is allowed to be delayed before it's invoked.
  27484. * @param {boolean} [options.trailing=true]
  27485. * Specify invoking on the trailing edge of the timeout.
  27486. * @returns {Function} Returns the new debounced function.
  27487. * @example
  27488. *
  27489. * // Avoid costly calculations while the window size is in flux.
  27490. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27491. *
  27492. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27493. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27494. * 'leading': true,
  27495. * 'trailing': false
  27496. * }));
  27497. *
  27498. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27499. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27500. * var source = new EventSource('/stream');
  27501. * jQuery(source).on('message', debounced);
  27502. *
  27503. * // Cancel the trailing debounced invocation.
  27504. * jQuery(window).on('popstate', debounced.cancel);
  27505. */
  27506. function debounce(func, wait, options) {
  27507. var lastArgs,
  27508. lastThis,
  27509. maxWait,
  27510. result,
  27511. timerId,
  27512. lastCallTime,
  27513. lastInvokeTime = 0,
  27514. leading = false,
  27515. maxing = false,
  27516. trailing = true;
  27517. if (typeof func != 'function') {
  27518. throw new TypeError(FUNC_ERROR_TEXT);
  27519. }
  27520. wait = toNumber(wait) || 0;
  27521. if (isObject(options)) {
  27522. leading = !!options.leading;
  27523. maxing = 'maxWait' in options;
  27524. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27525. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27526. }
  27527. function invokeFunc(time) {
  27528. var args = lastArgs,
  27529. thisArg = lastThis;
  27530. lastArgs = lastThis = undefined;
  27531. lastInvokeTime = time;
  27532. result = func.apply(thisArg, args);
  27533. return result;
  27534. }
  27535. function leadingEdge(time) {
  27536. // Reset any `maxWait` timer.
  27537. lastInvokeTime = time;
  27538. // Start the timer for the trailing edge.
  27539. timerId = setTimeout(timerExpired, wait);
  27540. // Invoke the leading edge.
  27541. return leading ? invokeFunc(time) : result;
  27542. }
  27543. function remainingWait(time) {
  27544. var timeSinceLastCall = time - lastCallTime,
  27545. timeSinceLastInvoke = time - lastInvokeTime,
  27546. timeWaiting = wait - timeSinceLastCall;
  27547. return maxing
  27548. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27549. : timeWaiting;
  27550. }
  27551. function shouldInvoke(time) {
  27552. var timeSinceLastCall = time - lastCallTime,
  27553. timeSinceLastInvoke = time - lastInvokeTime;
  27554. // Either this is the first call, activity has stopped and we're at the
  27555. // trailing edge, the system time has gone backwards and we're treating
  27556. // it as the trailing edge, or we've hit the `maxWait` limit.
  27557. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27558. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27559. }
  27560. function timerExpired() {
  27561. var time = now();
  27562. if (shouldInvoke(time)) {
  27563. return trailingEdge(time);
  27564. }
  27565. // Restart the timer.
  27566. timerId = setTimeout(timerExpired, remainingWait(time));
  27567. }
  27568. function trailingEdge(time) {
  27569. timerId = undefined;
  27570. // Only invoke if we have `lastArgs` which means `func` has been
  27571. // debounced at least once.
  27572. if (trailing && lastArgs) {
  27573. return invokeFunc(time);
  27574. }
  27575. lastArgs = lastThis = undefined;
  27576. return result;
  27577. }
  27578. function cancel() {
  27579. if (timerId !== undefined) {
  27580. clearTimeout(timerId);
  27581. }
  27582. lastInvokeTime = 0;
  27583. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27584. }
  27585. function flush() {
  27586. return timerId === undefined ? result : trailingEdge(now());
  27587. }
  27588. function debounced() {
  27589. var time = now(),
  27590. isInvoking = shouldInvoke(time);
  27591. lastArgs = arguments;
  27592. lastThis = this;
  27593. lastCallTime = time;
  27594. if (isInvoking) {
  27595. if (timerId === undefined) {
  27596. return leadingEdge(lastCallTime);
  27597. }
  27598. if (maxing) {
  27599. // Handle invocations in a tight loop.
  27600. clearTimeout(timerId);
  27601. timerId = setTimeout(timerExpired, wait);
  27602. return invokeFunc(lastCallTime);
  27603. }
  27604. }
  27605. if (timerId === undefined) {
  27606. timerId = setTimeout(timerExpired, wait);
  27607. }
  27608. return result;
  27609. }
  27610. debounced.cancel = cancel;
  27611. debounced.flush = flush;
  27612. return debounced;
  27613. }
  27614. /**
  27615. * Defers invoking the `func` until the current call stack has cleared. Any
  27616. * additional arguments are provided to `func` when it's invoked.
  27617. *
  27618. * @static
  27619. * @memberOf _
  27620. * @since 0.1.0
  27621. * @category Function
  27622. * @param {Function} func The function to defer.
  27623. * @param {...*} [args] The arguments to invoke `func` with.
  27624. * @returns {number} Returns the timer id.
  27625. * @example
  27626. *
  27627. * _.defer(function(text) {
  27628. * console.log(text);
  27629. * }, 'deferred');
  27630. * // => Logs 'deferred' after one millisecond.
  27631. */
  27632. var defer = baseRest(function(func, args) {
  27633. return baseDelay(func, 1, args);
  27634. });
  27635. /**
  27636. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27637. * provided to `func` when it's invoked.
  27638. *
  27639. * @static
  27640. * @memberOf _
  27641. * @since 0.1.0
  27642. * @category Function
  27643. * @param {Function} func The function to delay.
  27644. * @param {number} wait The number of milliseconds to delay invocation.
  27645. * @param {...*} [args] The arguments to invoke `func` with.
  27646. * @returns {number} Returns the timer id.
  27647. * @example
  27648. *
  27649. * _.delay(function(text) {
  27650. * console.log(text);
  27651. * }, 1000, 'later');
  27652. * // => Logs 'later' after one second.
  27653. */
  27654. var delay = baseRest(function(func, wait, args) {
  27655. return baseDelay(func, toNumber(wait) || 0, args);
  27656. });
  27657. /**
  27658. * Creates a function that invokes `func` with arguments reversed.
  27659. *
  27660. * @static
  27661. * @memberOf _
  27662. * @since 4.0.0
  27663. * @category Function
  27664. * @param {Function} func The function to flip arguments for.
  27665. * @returns {Function} Returns the new flipped function.
  27666. * @example
  27667. *
  27668. * var flipped = _.flip(function() {
  27669. * return _.toArray(arguments);
  27670. * });
  27671. *
  27672. * flipped('a', 'b', 'c', 'd');
  27673. * // => ['d', 'c', 'b', 'a']
  27674. */
  27675. function flip(func) {
  27676. return createWrap(func, WRAP_FLIP_FLAG);
  27677. }
  27678. /**
  27679. * Creates a function that memoizes the result of `func`. If `resolver` is
  27680. * provided, it determines the cache key for storing the result based on the
  27681. * arguments provided to the memoized function. By default, the first argument
  27682. * provided to the memoized function is used as the map cache key. The `func`
  27683. * is invoked with the `this` binding of the memoized function.
  27684. *
  27685. * **Note:** The cache is exposed as the `cache` property on the memoized
  27686. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27687. * constructor with one whose instances implement the
  27688. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27689. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27690. *
  27691. * @static
  27692. * @memberOf _
  27693. * @since 0.1.0
  27694. * @category Function
  27695. * @param {Function} func The function to have its output memoized.
  27696. * @param {Function} [resolver] The function to resolve the cache key.
  27697. * @returns {Function} Returns the new memoized function.
  27698. * @example
  27699. *
  27700. * var object = { 'a': 1, 'b': 2 };
  27701. * var other = { 'c': 3, 'd': 4 };
  27702. *
  27703. * var values = _.memoize(_.values);
  27704. * values(object);
  27705. * // => [1, 2]
  27706. *
  27707. * values(other);
  27708. * // => [3, 4]
  27709. *
  27710. * object.a = 2;
  27711. * values(object);
  27712. * // => [1, 2]
  27713. *
  27714. * // Modify the result cache.
  27715. * values.cache.set(object, ['a', 'b']);
  27716. * values(object);
  27717. * // => ['a', 'b']
  27718. *
  27719. * // Replace `_.memoize.Cache`.
  27720. * _.memoize.Cache = WeakMap;
  27721. */
  27722. function memoize(func, resolver) {
  27723. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27724. throw new TypeError(FUNC_ERROR_TEXT);
  27725. }
  27726. var memoized = function() {
  27727. var args = arguments,
  27728. key = resolver ? resolver.apply(this, args) : args[0],
  27729. cache = memoized.cache;
  27730. if (cache.has(key)) {
  27731. return cache.get(key);
  27732. }
  27733. var result = func.apply(this, args);
  27734. memoized.cache = cache.set(key, result) || cache;
  27735. return result;
  27736. };
  27737. memoized.cache = new (memoize.Cache || MapCache);
  27738. return memoized;
  27739. }
  27740. // Expose `MapCache`.
  27741. memoize.Cache = MapCache;
  27742. /**
  27743. * Creates a function that negates the result of the predicate `func`. The
  27744. * `func` predicate is invoked with the `this` binding and arguments of the
  27745. * created function.
  27746. *
  27747. * @static
  27748. * @memberOf _
  27749. * @since 3.0.0
  27750. * @category Function
  27751. * @param {Function} predicate The predicate to negate.
  27752. * @returns {Function} Returns the new negated function.
  27753. * @example
  27754. *
  27755. * function isEven(n) {
  27756. * return n % 2 == 0;
  27757. * }
  27758. *
  27759. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27760. * // => [1, 3, 5]
  27761. */
  27762. function negate(predicate) {
  27763. if (typeof predicate != 'function') {
  27764. throw new TypeError(FUNC_ERROR_TEXT);
  27765. }
  27766. return function() {
  27767. var args = arguments;
  27768. switch (args.length) {
  27769. case 0: return !predicate.call(this);
  27770. case 1: return !predicate.call(this, args[0]);
  27771. case 2: return !predicate.call(this, args[0], args[1]);
  27772. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27773. }
  27774. return !predicate.apply(this, args);
  27775. };
  27776. }
  27777. /**
  27778. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27779. * to the function return the value of the first invocation. The `func` is
  27780. * invoked with the `this` binding and arguments of the created function.
  27781. *
  27782. * @static
  27783. * @memberOf _
  27784. * @since 0.1.0
  27785. * @category Function
  27786. * @param {Function} func The function to restrict.
  27787. * @returns {Function} Returns the new restricted function.
  27788. * @example
  27789. *
  27790. * var initialize = _.once(createApplication);
  27791. * initialize();
  27792. * initialize();
  27793. * // => `createApplication` is invoked once
  27794. */
  27795. function once(func) {
  27796. return before(2, func);
  27797. }
  27798. /**
  27799. * Creates a function that invokes `func` with its arguments transformed.
  27800. *
  27801. * @static
  27802. * @since 4.0.0
  27803. * @memberOf _
  27804. * @category Function
  27805. * @param {Function} func The function to wrap.
  27806. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27807. * The argument transforms.
  27808. * @returns {Function} Returns the new function.
  27809. * @example
  27810. *
  27811. * function doubled(n) {
  27812. * return n * 2;
  27813. * }
  27814. *
  27815. * function square(n) {
  27816. * return n * n;
  27817. * }
  27818. *
  27819. * var func = _.overArgs(function(x, y) {
  27820. * return [x, y];
  27821. * }, [square, doubled]);
  27822. *
  27823. * func(9, 3);
  27824. * // => [81, 6]
  27825. *
  27826. * func(10, 5);
  27827. * // => [100, 10]
  27828. */
  27829. var overArgs = castRest(function(func, transforms) {
  27830. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27831. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27832. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27833. var funcsLength = transforms.length;
  27834. return baseRest(function(args) {
  27835. var index = -1,
  27836. length = nativeMin(args.length, funcsLength);
  27837. while (++index < length) {
  27838. args[index] = transforms[index].call(this, args[index]);
  27839. }
  27840. return apply(func, this, args);
  27841. });
  27842. });
  27843. /**
  27844. * Creates a function that invokes `func` with `partials` prepended to the
  27845. * arguments it receives. This method is like `_.bind` except it does **not**
  27846. * alter the `this` binding.
  27847. *
  27848. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27849. * builds, may be used as a placeholder for partially applied arguments.
  27850. *
  27851. * **Note:** This method doesn't set the "length" property of partially
  27852. * applied functions.
  27853. *
  27854. * @static
  27855. * @memberOf _
  27856. * @since 0.2.0
  27857. * @category Function
  27858. * @param {Function} func The function to partially apply arguments to.
  27859. * @param {...*} [partials] The arguments to be partially applied.
  27860. * @returns {Function} Returns the new partially applied function.
  27861. * @example
  27862. *
  27863. * function greet(greeting, name) {
  27864. * return greeting + ' ' + name;
  27865. * }
  27866. *
  27867. * var sayHelloTo = _.partial(greet, 'hello');
  27868. * sayHelloTo('fred');
  27869. * // => 'hello fred'
  27870. *
  27871. * // Partially applied with placeholders.
  27872. * var greetFred = _.partial(greet, _, 'fred');
  27873. * greetFred('hi');
  27874. * // => 'hi fred'
  27875. */
  27876. var partial = baseRest(function(func, partials) {
  27877. var holders = replaceHolders(partials, getHolder(partial));
  27878. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27879. });
  27880. /**
  27881. * This method is like `_.partial` except that partially applied arguments
  27882. * are appended to the arguments it receives.
  27883. *
  27884. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27885. * builds, may be used as a placeholder for partially applied arguments.
  27886. *
  27887. * **Note:** This method doesn't set the "length" property of partially
  27888. * applied functions.
  27889. *
  27890. * @static
  27891. * @memberOf _
  27892. * @since 1.0.0
  27893. * @category Function
  27894. * @param {Function} func The function to partially apply arguments to.
  27895. * @param {...*} [partials] The arguments to be partially applied.
  27896. * @returns {Function} Returns the new partially applied function.
  27897. * @example
  27898. *
  27899. * function greet(greeting, name) {
  27900. * return greeting + ' ' + name;
  27901. * }
  27902. *
  27903. * var greetFred = _.partialRight(greet, 'fred');
  27904. * greetFred('hi');
  27905. * // => 'hi fred'
  27906. *
  27907. * // Partially applied with placeholders.
  27908. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27909. * sayHelloTo('fred');
  27910. * // => 'hello fred'
  27911. */
  27912. var partialRight = baseRest(function(func, partials) {
  27913. var holders = replaceHolders(partials, getHolder(partialRight));
  27914. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27915. });
  27916. /**
  27917. * Creates a function that invokes `func` with arguments arranged according
  27918. * to the specified `indexes` where the argument value at the first index is
  27919. * provided as the first argument, the argument value at the second index is
  27920. * provided as the second argument, and so on.
  27921. *
  27922. * @static
  27923. * @memberOf _
  27924. * @since 3.0.0
  27925. * @category Function
  27926. * @param {Function} func The function to rearrange arguments for.
  27927. * @param {...(number|number[])} indexes The arranged argument indexes.
  27928. * @returns {Function} Returns the new function.
  27929. * @example
  27930. *
  27931. * var rearged = _.rearg(function(a, b, c) {
  27932. * return [a, b, c];
  27933. * }, [2, 0, 1]);
  27934. *
  27935. * rearged('b', 'c', 'a')
  27936. * // => ['a', 'b', 'c']
  27937. */
  27938. var rearg = flatRest(function(func, indexes) {
  27939. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  27940. });
  27941. /**
  27942. * Creates a function that invokes `func` with the `this` binding of the
  27943. * created function and arguments from `start` and beyond provided as
  27944. * an array.
  27945. *
  27946. * **Note:** This method is based on the
  27947. * [rest parameter](https://mdn.io/rest_parameters).
  27948. *
  27949. * @static
  27950. * @memberOf _
  27951. * @since 4.0.0
  27952. * @category Function
  27953. * @param {Function} func The function to apply a rest parameter to.
  27954. * @param {number} [start=func.length-1] The start position of the rest parameter.
  27955. * @returns {Function} Returns the new function.
  27956. * @example
  27957. *
  27958. * var say = _.rest(function(what, names) {
  27959. * return what + ' ' + _.initial(names).join(', ') +
  27960. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  27961. * });
  27962. *
  27963. * say('hello', 'fred', 'barney', 'pebbles');
  27964. * // => 'hello fred, barney, & pebbles'
  27965. */
  27966. function rest(func, start) {
  27967. if (typeof func != 'function') {
  27968. throw new TypeError(FUNC_ERROR_TEXT);
  27969. }
  27970. start = start === undefined ? start : toInteger(start);
  27971. return baseRest(func, start);
  27972. }
  27973. /**
  27974. * Creates a function that invokes `func` with the `this` binding of the
  27975. * create function and an array of arguments much like
  27976. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  27977. *
  27978. * **Note:** This method is based on the
  27979. * [spread operator](https://mdn.io/spread_operator).
  27980. *
  27981. * @static
  27982. * @memberOf _
  27983. * @since 3.2.0
  27984. * @category Function
  27985. * @param {Function} func The function to spread arguments over.
  27986. * @param {number} [start=0] The start position of the spread.
  27987. * @returns {Function} Returns the new function.
  27988. * @example
  27989. *
  27990. * var say = _.spread(function(who, what) {
  27991. * return who + ' says ' + what;
  27992. * });
  27993. *
  27994. * say(['fred', 'hello']);
  27995. * // => 'fred says hello'
  27996. *
  27997. * var numbers = Promise.all([
  27998. * Promise.resolve(40),
  27999. * Promise.resolve(36)
  28000. * ]);
  28001. *
  28002. * numbers.then(_.spread(function(x, y) {
  28003. * return x + y;
  28004. * }));
  28005. * // => a Promise of 76
  28006. */
  28007. function spread(func, start) {
  28008. if (typeof func != 'function') {
  28009. throw new TypeError(FUNC_ERROR_TEXT);
  28010. }
  28011. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28012. return baseRest(function(args) {
  28013. var array = args[start],
  28014. otherArgs = castSlice(args, 0, start);
  28015. if (array) {
  28016. arrayPush(otherArgs, array);
  28017. }
  28018. return apply(func, this, otherArgs);
  28019. });
  28020. }
  28021. /**
  28022. * Creates a throttled function that only invokes `func` at most once per
  28023. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28024. * method to cancel delayed `func` invocations and a `flush` method to
  28025. * immediately invoke them. Provide `options` to indicate whether `func`
  28026. * should be invoked on the leading and/or trailing edge of the `wait`
  28027. * timeout. The `func` is invoked with the last arguments provided to the
  28028. * throttled function. Subsequent calls to the throttled function return the
  28029. * result of the last `func` invocation.
  28030. *
  28031. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28032. * invoked on the trailing edge of the timeout only if the throttled function
  28033. * is invoked more than once during the `wait` timeout.
  28034. *
  28035. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28036. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28037. *
  28038. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28039. * for details over the differences between `_.throttle` and `_.debounce`.
  28040. *
  28041. * @static
  28042. * @memberOf _
  28043. * @since 0.1.0
  28044. * @category Function
  28045. * @param {Function} func The function to throttle.
  28046. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28047. * @param {Object} [options={}] The options object.
  28048. * @param {boolean} [options.leading=true]
  28049. * Specify invoking on the leading edge of the timeout.
  28050. * @param {boolean} [options.trailing=true]
  28051. * Specify invoking on the trailing edge of the timeout.
  28052. * @returns {Function} Returns the new throttled function.
  28053. * @example
  28054. *
  28055. * // Avoid excessively updating the position while scrolling.
  28056. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28057. *
  28058. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28059. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28060. * jQuery(element).on('click', throttled);
  28061. *
  28062. * // Cancel the trailing throttled invocation.
  28063. * jQuery(window).on('popstate', throttled.cancel);
  28064. */
  28065. function throttle(func, wait, options) {
  28066. var leading = true,
  28067. trailing = true;
  28068. if (typeof func != 'function') {
  28069. throw new TypeError(FUNC_ERROR_TEXT);
  28070. }
  28071. if (isObject(options)) {
  28072. leading = 'leading' in options ? !!options.leading : leading;
  28073. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28074. }
  28075. return debounce(func, wait, {
  28076. 'leading': leading,
  28077. 'maxWait': wait,
  28078. 'trailing': trailing
  28079. });
  28080. }
  28081. /**
  28082. * Creates a function that accepts up to one argument, ignoring any
  28083. * additional arguments.
  28084. *
  28085. * @static
  28086. * @memberOf _
  28087. * @since 4.0.0
  28088. * @category Function
  28089. * @param {Function} func The function to cap arguments for.
  28090. * @returns {Function} Returns the new capped function.
  28091. * @example
  28092. *
  28093. * _.map(['6', '8', '10'], _.unary(parseInt));
  28094. * // => [6, 8, 10]
  28095. */
  28096. function unary(func) {
  28097. return ary(func, 1);
  28098. }
  28099. /**
  28100. * Creates a function that provides `value` to `wrapper` as its first
  28101. * argument. Any additional arguments provided to the function are appended
  28102. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28103. * binding of the created function.
  28104. *
  28105. * @static
  28106. * @memberOf _
  28107. * @since 0.1.0
  28108. * @category Function
  28109. * @param {*} value The value to wrap.
  28110. * @param {Function} [wrapper=identity] The wrapper function.
  28111. * @returns {Function} Returns the new function.
  28112. * @example
  28113. *
  28114. * var p = _.wrap(_.escape, function(func, text) {
  28115. * return '<p>' + func(text) + '</p>';
  28116. * });
  28117. *
  28118. * p('fred, barney, & pebbles');
  28119. * // => '<p>fred, barney, &amp; pebbles</p>'
  28120. */
  28121. function wrap(value, wrapper) {
  28122. return partial(castFunction(wrapper), value);
  28123. }
  28124. /*------------------------------------------------------------------------*/
  28125. /**
  28126. * Casts `value` as an array if it's not one.
  28127. *
  28128. * @static
  28129. * @memberOf _
  28130. * @since 4.4.0
  28131. * @category Lang
  28132. * @param {*} value The value to inspect.
  28133. * @returns {Array} Returns the cast array.
  28134. * @example
  28135. *
  28136. * _.castArray(1);
  28137. * // => [1]
  28138. *
  28139. * _.castArray({ 'a': 1 });
  28140. * // => [{ 'a': 1 }]
  28141. *
  28142. * _.castArray('abc');
  28143. * // => ['abc']
  28144. *
  28145. * _.castArray(null);
  28146. * // => [null]
  28147. *
  28148. * _.castArray(undefined);
  28149. * // => [undefined]
  28150. *
  28151. * _.castArray();
  28152. * // => []
  28153. *
  28154. * var array = [1, 2, 3];
  28155. * console.log(_.castArray(array) === array);
  28156. * // => true
  28157. */
  28158. function castArray() {
  28159. if (!arguments.length) {
  28160. return [];
  28161. }
  28162. var value = arguments[0];
  28163. return isArray(value) ? value : [value];
  28164. }
  28165. /**
  28166. * Creates a shallow clone of `value`.
  28167. *
  28168. * **Note:** This method is loosely based on the
  28169. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28170. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28171. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28172. * arrays. The own enumerable properties of `arguments` objects are cloned
  28173. * as plain objects. An empty object is returned for uncloneable values such
  28174. * as error objects, functions, DOM nodes, and WeakMaps.
  28175. *
  28176. * @static
  28177. * @memberOf _
  28178. * @since 0.1.0
  28179. * @category Lang
  28180. * @param {*} value The value to clone.
  28181. * @returns {*} Returns the cloned value.
  28182. * @see _.cloneDeep
  28183. * @example
  28184. *
  28185. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28186. *
  28187. * var shallow = _.clone(objects);
  28188. * console.log(shallow[0] === objects[0]);
  28189. * // => true
  28190. */
  28191. function clone(value) {
  28192. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28193. }
  28194. /**
  28195. * This method is like `_.clone` except that it accepts `customizer` which
  28196. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28197. * cloning is handled by the method instead. The `customizer` is invoked with
  28198. * up to four arguments; (value [, index|key, object, stack]).
  28199. *
  28200. * @static
  28201. * @memberOf _
  28202. * @since 4.0.0
  28203. * @category Lang
  28204. * @param {*} value The value to clone.
  28205. * @param {Function} [customizer] The function to customize cloning.
  28206. * @returns {*} Returns the cloned value.
  28207. * @see _.cloneDeepWith
  28208. * @example
  28209. *
  28210. * function customizer(value) {
  28211. * if (_.isElement(value)) {
  28212. * return value.cloneNode(false);
  28213. * }
  28214. * }
  28215. *
  28216. * var el = _.cloneWith(document.body, customizer);
  28217. *
  28218. * console.log(el === document.body);
  28219. * // => false
  28220. * console.log(el.nodeName);
  28221. * // => 'BODY'
  28222. * console.log(el.childNodes.length);
  28223. * // => 0
  28224. */
  28225. function cloneWith(value, customizer) {
  28226. customizer = typeof customizer == 'function' ? customizer : undefined;
  28227. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28228. }
  28229. /**
  28230. * This method is like `_.clone` except that it recursively clones `value`.
  28231. *
  28232. * @static
  28233. * @memberOf _
  28234. * @since 1.0.0
  28235. * @category Lang
  28236. * @param {*} value The value to recursively clone.
  28237. * @returns {*} Returns the deep cloned value.
  28238. * @see _.clone
  28239. * @example
  28240. *
  28241. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28242. *
  28243. * var deep = _.cloneDeep(objects);
  28244. * console.log(deep[0] === objects[0]);
  28245. * // => false
  28246. */
  28247. function cloneDeep(value) {
  28248. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28249. }
  28250. /**
  28251. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28252. *
  28253. * @static
  28254. * @memberOf _
  28255. * @since 4.0.0
  28256. * @category Lang
  28257. * @param {*} value The value to recursively clone.
  28258. * @param {Function} [customizer] The function to customize cloning.
  28259. * @returns {*} Returns the deep cloned value.
  28260. * @see _.cloneWith
  28261. * @example
  28262. *
  28263. * function customizer(value) {
  28264. * if (_.isElement(value)) {
  28265. * return value.cloneNode(true);
  28266. * }
  28267. * }
  28268. *
  28269. * var el = _.cloneDeepWith(document.body, customizer);
  28270. *
  28271. * console.log(el === document.body);
  28272. * // => false
  28273. * console.log(el.nodeName);
  28274. * // => 'BODY'
  28275. * console.log(el.childNodes.length);
  28276. * // => 20
  28277. */
  28278. function cloneDeepWith(value, customizer) {
  28279. customizer = typeof customizer == 'function' ? customizer : undefined;
  28280. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28281. }
  28282. /**
  28283. * Checks if `object` conforms to `source` by invoking the predicate
  28284. * properties of `source` with the corresponding property values of `object`.
  28285. *
  28286. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28287. * partially applied.
  28288. *
  28289. * @static
  28290. * @memberOf _
  28291. * @since 4.14.0
  28292. * @category Lang
  28293. * @param {Object} object The object to inspect.
  28294. * @param {Object} source The object of property predicates to conform to.
  28295. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28296. * @example
  28297. *
  28298. * var object = { 'a': 1, 'b': 2 };
  28299. *
  28300. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28301. * // => true
  28302. *
  28303. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28304. * // => false
  28305. */
  28306. function conformsTo(object, source) {
  28307. return source == null || baseConformsTo(object, source, keys(source));
  28308. }
  28309. /**
  28310. * Performs a
  28311. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28312. * comparison between two values to determine if they are equivalent.
  28313. *
  28314. * @static
  28315. * @memberOf _
  28316. * @since 4.0.0
  28317. * @category Lang
  28318. * @param {*} value The value to compare.
  28319. * @param {*} other The other value to compare.
  28320. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28321. * @example
  28322. *
  28323. * var object = { 'a': 1 };
  28324. * var other = { 'a': 1 };
  28325. *
  28326. * _.eq(object, object);
  28327. * // => true
  28328. *
  28329. * _.eq(object, other);
  28330. * // => false
  28331. *
  28332. * _.eq('a', 'a');
  28333. * // => true
  28334. *
  28335. * _.eq('a', Object('a'));
  28336. * // => false
  28337. *
  28338. * _.eq(NaN, NaN);
  28339. * // => true
  28340. */
  28341. function eq(value, other) {
  28342. return value === other || (value !== value && other !== other);
  28343. }
  28344. /**
  28345. * Checks if `value` is greater than `other`.
  28346. *
  28347. * @static
  28348. * @memberOf _
  28349. * @since 3.9.0
  28350. * @category Lang
  28351. * @param {*} value The value to compare.
  28352. * @param {*} other The other value to compare.
  28353. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28354. * else `false`.
  28355. * @see _.lt
  28356. * @example
  28357. *
  28358. * _.gt(3, 1);
  28359. * // => true
  28360. *
  28361. * _.gt(3, 3);
  28362. * // => false
  28363. *
  28364. * _.gt(1, 3);
  28365. * // => false
  28366. */
  28367. var gt = createRelationalOperation(baseGt);
  28368. /**
  28369. * Checks if `value` is greater than or equal to `other`.
  28370. *
  28371. * @static
  28372. * @memberOf _
  28373. * @since 3.9.0
  28374. * @category Lang
  28375. * @param {*} value The value to compare.
  28376. * @param {*} other The other value to compare.
  28377. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28378. * `other`, else `false`.
  28379. * @see _.lte
  28380. * @example
  28381. *
  28382. * _.gte(3, 1);
  28383. * // => true
  28384. *
  28385. * _.gte(3, 3);
  28386. * // => true
  28387. *
  28388. * _.gte(1, 3);
  28389. * // => false
  28390. */
  28391. var gte = createRelationalOperation(function(value, other) {
  28392. return value >= other;
  28393. });
  28394. /**
  28395. * Checks if `value` is likely an `arguments` object.
  28396. *
  28397. * @static
  28398. * @memberOf _
  28399. * @since 0.1.0
  28400. * @category Lang
  28401. * @param {*} value The value to check.
  28402. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28403. * else `false`.
  28404. * @example
  28405. *
  28406. * _.isArguments(function() { return arguments; }());
  28407. * // => true
  28408. *
  28409. * _.isArguments([1, 2, 3]);
  28410. * // => false
  28411. */
  28412. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28413. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28414. !propertyIsEnumerable.call(value, 'callee');
  28415. };
  28416. /**
  28417. * Checks if `value` is classified as an `Array` object.
  28418. *
  28419. * @static
  28420. * @memberOf _
  28421. * @since 0.1.0
  28422. * @category Lang
  28423. * @param {*} value The value to check.
  28424. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28425. * @example
  28426. *
  28427. * _.isArray([1, 2, 3]);
  28428. * // => true
  28429. *
  28430. * _.isArray(document.body.children);
  28431. * // => false
  28432. *
  28433. * _.isArray('abc');
  28434. * // => false
  28435. *
  28436. * _.isArray(_.noop);
  28437. * // => false
  28438. */
  28439. var isArray = Array.isArray;
  28440. /**
  28441. * Checks if `value` is classified as an `ArrayBuffer` object.
  28442. *
  28443. * @static
  28444. * @memberOf _
  28445. * @since 4.3.0
  28446. * @category Lang
  28447. * @param {*} value The value to check.
  28448. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28449. * @example
  28450. *
  28451. * _.isArrayBuffer(new ArrayBuffer(2));
  28452. * // => true
  28453. *
  28454. * _.isArrayBuffer(new Array(2));
  28455. * // => false
  28456. */
  28457. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28458. /**
  28459. * Checks if `value` is array-like. A value is considered array-like if it's
  28460. * not a function and has a `value.length` that's an integer greater than or
  28461. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28462. *
  28463. * @static
  28464. * @memberOf _
  28465. * @since 4.0.0
  28466. * @category Lang
  28467. * @param {*} value The value to check.
  28468. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28469. * @example
  28470. *
  28471. * _.isArrayLike([1, 2, 3]);
  28472. * // => true
  28473. *
  28474. * _.isArrayLike(document.body.children);
  28475. * // => true
  28476. *
  28477. * _.isArrayLike('abc');
  28478. * // => true
  28479. *
  28480. * _.isArrayLike(_.noop);
  28481. * // => false
  28482. */
  28483. function isArrayLike(value) {
  28484. return value != null && isLength(value.length) && !isFunction(value);
  28485. }
  28486. /**
  28487. * This method is like `_.isArrayLike` except that it also checks if `value`
  28488. * is an object.
  28489. *
  28490. * @static
  28491. * @memberOf _
  28492. * @since 4.0.0
  28493. * @category Lang
  28494. * @param {*} value The value to check.
  28495. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28496. * else `false`.
  28497. * @example
  28498. *
  28499. * _.isArrayLikeObject([1, 2, 3]);
  28500. * // => true
  28501. *
  28502. * _.isArrayLikeObject(document.body.children);
  28503. * // => true
  28504. *
  28505. * _.isArrayLikeObject('abc');
  28506. * // => false
  28507. *
  28508. * _.isArrayLikeObject(_.noop);
  28509. * // => false
  28510. */
  28511. function isArrayLikeObject(value) {
  28512. return isObjectLike(value) && isArrayLike(value);
  28513. }
  28514. /**
  28515. * Checks if `value` is classified as a boolean primitive or object.
  28516. *
  28517. * @static
  28518. * @memberOf _
  28519. * @since 0.1.0
  28520. * @category Lang
  28521. * @param {*} value The value to check.
  28522. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28523. * @example
  28524. *
  28525. * _.isBoolean(false);
  28526. * // => true
  28527. *
  28528. * _.isBoolean(null);
  28529. * // => false
  28530. */
  28531. function isBoolean(value) {
  28532. return value === true || value === false ||
  28533. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28534. }
  28535. /**
  28536. * Checks if `value` is a buffer.
  28537. *
  28538. * @static
  28539. * @memberOf _
  28540. * @since 4.3.0
  28541. * @category Lang
  28542. * @param {*} value The value to check.
  28543. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28544. * @example
  28545. *
  28546. * _.isBuffer(new Buffer(2));
  28547. * // => true
  28548. *
  28549. * _.isBuffer(new Uint8Array(2));
  28550. * // => false
  28551. */
  28552. var isBuffer = nativeIsBuffer || stubFalse;
  28553. /**
  28554. * Checks if `value` is classified as a `Date` object.
  28555. *
  28556. * @static
  28557. * @memberOf _
  28558. * @since 0.1.0
  28559. * @category Lang
  28560. * @param {*} value The value to check.
  28561. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28562. * @example
  28563. *
  28564. * _.isDate(new Date);
  28565. * // => true
  28566. *
  28567. * _.isDate('Mon April 23 2012');
  28568. * // => false
  28569. */
  28570. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28571. /**
  28572. * Checks if `value` is likely a DOM element.
  28573. *
  28574. * @static
  28575. * @memberOf _
  28576. * @since 0.1.0
  28577. * @category Lang
  28578. * @param {*} value The value to check.
  28579. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28580. * @example
  28581. *
  28582. * _.isElement(document.body);
  28583. * // => true
  28584. *
  28585. * _.isElement('<body>');
  28586. * // => false
  28587. */
  28588. function isElement(value) {
  28589. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28590. }
  28591. /**
  28592. * Checks if `value` is an empty object, collection, map, or set.
  28593. *
  28594. * Objects are considered empty if they have no own enumerable string keyed
  28595. * properties.
  28596. *
  28597. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28598. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28599. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28600. *
  28601. * @static
  28602. * @memberOf _
  28603. * @since 0.1.0
  28604. * @category Lang
  28605. * @param {*} value The value to check.
  28606. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28607. * @example
  28608. *
  28609. * _.isEmpty(null);
  28610. * // => true
  28611. *
  28612. * _.isEmpty(true);
  28613. * // => true
  28614. *
  28615. * _.isEmpty(1);
  28616. * // => true
  28617. *
  28618. * _.isEmpty([1, 2, 3]);
  28619. * // => false
  28620. *
  28621. * _.isEmpty({ 'a': 1 });
  28622. * // => false
  28623. */
  28624. function isEmpty(value) {
  28625. if (value == null) {
  28626. return true;
  28627. }
  28628. if (isArrayLike(value) &&
  28629. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28630. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28631. return !value.length;
  28632. }
  28633. var tag = getTag(value);
  28634. if (tag == mapTag || tag == setTag) {
  28635. return !value.size;
  28636. }
  28637. if (isPrototype(value)) {
  28638. return !baseKeys(value).length;
  28639. }
  28640. for (var key in value) {
  28641. if (hasOwnProperty.call(value, key)) {
  28642. return false;
  28643. }
  28644. }
  28645. return true;
  28646. }
  28647. /**
  28648. * Performs a deep comparison between two values to determine if they are
  28649. * equivalent.
  28650. *
  28651. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28652. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28653. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28654. * by their own, not inherited, enumerable properties. Functions and DOM
  28655. * nodes are compared by strict equality, i.e. `===`.
  28656. *
  28657. * @static
  28658. * @memberOf _
  28659. * @since 0.1.0
  28660. * @category Lang
  28661. * @param {*} value The value to compare.
  28662. * @param {*} other The other value to compare.
  28663. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28664. * @example
  28665. *
  28666. * var object = { 'a': 1 };
  28667. * var other = { 'a': 1 };
  28668. *
  28669. * _.isEqual(object, other);
  28670. * // => true
  28671. *
  28672. * object === other;
  28673. * // => false
  28674. */
  28675. function isEqual(value, other) {
  28676. return baseIsEqual(value, other);
  28677. }
  28678. /**
  28679. * This method is like `_.isEqual` except that it accepts `customizer` which
  28680. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28681. * are handled by the method instead. The `customizer` is invoked with up to
  28682. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28683. *
  28684. * @static
  28685. * @memberOf _
  28686. * @since 4.0.0
  28687. * @category Lang
  28688. * @param {*} value The value to compare.
  28689. * @param {*} other The other value to compare.
  28690. * @param {Function} [customizer] The function to customize comparisons.
  28691. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28692. * @example
  28693. *
  28694. * function isGreeting(value) {
  28695. * return /^h(?:i|ello)$/.test(value);
  28696. * }
  28697. *
  28698. * function customizer(objValue, othValue) {
  28699. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28700. * return true;
  28701. * }
  28702. * }
  28703. *
  28704. * var array = ['hello', 'goodbye'];
  28705. * var other = ['hi', 'goodbye'];
  28706. *
  28707. * _.isEqualWith(array, other, customizer);
  28708. * // => true
  28709. */
  28710. function isEqualWith(value, other, customizer) {
  28711. customizer = typeof customizer == 'function' ? customizer : undefined;
  28712. var result = customizer ? customizer(value, other) : undefined;
  28713. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28714. }
  28715. /**
  28716. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28717. * `SyntaxError`, `TypeError`, or `URIError` object.
  28718. *
  28719. * @static
  28720. * @memberOf _
  28721. * @since 3.0.0
  28722. * @category Lang
  28723. * @param {*} value The value to check.
  28724. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28725. * @example
  28726. *
  28727. * _.isError(new Error);
  28728. * // => true
  28729. *
  28730. * _.isError(Error);
  28731. * // => false
  28732. */
  28733. function isError(value) {
  28734. if (!isObjectLike(value)) {
  28735. return false;
  28736. }
  28737. var tag = baseGetTag(value);
  28738. return tag == errorTag || tag == domExcTag ||
  28739. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28740. }
  28741. /**
  28742. * Checks if `value` is a finite primitive number.
  28743. *
  28744. * **Note:** This method is based on
  28745. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28746. *
  28747. * @static
  28748. * @memberOf _
  28749. * @since 0.1.0
  28750. * @category Lang
  28751. * @param {*} value The value to check.
  28752. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28753. * @example
  28754. *
  28755. * _.isFinite(3);
  28756. * // => true
  28757. *
  28758. * _.isFinite(Number.MIN_VALUE);
  28759. * // => true
  28760. *
  28761. * _.isFinite(Infinity);
  28762. * // => false
  28763. *
  28764. * _.isFinite('3');
  28765. * // => false
  28766. */
  28767. function isFinite(value) {
  28768. return typeof value == 'number' && nativeIsFinite(value);
  28769. }
  28770. /**
  28771. * Checks if `value` is classified as a `Function` object.
  28772. *
  28773. * @static
  28774. * @memberOf _
  28775. * @since 0.1.0
  28776. * @category Lang
  28777. * @param {*} value The value to check.
  28778. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28779. * @example
  28780. *
  28781. * _.isFunction(_);
  28782. * // => true
  28783. *
  28784. * _.isFunction(/abc/);
  28785. * // => false
  28786. */
  28787. function isFunction(value) {
  28788. if (!isObject(value)) {
  28789. return false;
  28790. }
  28791. // The use of `Object#toString` avoids issues with the `typeof` operator
  28792. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28793. var tag = baseGetTag(value);
  28794. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28795. }
  28796. /**
  28797. * Checks if `value` is an integer.
  28798. *
  28799. * **Note:** This method is based on
  28800. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28801. *
  28802. * @static
  28803. * @memberOf _
  28804. * @since 4.0.0
  28805. * @category Lang
  28806. * @param {*} value The value to check.
  28807. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28808. * @example
  28809. *
  28810. * _.isInteger(3);
  28811. * // => true
  28812. *
  28813. * _.isInteger(Number.MIN_VALUE);
  28814. * // => false
  28815. *
  28816. * _.isInteger(Infinity);
  28817. * // => false
  28818. *
  28819. * _.isInteger('3');
  28820. * // => false
  28821. */
  28822. function isInteger(value) {
  28823. return typeof value == 'number' && value == toInteger(value);
  28824. }
  28825. /**
  28826. * Checks if `value` is a valid array-like length.
  28827. *
  28828. * **Note:** This method is loosely based on
  28829. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28830. *
  28831. * @static
  28832. * @memberOf _
  28833. * @since 4.0.0
  28834. * @category Lang
  28835. * @param {*} value The value to check.
  28836. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28837. * @example
  28838. *
  28839. * _.isLength(3);
  28840. * // => true
  28841. *
  28842. * _.isLength(Number.MIN_VALUE);
  28843. * // => false
  28844. *
  28845. * _.isLength(Infinity);
  28846. * // => false
  28847. *
  28848. * _.isLength('3');
  28849. * // => false
  28850. */
  28851. function isLength(value) {
  28852. return typeof value == 'number' &&
  28853. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28854. }
  28855. /**
  28856. * Checks if `value` is the
  28857. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28858. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28859. *
  28860. * @static
  28861. * @memberOf _
  28862. * @since 0.1.0
  28863. * @category Lang
  28864. * @param {*} value The value to check.
  28865. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28866. * @example
  28867. *
  28868. * _.isObject({});
  28869. * // => true
  28870. *
  28871. * _.isObject([1, 2, 3]);
  28872. * // => true
  28873. *
  28874. * _.isObject(_.noop);
  28875. * // => true
  28876. *
  28877. * _.isObject(null);
  28878. * // => false
  28879. */
  28880. function isObject(value) {
  28881. var type = typeof value;
  28882. return value != null && (type == 'object' || type == 'function');
  28883. }
  28884. /**
  28885. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28886. * and has a `typeof` result of "object".
  28887. *
  28888. * @static
  28889. * @memberOf _
  28890. * @since 4.0.0
  28891. * @category Lang
  28892. * @param {*} value The value to check.
  28893. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28894. * @example
  28895. *
  28896. * _.isObjectLike({});
  28897. * // => true
  28898. *
  28899. * _.isObjectLike([1, 2, 3]);
  28900. * // => true
  28901. *
  28902. * _.isObjectLike(_.noop);
  28903. * // => false
  28904. *
  28905. * _.isObjectLike(null);
  28906. * // => false
  28907. */
  28908. function isObjectLike(value) {
  28909. return value != null && typeof value == 'object';
  28910. }
  28911. /**
  28912. * Checks if `value` is classified as a `Map` object.
  28913. *
  28914. * @static
  28915. * @memberOf _
  28916. * @since 4.3.0
  28917. * @category Lang
  28918. * @param {*} value The value to check.
  28919. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28920. * @example
  28921. *
  28922. * _.isMap(new Map);
  28923. * // => true
  28924. *
  28925. * _.isMap(new WeakMap);
  28926. * // => false
  28927. */
  28928. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  28929. /**
  28930. * Performs a partial deep comparison between `object` and `source` to
  28931. * determine if `object` contains equivalent property values.
  28932. *
  28933. * **Note:** This method is equivalent to `_.matches` when `source` is
  28934. * partially applied.
  28935. *
  28936. * Partial comparisons will match empty array and empty object `source`
  28937. * values against any array or object value, respectively. See `_.isEqual`
  28938. * for a list of supported value comparisons.
  28939. *
  28940. * @static
  28941. * @memberOf _
  28942. * @since 3.0.0
  28943. * @category Lang
  28944. * @param {Object} object The object to inspect.
  28945. * @param {Object} source The object of property values to match.
  28946. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28947. * @example
  28948. *
  28949. * var object = { 'a': 1, 'b': 2 };
  28950. *
  28951. * _.isMatch(object, { 'b': 2 });
  28952. * // => true
  28953. *
  28954. * _.isMatch(object, { 'b': 1 });
  28955. * // => false
  28956. */
  28957. function isMatch(object, source) {
  28958. return object === source || baseIsMatch(object, source, getMatchData(source));
  28959. }
  28960. /**
  28961. * This method is like `_.isMatch` except that it accepts `customizer` which
  28962. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28963. * are handled by the method instead. The `customizer` is invoked with five
  28964. * arguments: (objValue, srcValue, index|key, object, source).
  28965. *
  28966. * @static
  28967. * @memberOf _
  28968. * @since 4.0.0
  28969. * @category Lang
  28970. * @param {Object} object The object to inspect.
  28971. * @param {Object} source The object of property values to match.
  28972. * @param {Function} [customizer] The function to customize comparisons.
  28973. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28974. * @example
  28975. *
  28976. * function isGreeting(value) {
  28977. * return /^h(?:i|ello)$/.test(value);
  28978. * }
  28979. *
  28980. * function customizer(objValue, srcValue) {
  28981. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  28982. * return true;
  28983. * }
  28984. * }
  28985. *
  28986. * var object = { 'greeting': 'hello' };
  28987. * var source = { 'greeting': 'hi' };
  28988. *
  28989. * _.isMatchWith(object, source, customizer);
  28990. * // => true
  28991. */
  28992. function isMatchWith(object, source, customizer) {
  28993. customizer = typeof customizer == 'function' ? customizer : undefined;
  28994. return baseIsMatch(object, source, getMatchData(source), customizer);
  28995. }
  28996. /**
  28997. * Checks if `value` is `NaN`.
  28998. *
  28999. * **Note:** This method is based on
  29000. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29001. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29002. * `undefined` and other non-number values.
  29003. *
  29004. * @static
  29005. * @memberOf _
  29006. * @since 0.1.0
  29007. * @category Lang
  29008. * @param {*} value The value to check.
  29009. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29010. * @example
  29011. *
  29012. * _.isNaN(NaN);
  29013. * // => true
  29014. *
  29015. * _.isNaN(new Number(NaN));
  29016. * // => true
  29017. *
  29018. * isNaN(undefined);
  29019. * // => true
  29020. *
  29021. * _.isNaN(undefined);
  29022. * // => false
  29023. */
  29024. function isNaN(value) {
  29025. // An `NaN` primitive is the only value that is not equal to itself.
  29026. // Perform the `toStringTag` check first to avoid errors with some
  29027. // ActiveX objects in IE.
  29028. return isNumber(value) && value != +value;
  29029. }
  29030. /**
  29031. * Checks if `value` is a pristine native function.
  29032. *
  29033. * **Note:** This method can't reliably detect native functions in the presence
  29034. * of the core-js package because core-js circumvents this kind of detection.
  29035. * Despite multiple requests, the core-js maintainer has made it clear: any
  29036. * attempt to fix the detection will be obstructed. As a result, we're left
  29037. * with little choice but to throw an error. Unfortunately, this also affects
  29038. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29039. * which rely on core-js.
  29040. *
  29041. * @static
  29042. * @memberOf _
  29043. * @since 3.0.0
  29044. * @category Lang
  29045. * @param {*} value The value to check.
  29046. * @returns {boolean} Returns `true` if `value` is a native function,
  29047. * else `false`.
  29048. * @example
  29049. *
  29050. * _.isNative(Array.prototype.push);
  29051. * // => true
  29052. *
  29053. * _.isNative(_);
  29054. * // => false
  29055. */
  29056. function isNative(value) {
  29057. if (isMaskable(value)) {
  29058. throw new Error(CORE_ERROR_TEXT);
  29059. }
  29060. return baseIsNative(value);
  29061. }
  29062. /**
  29063. * Checks if `value` is `null`.
  29064. *
  29065. * @static
  29066. * @memberOf _
  29067. * @since 0.1.0
  29068. * @category Lang
  29069. * @param {*} value The value to check.
  29070. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29071. * @example
  29072. *
  29073. * _.isNull(null);
  29074. * // => true
  29075. *
  29076. * _.isNull(void 0);
  29077. * // => false
  29078. */
  29079. function isNull(value) {
  29080. return value === null;
  29081. }
  29082. /**
  29083. * Checks if `value` is `null` or `undefined`.
  29084. *
  29085. * @static
  29086. * @memberOf _
  29087. * @since 4.0.0
  29088. * @category Lang
  29089. * @param {*} value The value to check.
  29090. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29091. * @example
  29092. *
  29093. * _.isNil(null);
  29094. * // => true
  29095. *
  29096. * _.isNil(void 0);
  29097. * // => true
  29098. *
  29099. * _.isNil(NaN);
  29100. * // => false
  29101. */
  29102. function isNil(value) {
  29103. return value == null;
  29104. }
  29105. /**
  29106. * Checks if `value` is classified as a `Number` primitive or object.
  29107. *
  29108. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29109. * classified as numbers, use the `_.isFinite` method.
  29110. *
  29111. * @static
  29112. * @memberOf _
  29113. * @since 0.1.0
  29114. * @category Lang
  29115. * @param {*} value The value to check.
  29116. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29117. * @example
  29118. *
  29119. * _.isNumber(3);
  29120. * // => true
  29121. *
  29122. * _.isNumber(Number.MIN_VALUE);
  29123. * // => true
  29124. *
  29125. * _.isNumber(Infinity);
  29126. * // => true
  29127. *
  29128. * _.isNumber('3');
  29129. * // => false
  29130. */
  29131. function isNumber(value) {
  29132. return typeof value == 'number' ||
  29133. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29134. }
  29135. /**
  29136. * Checks if `value` is a plain object, that is, an object created by the
  29137. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29138. *
  29139. * @static
  29140. * @memberOf _
  29141. * @since 0.8.0
  29142. * @category Lang
  29143. * @param {*} value The value to check.
  29144. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29145. * @example
  29146. *
  29147. * function Foo() {
  29148. * this.a = 1;
  29149. * }
  29150. *
  29151. * _.isPlainObject(new Foo);
  29152. * // => false
  29153. *
  29154. * _.isPlainObject([1, 2, 3]);
  29155. * // => false
  29156. *
  29157. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29158. * // => true
  29159. *
  29160. * _.isPlainObject(Object.create(null));
  29161. * // => true
  29162. */
  29163. function isPlainObject(value) {
  29164. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29165. return false;
  29166. }
  29167. var proto = getPrototype(value);
  29168. if (proto === null) {
  29169. return true;
  29170. }
  29171. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29172. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29173. funcToString.call(Ctor) == objectCtorString;
  29174. }
  29175. /**
  29176. * Checks if `value` is classified as a `RegExp` object.
  29177. *
  29178. * @static
  29179. * @memberOf _
  29180. * @since 0.1.0
  29181. * @category Lang
  29182. * @param {*} value The value to check.
  29183. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29184. * @example
  29185. *
  29186. * _.isRegExp(/abc/);
  29187. * // => true
  29188. *
  29189. * _.isRegExp('/abc/');
  29190. * // => false
  29191. */
  29192. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29193. /**
  29194. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29195. * double precision number which isn't the result of a rounded unsafe integer.
  29196. *
  29197. * **Note:** This method is based on
  29198. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29199. *
  29200. * @static
  29201. * @memberOf _
  29202. * @since 4.0.0
  29203. * @category Lang
  29204. * @param {*} value The value to check.
  29205. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29206. * @example
  29207. *
  29208. * _.isSafeInteger(3);
  29209. * // => true
  29210. *
  29211. * _.isSafeInteger(Number.MIN_VALUE);
  29212. * // => false
  29213. *
  29214. * _.isSafeInteger(Infinity);
  29215. * // => false
  29216. *
  29217. * _.isSafeInteger('3');
  29218. * // => false
  29219. */
  29220. function isSafeInteger(value) {
  29221. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29222. }
  29223. /**
  29224. * Checks if `value` is classified as a `Set` object.
  29225. *
  29226. * @static
  29227. * @memberOf _
  29228. * @since 4.3.0
  29229. * @category Lang
  29230. * @param {*} value The value to check.
  29231. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29232. * @example
  29233. *
  29234. * _.isSet(new Set);
  29235. * // => true
  29236. *
  29237. * _.isSet(new WeakSet);
  29238. * // => false
  29239. */
  29240. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29241. /**
  29242. * Checks if `value` is classified as a `String` primitive or object.
  29243. *
  29244. * @static
  29245. * @since 0.1.0
  29246. * @memberOf _
  29247. * @category Lang
  29248. * @param {*} value The value to check.
  29249. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29250. * @example
  29251. *
  29252. * _.isString('abc');
  29253. * // => true
  29254. *
  29255. * _.isString(1);
  29256. * // => false
  29257. */
  29258. function isString(value) {
  29259. return typeof value == 'string' ||
  29260. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29261. }
  29262. /**
  29263. * Checks if `value` is classified as a `Symbol` primitive or object.
  29264. *
  29265. * @static
  29266. * @memberOf _
  29267. * @since 4.0.0
  29268. * @category Lang
  29269. * @param {*} value The value to check.
  29270. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29271. * @example
  29272. *
  29273. * _.isSymbol(Symbol.iterator);
  29274. * // => true
  29275. *
  29276. * _.isSymbol('abc');
  29277. * // => false
  29278. */
  29279. function isSymbol(value) {
  29280. return typeof value == 'symbol' ||
  29281. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29282. }
  29283. /**
  29284. * Checks if `value` is classified as a typed array.
  29285. *
  29286. * @static
  29287. * @memberOf _
  29288. * @since 3.0.0
  29289. * @category Lang
  29290. * @param {*} value The value to check.
  29291. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29292. * @example
  29293. *
  29294. * _.isTypedArray(new Uint8Array);
  29295. * // => true
  29296. *
  29297. * _.isTypedArray([]);
  29298. * // => false
  29299. */
  29300. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29301. /**
  29302. * Checks if `value` is `undefined`.
  29303. *
  29304. * @static
  29305. * @since 0.1.0
  29306. * @memberOf _
  29307. * @category Lang
  29308. * @param {*} value The value to check.
  29309. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29310. * @example
  29311. *
  29312. * _.isUndefined(void 0);
  29313. * // => true
  29314. *
  29315. * _.isUndefined(null);
  29316. * // => false
  29317. */
  29318. function isUndefined(value) {
  29319. return value === undefined;
  29320. }
  29321. /**
  29322. * Checks if `value` is classified as a `WeakMap` object.
  29323. *
  29324. * @static
  29325. * @memberOf _
  29326. * @since 4.3.0
  29327. * @category Lang
  29328. * @param {*} value The value to check.
  29329. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29330. * @example
  29331. *
  29332. * _.isWeakMap(new WeakMap);
  29333. * // => true
  29334. *
  29335. * _.isWeakMap(new Map);
  29336. * // => false
  29337. */
  29338. function isWeakMap(value) {
  29339. return isObjectLike(value) && getTag(value) == weakMapTag;
  29340. }
  29341. /**
  29342. * Checks if `value` is classified as a `WeakSet` object.
  29343. *
  29344. * @static
  29345. * @memberOf _
  29346. * @since 4.3.0
  29347. * @category Lang
  29348. * @param {*} value The value to check.
  29349. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29350. * @example
  29351. *
  29352. * _.isWeakSet(new WeakSet);
  29353. * // => true
  29354. *
  29355. * _.isWeakSet(new Set);
  29356. * // => false
  29357. */
  29358. function isWeakSet(value) {
  29359. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29360. }
  29361. /**
  29362. * Checks if `value` is less than `other`.
  29363. *
  29364. * @static
  29365. * @memberOf _
  29366. * @since 3.9.0
  29367. * @category Lang
  29368. * @param {*} value The value to compare.
  29369. * @param {*} other The other value to compare.
  29370. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29371. * else `false`.
  29372. * @see _.gt
  29373. * @example
  29374. *
  29375. * _.lt(1, 3);
  29376. * // => true
  29377. *
  29378. * _.lt(3, 3);
  29379. * // => false
  29380. *
  29381. * _.lt(3, 1);
  29382. * // => false
  29383. */
  29384. var lt = createRelationalOperation(baseLt);
  29385. /**
  29386. * Checks if `value` is less than or equal to `other`.
  29387. *
  29388. * @static
  29389. * @memberOf _
  29390. * @since 3.9.0
  29391. * @category Lang
  29392. * @param {*} value The value to compare.
  29393. * @param {*} other The other value to compare.
  29394. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29395. * `other`, else `false`.
  29396. * @see _.gte
  29397. * @example
  29398. *
  29399. * _.lte(1, 3);
  29400. * // => true
  29401. *
  29402. * _.lte(3, 3);
  29403. * // => true
  29404. *
  29405. * _.lte(3, 1);
  29406. * // => false
  29407. */
  29408. var lte = createRelationalOperation(function(value, other) {
  29409. return value <= other;
  29410. });
  29411. /**
  29412. * Converts `value` to an array.
  29413. *
  29414. * @static
  29415. * @since 0.1.0
  29416. * @memberOf _
  29417. * @category Lang
  29418. * @param {*} value The value to convert.
  29419. * @returns {Array} Returns the converted array.
  29420. * @example
  29421. *
  29422. * _.toArray({ 'a': 1, 'b': 2 });
  29423. * // => [1, 2]
  29424. *
  29425. * _.toArray('abc');
  29426. * // => ['a', 'b', 'c']
  29427. *
  29428. * _.toArray(1);
  29429. * // => []
  29430. *
  29431. * _.toArray(null);
  29432. * // => []
  29433. */
  29434. function toArray(value) {
  29435. if (!value) {
  29436. return [];
  29437. }
  29438. if (isArrayLike(value)) {
  29439. return isString(value) ? stringToArray(value) : copyArray(value);
  29440. }
  29441. if (symIterator && value[symIterator]) {
  29442. return iteratorToArray(value[symIterator]());
  29443. }
  29444. var tag = getTag(value),
  29445. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29446. return func(value);
  29447. }
  29448. /**
  29449. * Converts `value` to a finite number.
  29450. *
  29451. * @static
  29452. * @memberOf _
  29453. * @since 4.12.0
  29454. * @category Lang
  29455. * @param {*} value The value to convert.
  29456. * @returns {number} Returns the converted number.
  29457. * @example
  29458. *
  29459. * _.toFinite(3.2);
  29460. * // => 3.2
  29461. *
  29462. * _.toFinite(Number.MIN_VALUE);
  29463. * // => 5e-324
  29464. *
  29465. * _.toFinite(Infinity);
  29466. * // => 1.7976931348623157e+308
  29467. *
  29468. * _.toFinite('3.2');
  29469. * // => 3.2
  29470. */
  29471. function toFinite(value) {
  29472. if (!value) {
  29473. return value === 0 ? value : 0;
  29474. }
  29475. value = toNumber(value);
  29476. if (value === INFINITY || value === -INFINITY) {
  29477. var sign = (value < 0 ? -1 : 1);
  29478. return sign * MAX_INTEGER;
  29479. }
  29480. return value === value ? value : 0;
  29481. }
  29482. /**
  29483. * Converts `value` to an integer.
  29484. *
  29485. * **Note:** This method is loosely based on
  29486. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29487. *
  29488. * @static
  29489. * @memberOf _
  29490. * @since 4.0.0
  29491. * @category Lang
  29492. * @param {*} value The value to convert.
  29493. * @returns {number} Returns the converted integer.
  29494. * @example
  29495. *
  29496. * _.toInteger(3.2);
  29497. * // => 3
  29498. *
  29499. * _.toInteger(Number.MIN_VALUE);
  29500. * // => 0
  29501. *
  29502. * _.toInteger(Infinity);
  29503. * // => 1.7976931348623157e+308
  29504. *
  29505. * _.toInteger('3.2');
  29506. * // => 3
  29507. */
  29508. function toInteger(value) {
  29509. var result = toFinite(value),
  29510. remainder = result % 1;
  29511. return result === result ? (remainder ? result - remainder : result) : 0;
  29512. }
  29513. /**
  29514. * Converts `value` to an integer suitable for use as the length of an
  29515. * array-like object.
  29516. *
  29517. * **Note:** This method is based on
  29518. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29519. *
  29520. * @static
  29521. * @memberOf _
  29522. * @since 4.0.0
  29523. * @category Lang
  29524. * @param {*} value The value to convert.
  29525. * @returns {number} Returns the converted integer.
  29526. * @example
  29527. *
  29528. * _.toLength(3.2);
  29529. * // => 3
  29530. *
  29531. * _.toLength(Number.MIN_VALUE);
  29532. * // => 0
  29533. *
  29534. * _.toLength(Infinity);
  29535. * // => 4294967295
  29536. *
  29537. * _.toLength('3.2');
  29538. * // => 3
  29539. */
  29540. function toLength(value) {
  29541. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29542. }
  29543. /**
  29544. * Converts `value` to a number.
  29545. *
  29546. * @static
  29547. * @memberOf _
  29548. * @since 4.0.0
  29549. * @category Lang
  29550. * @param {*} value The value to process.
  29551. * @returns {number} Returns the number.
  29552. * @example
  29553. *
  29554. * _.toNumber(3.2);
  29555. * // => 3.2
  29556. *
  29557. * _.toNumber(Number.MIN_VALUE);
  29558. * // => 5e-324
  29559. *
  29560. * _.toNumber(Infinity);
  29561. * // => Infinity
  29562. *
  29563. * _.toNumber('3.2');
  29564. * // => 3.2
  29565. */
  29566. function toNumber(value) {
  29567. if (typeof value == 'number') {
  29568. return value;
  29569. }
  29570. if (isSymbol(value)) {
  29571. return NAN;
  29572. }
  29573. if (isObject(value)) {
  29574. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29575. value = isObject(other) ? (other + '') : other;
  29576. }
  29577. if (typeof value != 'string') {
  29578. return value === 0 ? value : +value;
  29579. }
  29580. value = value.replace(reTrim, '');
  29581. var isBinary = reIsBinary.test(value);
  29582. return (isBinary || reIsOctal.test(value))
  29583. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29584. : (reIsBadHex.test(value) ? NAN : +value);
  29585. }
  29586. /**
  29587. * Converts `value` to a plain object flattening inherited enumerable string
  29588. * keyed properties of `value` to own properties of the plain object.
  29589. *
  29590. * @static
  29591. * @memberOf _
  29592. * @since 3.0.0
  29593. * @category Lang
  29594. * @param {*} value The value to convert.
  29595. * @returns {Object} Returns the converted plain object.
  29596. * @example
  29597. *
  29598. * function Foo() {
  29599. * this.b = 2;
  29600. * }
  29601. *
  29602. * Foo.prototype.c = 3;
  29603. *
  29604. * _.assign({ 'a': 1 }, new Foo);
  29605. * // => { 'a': 1, 'b': 2 }
  29606. *
  29607. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29608. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29609. */
  29610. function toPlainObject(value) {
  29611. return copyObject(value, keysIn(value));
  29612. }
  29613. /**
  29614. * Converts `value` to a safe integer. A safe integer can be compared and
  29615. * represented correctly.
  29616. *
  29617. * @static
  29618. * @memberOf _
  29619. * @since 4.0.0
  29620. * @category Lang
  29621. * @param {*} value The value to convert.
  29622. * @returns {number} Returns the converted integer.
  29623. * @example
  29624. *
  29625. * _.toSafeInteger(3.2);
  29626. * // => 3
  29627. *
  29628. * _.toSafeInteger(Number.MIN_VALUE);
  29629. * // => 0
  29630. *
  29631. * _.toSafeInteger(Infinity);
  29632. * // => 9007199254740991
  29633. *
  29634. * _.toSafeInteger('3.2');
  29635. * // => 3
  29636. */
  29637. function toSafeInteger(value) {
  29638. return value
  29639. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29640. : (value === 0 ? value : 0);
  29641. }
  29642. /**
  29643. * Converts `value` to a string. An empty string is returned for `null`
  29644. * and `undefined` values. The sign of `-0` is preserved.
  29645. *
  29646. * @static
  29647. * @memberOf _
  29648. * @since 4.0.0
  29649. * @category Lang
  29650. * @param {*} value The value to convert.
  29651. * @returns {string} Returns the converted string.
  29652. * @example
  29653. *
  29654. * _.toString(null);
  29655. * // => ''
  29656. *
  29657. * _.toString(-0);
  29658. * // => '-0'
  29659. *
  29660. * _.toString([1, 2, 3]);
  29661. * // => '1,2,3'
  29662. */
  29663. function toString(value) {
  29664. return value == null ? '' : baseToString(value);
  29665. }
  29666. /*------------------------------------------------------------------------*/
  29667. /**
  29668. * Assigns own enumerable string keyed properties of source objects to the
  29669. * destination object. Source objects are applied from left to right.
  29670. * Subsequent sources overwrite property assignments of previous sources.
  29671. *
  29672. * **Note:** This method mutates `object` and is loosely based on
  29673. * [`Object.assign`](https://mdn.io/Object/assign).
  29674. *
  29675. * @static
  29676. * @memberOf _
  29677. * @since 0.10.0
  29678. * @category Object
  29679. * @param {Object} object The destination object.
  29680. * @param {...Object} [sources] The source objects.
  29681. * @returns {Object} Returns `object`.
  29682. * @see _.assignIn
  29683. * @example
  29684. *
  29685. * function Foo() {
  29686. * this.a = 1;
  29687. * }
  29688. *
  29689. * function Bar() {
  29690. * this.c = 3;
  29691. * }
  29692. *
  29693. * Foo.prototype.b = 2;
  29694. * Bar.prototype.d = 4;
  29695. *
  29696. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29697. * // => { 'a': 1, 'c': 3 }
  29698. */
  29699. var assign = createAssigner(function(object, source) {
  29700. if (isPrototype(source) || isArrayLike(source)) {
  29701. copyObject(source, keys(source), object);
  29702. return;
  29703. }
  29704. for (var key in source) {
  29705. if (hasOwnProperty.call(source, key)) {
  29706. assignValue(object, key, source[key]);
  29707. }
  29708. }
  29709. });
  29710. /**
  29711. * This method is like `_.assign` except that it iterates over own and
  29712. * inherited source properties.
  29713. *
  29714. * **Note:** This method mutates `object`.
  29715. *
  29716. * @static
  29717. * @memberOf _
  29718. * @since 4.0.0
  29719. * @alias extend
  29720. * @category Object
  29721. * @param {Object} object The destination object.
  29722. * @param {...Object} [sources] The source objects.
  29723. * @returns {Object} Returns `object`.
  29724. * @see _.assign
  29725. * @example
  29726. *
  29727. * function Foo() {
  29728. * this.a = 1;
  29729. * }
  29730. *
  29731. * function Bar() {
  29732. * this.c = 3;
  29733. * }
  29734. *
  29735. * Foo.prototype.b = 2;
  29736. * Bar.prototype.d = 4;
  29737. *
  29738. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29739. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29740. */
  29741. var assignIn = createAssigner(function(object, source) {
  29742. copyObject(source, keysIn(source), object);
  29743. });
  29744. /**
  29745. * This method is like `_.assignIn` except that it accepts `customizer`
  29746. * which is invoked to produce the assigned values. If `customizer` returns
  29747. * `undefined`, assignment is handled by the method instead. The `customizer`
  29748. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29749. *
  29750. * **Note:** This method mutates `object`.
  29751. *
  29752. * @static
  29753. * @memberOf _
  29754. * @since 4.0.0
  29755. * @alias extendWith
  29756. * @category Object
  29757. * @param {Object} object The destination object.
  29758. * @param {...Object} sources The source objects.
  29759. * @param {Function} [customizer] The function to customize assigned values.
  29760. * @returns {Object} Returns `object`.
  29761. * @see _.assignWith
  29762. * @example
  29763. *
  29764. * function customizer(objValue, srcValue) {
  29765. * return _.isUndefined(objValue) ? srcValue : objValue;
  29766. * }
  29767. *
  29768. * var defaults = _.partialRight(_.assignInWith, customizer);
  29769. *
  29770. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29771. * // => { 'a': 1, 'b': 2 }
  29772. */
  29773. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29774. copyObject(source, keysIn(source), object, customizer);
  29775. });
  29776. /**
  29777. * This method is like `_.assign` except that it accepts `customizer`
  29778. * which is invoked to produce the assigned values. If `customizer` returns
  29779. * `undefined`, assignment is handled by the method instead. The `customizer`
  29780. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29781. *
  29782. * **Note:** This method mutates `object`.
  29783. *
  29784. * @static
  29785. * @memberOf _
  29786. * @since 4.0.0
  29787. * @category Object
  29788. * @param {Object} object The destination object.
  29789. * @param {...Object} sources The source objects.
  29790. * @param {Function} [customizer] The function to customize assigned values.
  29791. * @returns {Object} Returns `object`.
  29792. * @see _.assignInWith
  29793. * @example
  29794. *
  29795. * function customizer(objValue, srcValue) {
  29796. * return _.isUndefined(objValue) ? srcValue : objValue;
  29797. * }
  29798. *
  29799. * var defaults = _.partialRight(_.assignWith, customizer);
  29800. *
  29801. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29802. * // => { 'a': 1, 'b': 2 }
  29803. */
  29804. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29805. copyObject(source, keys(source), object, customizer);
  29806. });
  29807. /**
  29808. * Creates an array of values corresponding to `paths` of `object`.
  29809. *
  29810. * @static
  29811. * @memberOf _
  29812. * @since 1.0.0
  29813. * @category Object
  29814. * @param {Object} object The object to iterate over.
  29815. * @param {...(string|string[])} [paths] The property paths to pick.
  29816. * @returns {Array} Returns the picked values.
  29817. * @example
  29818. *
  29819. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29820. *
  29821. * _.at(object, ['a[0].b.c', 'a[1]']);
  29822. * // => [3, 4]
  29823. */
  29824. var at = flatRest(baseAt);
  29825. /**
  29826. * Creates an object that inherits from the `prototype` object. If a
  29827. * `properties` object is given, its own enumerable string keyed properties
  29828. * are assigned to the created object.
  29829. *
  29830. * @static
  29831. * @memberOf _
  29832. * @since 2.3.0
  29833. * @category Object
  29834. * @param {Object} prototype The object to inherit from.
  29835. * @param {Object} [properties] The properties to assign to the object.
  29836. * @returns {Object} Returns the new object.
  29837. * @example
  29838. *
  29839. * function Shape() {
  29840. * this.x = 0;
  29841. * this.y = 0;
  29842. * }
  29843. *
  29844. * function Circle() {
  29845. * Shape.call(this);
  29846. * }
  29847. *
  29848. * Circle.prototype = _.create(Shape.prototype, {
  29849. * 'constructor': Circle
  29850. * });
  29851. *
  29852. * var circle = new Circle;
  29853. * circle instanceof Circle;
  29854. * // => true
  29855. *
  29856. * circle instanceof Shape;
  29857. * // => true
  29858. */
  29859. function create(prototype, properties) {
  29860. var result = baseCreate(prototype);
  29861. return properties == null ? result : baseAssign(result, properties);
  29862. }
  29863. /**
  29864. * Assigns own and inherited enumerable string keyed properties of source
  29865. * objects to the destination object for all destination properties that
  29866. * resolve to `undefined`. Source objects are applied from left to right.
  29867. * Once a property is set, additional values of the same property are ignored.
  29868. *
  29869. * **Note:** This method mutates `object`.
  29870. *
  29871. * @static
  29872. * @since 0.1.0
  29873. * @memberOf _
  29874. * @category Object
  29875. * @param {Object} object The destination object.
  29876. * @param {...Object} [sources] The source objects.
  29877. * @returns {Object} Returns `object`.
  29878. * @see _.defaultsDeep
  29879. * @example
  29880. *
  29881. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29882. * // => { 'a': 1, 'b': 2 }
  29883. */
  29884. var defaults = baseRest(function(object, sources) {
  29885. object = Object(object);
  29886. var index = -1;
  29887. var length = sources.length;
  29888. var guard = length > 2 ? sources[2] : undefined;
  29889. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29890. length = 1;
  29891. }
  29892. while (++index < length) {
  29893. var source = sources[index];
  29894. var props = keysIn(source);
  29895. var propsIndex = -1;
  29896. var propsLength = props.length;
  29897. while (++propsIndex < propsLength) {
  29898. var key = props[propsIndex];
  29899. var value = object[key];
  29900. if (value === undefined ||
  29901. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29902. object[key] = source[key];
  29903. }
  29904. }
  29905. }
  29906. return object;
  29907. });
  29908. /**
  29909. * This method is like `_.defaults` except that it recursively assigns
  29910. * default properties.
  29911. *
  29912. * **Note:** This method mutates `object`.
  29913. *
  29914. * @static
  29915. * @memberOf _
  29916. * @since 3.10.0
  29917. * @category Object
  29918. * @param {Object} object The destination object.
  29919. * @param {...Object} [sources] The source objects.
  29920. * @returns {Object} Returns `object`.
  29921. * @see _.defaults
  29922. * @example
  29923. *
  29924. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29925. * // => { 'a': { 'b': 2, 'c': 3 } }
  29926. */
  29927. var defaultsDeep = baseRest(function(args) {
  29928. args.push(undefined, customDefaultsMerge);
  29929. return apply(mergeWith, undefined, args);
  29930. });
  29931. /**
  29932. * This method is like `_.find` except that it returns the key of the first
  29933. * element `predicate` returns truthy for instead of the element itself.
  29934. *
  29935. * @static
  29936. * @memberOf _
  29937. * @since 1.1.0
  29938. * @category Object
  29939. * @param {Object} object The object to inspect.
  29940. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29941. * @returns {string|undefined} Returns the key of the matched element,
  29942. * else `undefined`.
  29943. * @example
  29944. *
  29945. * var users = {
  29946. * 'barney': { 'age': 36, 'active': true },
  29947. * 'fred': { 'age': 40, 'active': false },
  29948. * 'pebbles': { 'age': 1, 'active': true }
  29949. * };
  29950. *
  29951. * _.findKey(users, function(o) { return o.age < 40; });
  29952. * // => 'barney' (iteration order is not guaranteed)
  29953. *
  29954. * // The `_.matches` iteratee shorthand.
  29955. * _.findKey(users, { 'age': 1, 'active': true });
  29956. * // => 'pebbles'
  29957. *
  29958. * // The `_.matchesProperty` iteratee shorthand.
  29959. * _.findKey(users, ['active', false]);
  29960. * // => 'fred'
  29961. *
  29962. * // The `_.property` iteratee shorthand.
  29963. * _.findKey(users, 'active');
  29964. * // => 'barney'
  29965. */
  29966. function findKey(object, predicate) {
  29967. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  29968. }
  29969. /**
  29970. * This method is like `_.findKey` except that it iterates over elements of
  29971. * a collection in the opposite order.
  29972. *
  29973. * @static
  29974. * @memberOf _
  29975. * @since 2.0.0
  29976. * @category Object
  29977. * @param {Object} object The object to inspect.
  29978. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29979. * @returns {string|undefined} Returns the key of the matched element,
  29980. * else `undefined`.
  29981. * @example
  29982. *
  29983. * var users = {
  29984. * 'barney': { 'age': 36, 'active': true },
  29985. * 'fred': { 'age': 40, 'active': false },
  29986. * 'pebbles': { 'age': 1, 'active': true }
  29987. * };
  29988. *
  29989. * _.findLastKey(users, function(o) { return o.age < 40; });
  29990. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  29991. *
  29992. * // The `_.matches` iteratee shorthand.
  29993. * _.findLastKey(users, { 'age': 36, 'active': true });
  29994. * // => 'barney'
  29995. *
  29996. * // The `_.matchesProperty` iteratee shorthand.
  29997. * _.findLastKey(users, ['active', false]);
  29998. * // => 'fred'
  29999. *
  30000. * // The `_.property` iteratee shorthand.
  30001. * _.findLastKey(users, 'active');
  30002. * // => 'pebbles'
  30003. */
  30004. function findLastKey(object, predicate) {
  30005. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30006. }
  30007. /**
  30008. * Iterates over own and inherited enumerable string keyed properties of an
  30009. * object and invokes `iteratee` for each property. The iteratee is invoked
  30010. * with three arguments: (value, key, object). Iteratee functions may exit
  30011. * iteration early by explicitly returning `false`.
  30012. *
  30013. * @static
  30014. * @memberOf _
  30015. * @since 0.3.0
  30016. * @category Object
  30017. * @param {Object} object The object to iterate over.
  30018. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30019. * @returns {Object} Returns `object`.
  30020. * @see _.forInRight
  30021. * @example
  30022. *
  30023. * function Foo() {
  30024. * this.a = 1;
  30025. * this.b = 2;
  30026. * }
  30027. *
  30028. * Foo.prototype.c = 3;
  30029. *
  30030. * _.forIn(new Foo, function(value, key) {
  30031. * console.log(key);
  30032. * });
  30033. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30034. */
  30035. function forIn(object, iteratee) {
  30036. return object == null
  30037. ? object
  30038. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30039. }
  30040. /**
  30041. * This method is like `_.forIn` except that it iterates over properties of
  30042. * `object` in the opposite order.
  30043. *
  30044. * @static
  30045. * @memberOf _
  30046. * @since 2.0.0
  30047. * @category Object
  30048. * @param {Object} object The object to iterate over.
  30049. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30050. * @returns {Object} Returns `object`.
  30051. * @see _.forIn
  30052. * @example
  30053. *
  30054. * function Foo() {
  30055. * this.a = 1;
  30056. * this.b = 2;
  30057. * }
  30058. *
  30059. * Foo.prototype.c = 3;
  30060. *
  30061. * _.forInRight(new Foo, function(value, key) {
  30062. * console.log(key);
  30063. * });
  30064. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30065. */
  30066. function forInRight(object, iteratee) {
  30067. return object == null
  30068. ? object
  30069. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30070. }
  30071. /**
  30072. * Iterates over own enumerable string keyed properties of an object and
  30073. * invokes `iteratee` for each property. The iteratee is invoked with three
  30074. * arguments: (value, key, object). Iteratee functions may exit iteration
  30075. * early by explicitly returning `false`.
  30076. *
  30077. * @static
  30078. * @memberOf _
  30079. * @since 0.3.0
  30080. * @category Object
  30081. * @param {Object} object The object to iterate over.
  30082. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30083. * @returns {Object} Returns `object`.
  30084. * @see _.forOwnRight
  30085. * @example
  30086. *
  30087. * function Foo() {
  30088. * this.a = 1;
  30089. * this.b = 2;
  30090. * }
  30091. *
  30092. * Foo.prototype.c = 3;
  30093. *
  30094. * _.forOwn(new Foo, function(value, key) {
  30095. * console.log(key);
  30096. * });
  30097. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30098. */
  30099. function forOwn(object, iteratee) {
  30100. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30101. }
  30102. /**
  30103. * This method is like `_.forOwn` except that it iterates over properties of
  30104. * `object` in the opposite order.
  30105. *
  30106. * @static
  30107. * @memberOf _
  30108. * @since 2.0.0
  30109. * @category Object
  30110. * @param {Object} object The object to iterate over.
  30111. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30112. * @returns {Object} Returns `object`.
  30113. * @see _.forOwn
  30114. * @example
  30115. *
  30116. * function Foo() {
  30117. * this.a = 1;
  30118. * this.b = 2;
  30119. * }
  30120. *
  30121. * Foo.prototype.c = 3;
  30122. *
  30123. * _.forOwnRight(new Foo, function(value, key) {
  30124. * console.log(key);
  30125. * });
  30126. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30127. */
  30128. function forOwnRight(object, iteratee) {
  30129. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30130. }
  30131. /**
  30132. * Creates an array of function property names from own enumerable properties
  30133. * of `object`.
  30134. *
  30135. * @static
  30136. * @since 0.1.0
  30137. * @memberOf _
  30138. * @category Object
  30139. * @param {Object} object The object to inspect.
  30140. * @returns {Array} Returns the function names.
  30141. * @see _.functionsIn
  30142. * @example
  30143. *
  30144. * function Foo() {
  30145. * this.a = _.constant('a');
  30146. * this.b = _.constant('b');
  30147. * }
  30148. *
  30149. * Foo.prototype.c = _.constant('c');
  30150. *
  30151. * _.functions(new Foo);
  30152. * // => ['a', 'b']
  30153. */
  30154. function functions(object) {
  30155. return object == null ? [] : baseFunctions(object, keys(object));
  30156. }
  30157. /**
  30158. * Creates an array of function property names from own and inherited
  30159. * enumerable properties of `object`.
  30160. *
  30161. * @static
  30162. * @memberOf _
  30163. * @since 4.0.0
  30164. * @category Object
  30165. * @param {Object} object The object to inspect.
  30166. * @returns {Array} Returns the function names.
  30167. * @see _.functions
  30168. * @example
  30169. *
  30170. * function Foo() {
  30171. * this.a = _.constant('a');
  30172. * this.b = _.constant('b');
  30173. * }
  30174. *
  30175. * Foo.prototype.c = _.constant('c');
  30176. *
  30177. * _.functionsIn(new Foo);
  30178. * // => ['a', 'b', 'c']
  30179. */
  30180. function functionsIn(object) {
  30181. return object == null ? [] : baseFunctions(object, keysIn(object));
  30182. }
  30183. /**
  30184. * Gets the value at `path` of `object`. If the resolved value is
  30185. * `undefined`, the `defaultValue` is returned in its place.
  30186. *
  30187. * @static
  30188. * @memberOf _
  30189. * @since 3.7.0
  30190. * @category Object
  30191. * @param {Object} object The object to query.
  30192. * @param {Array|string} path The path of the property to get.
  30193. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30194. * @returns {*} Returns the resolved value.
  30195. * @example
  30196. *
  30197. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30198. *
  30199. * _.get(object, 'a[0].b.c');
  30200. * // => 3
  30201. *
  30202. * _.get(object, ['a', '0', 'b', 'c']);
  30203. * // => 3
  30204. *
  30205. * _.get(object, 'a.b.c', 'default');
  30206. * // => 'default'
  30207. */
  30208. function get(object, path, defaultValue) {
  30209. var result = object == null ? undefined : baseGet(object, path);
  30210. return result === undefined ? defaultValue : result;
  30211. }
  30212. /**
  30213. * Checks if `path` is a direct property of `object`.
  30214. *
  30215. * @static
  30216. * @since 0.1.0
  30217. * @memberOf _
  30218. * @category Object
  30219. * @param {Object} object The object to query.
  30220. * @param {Array|string} path The path to check.
  30221. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30222. * @example
  30223. *
  30224. * var object = { 'a': { 'b': 2 } };
  30225. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30226. *
  30227. * _.has(object, 'a');
  30228. * // => true
  30229. *
  30230. * _.has(object, 'a.b');
  30231. * // => true
  30232. *
  30233. * _.has(object, ['a', 'b']);
  30234. * // => true
  30235. *
  30236. * _.has(other, 'a');
  30237. * // => false
  30238. */
  30239. function has(object, path) {
  30240. return object != null && hasPath(object, path, baseHas);
  30241. }
  30242. /**
  30243. * Checks if `path` is a direct or inherited property of `object`.
  30244. *
  30245. * @static
  30246. * @memberOf _
  30247. * @since 4.0.0
  30248. * @category Object
  30249. * @param {Object} object The object to query.
  30250. * @param {Array|string} path The path to check.
  30251. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30252. * @example
  30253. *
  30254. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30255. *
  30256. * _.hasIn(object, 'a');
  30257. * // => true
  30258. *
  30259. * _.hasIn(object, 'a.b');
  30260. * // => true
  30261. *
  30262. * _.hasIn(object, ['a', 'b']);
  30263. * // => true
  30264. *
  30265. * _.hasIn(object, 'b');
  30266. * // => false
  30267. */
  30268. function hasIn(object, path) {
  30269. return object != null && hasPath(object, path, baseHasIn);
  30270. }
  30271. /**
  30272. * Creates an object composed of the inverted keys and values of `object`.
  30273. * If `object` contains duplicate values, subsequent values overwrite
  30274. * property assignments of previous values.
  30275. *
  30276. * @static
  30277. * @memberOf _
  30278. * @since 0.7.0
  30279. * @category Object
  30280. * @param {Object} object The object to invert.
  30281. * @returns {Object} Returns the new inverted object.
  30282. * @example
  30283. *
  30284. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30285. *
  30286. * _.invert(object);
  30287. * // => { '1': 'c', '2': 'b' }
  30288. */
  30289. var invert = createInverter(function(result, value, key) {
  30290. if (value != null &&
  30291. typeof value.toString != 'function') {
  30292. value = nativeObjectToString.call(value);
  30293. }
  30294. result[value] = key;
  30295. }, constant(identity));
  30296. /**
  30297. * This method is like `_.invert` except that the inverted object is generated
  30298. * from the results of running each element of `object` thru `iteratee`. The
  30299. * corresponding inverted value of each inverted key is an array of keys
  30300. * responsible for generating the inverted value. The iteratee is invoked
  30301. * with one argument: (value).
  30302. *
  30303. * @static
  30304. * @memberOf _
  30305. * @since 4.1.0
  30306. * @category Object
  30307. * @param {Object} object The object to invert.
  30308. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30309. * @returns {Object} Returns the new inverted object.
  30310. * @example
  30311. *
  30312. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30313. *
  30314. * _.invertBy(object);
  30315. * // => { '1': ['a', 'c'], '2': ['b'] }
  30316. *
  30317. * _.invertBy(object, function(value) {
  30318. * return 'group' + value;
  30319. * });
  30320. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30321. */
  30322. var invertBy = createInverter(function(result, value, key) {
  30323. if (value != null &&
  30324. typeof value.toString != 'function') {
  30325. value = nativeObjectToString.call(value);
  30326. }
  30327. if (hasOwnProperty.call(result, value)) {
  30328. result[value].push(key);
  30329. } else {
  30330. result[value] = [key];
  30331. }
  30332. }, getIteratee);
  30333. /**
  30334. * Invokes the method at `path` of `object`.
  30335. *
  30336. * @static
  30337. * @memberOf _
  30338. * @since 4.0.0
  30339. * @category Object
  30340. * @param {Object} object The object to query.
  30341. * @param {Array|string} path The path of the method to invoke.
  30342. * @param {...*} [args] The arguments to invoke the method with.
  30343. * @returns {*} Returns the result of the invoked method.
  30344. * @example
  30345. *
  30346. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30347. *
  30348. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30349. * // => [2, 3]
  30350. */
  30351. var invoke = baseRest(baseInvoke);
  30352. /**
  30353. * Creates an array of the own enumerable property names of `object`.
  30354. *
  30355. * **Note:** Non-object values are coerced to objects. See the
  30356. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30357. * for more details.
  30358. *
  30359. * @static
  30360. * @since 0.1.0
  30361. * @memberOf _
  30362. * @category Object
  30363. * @param {Object} object The object to query.
  30364. * @returns {Array} Returns the array of property names.
  30365. * @example
  30366. *
  30367. * function Foo() {
  30368. * this.a = 1;
  30369. * this.b = 2;
  30370. * }
  30371. *
  30372. * Foo.prototype.c = 3;
  30373. *
  30374. * _.keys(new Foo);
  30375. * // => ['a', 'b'] (iteration order is not guaranteed)
  30376. *
  30377. * _.keys('hi');
  30378. * // => ['0', '1']
  30379. */
  30380. function keys(object) {
  30381. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30382. }
  30383. /**
  30384. * Creates an array of the own and inherited enumerable property names of `object`.
  30385. *
  30386. * **Note:** Non-object values are coerced to objects.
  30387. *
  30388. * @static
  30389. * @memberOf _
  30390. * @since 3.0.0
  30391. * @category Object
  30392. * @param {Object} object The object to query.
  30393. * @returns {Array} Returns the array of property names.
  30394. * @example
  30395. *
  30396. * function Foo() {
  30397. * this.a = 1;
  30398. * this.b = 2;
  30399. * }
  30400. *
  30401. * Foo.prototype.c = 3;
  30402. *
  30403. * _.keysIn(new Foo);
  30404. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30405. */
  30406. function keysIn(object) {
  30407. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30408. }
  30409. /**
  30410. * The opposite of `_.mapValues`; this method creates an object with the
  30411. * same values as `object` and keys generated by running each own enumerable
  30412. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30413. * with three arguments: (value, key, object).
  30414. *
  30415. * @static
  30416. * @memberOf _
  30417. * @since 3.8.0
  30418. * @category Object
  30419. * @param {Object} object The object to iterate over.
  30420. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30421. * @returns {Object} Returns the new mapped object.
  30422. * @see _.mapValues
  30423. * @example
  30424. *
  30425. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30426. * return key + value;
  30427. * });
  30428. * // => { 'a1': 1, 'b2': 2 }
  30429. */
  30430. function mapKeys(object, iteratee) {
  30431. var result = {};
  30432. iteratee = getIteratee(iteratee, 3);
  30433. baseForOwn(object, function(value, key, object) {
  30434. baseAssignValue(result, iteratee(value, key, object), value);
  30435. });
  30436. return result;
  30437. }
  30438. /**
  30439. * Creates an object with the same keys as `object` and values generated
  30440. * by running each own enumerable string keyed property of `object` thru
  30441. * `iteratee`. The iteratee is invoked with three arguments:
  30442. * (value, key, object).
  30443. *
  30444. * @static
  30445. * @memberOf _
  30446. * @since 2.4.0
  30447. * @category Object
  30448. * @param {Object} object The object to iterate over.
  30449. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30450. * @returns {Object} Returns the new mapped object.
  30451. * @see _.mapKeys
  30452. * @example
  30453. *
  30454. * var users = {
  30455. * 'fred': { 'user': 'fred', 'age': 40 },
  30456. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30457. * };
  30458. *
  30459. * _.mapValues(users, function(o) { return o.age; });
  30460. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30461. *
  30462. * // The `_.property` iteratee shorthand.
  30463. * _.mapValues(users, 'age');
  30464. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30465. */
  30466. function mapValues(object, iteratee) {
  30467. var result = {};
  30468. iteratee = getIteratee(iteratee, 3);
  30469. baseForOwn(object, function(value, key, object) {
  30470. baseAssignValue(result, key, iteratee(value, key, object));
  30471. });
  30472. return result;
  30473. }
  30474. /**
  30475. * This method is like `_.assign` except that it recursively merges own and
  30476. * inherited enumerable string keyed properties of source objects into the
  30477. * destination object. Source properties that resolve to `undefined` are
  30478. * skipped if a destination value exists. Array and plain object properties
  30479. * are merged recursively. Other objects and value types are overridden by
  30480. * assignment. Source objects are applied from left to right. Subsequent
  30481. * sources overwrite property assignments of previous sources.
  30482. *
  30483. * **Note:** This method mutates `object`.
  30484. *
  30485. * @static
  30486. * @memberOf _
  30487. * @since 0.5.0
  30488. * @category Object
  30489. * @param {Object} object The destination object.
  30490. * @param {...Object} [sources] The source objects.
  30491. * @returns {Object} Returns `object`.
  30492. * @example
  30493. *
  30494. * var object = {
  30495. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30496. * };
  30497. *
  30498. * var other = {
  30499. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30500. * };
  30501. *
  30502. * _.merge(object, other);
  30503. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30504. */
  30505. var merge = createAssigner(function(object, source, srcIndex) {
  30506. baseMerge(object, source, srcIndex);
  30507. });
  30508. /**
  30509. * This method is like `_.merge` except that it accepts `customizer` which
  30510. * is invoked to produce the merged values of the destination and source
  30511. * properties. If `customizer` returns `undefined`, merging is handled by the
  30512. * method instead. The `customizer` is invoked with six arguments:
  30513. * (objValue, srcValue, key, object, source, stack).
  30514. *
  30515. * **Note:** This method mutates `object`.
  30516. *
  30517. * @static
  30518. * @memberOf _
  30519. * @since 4.0.0
  30520. * @category Object
  30521. * @param {Object} object The destination object.
  30522. * @param {...Object} sources The source objects.
  30523. * @param {Function} customizer The function to customize assigned values.
  30524. * @returns {Object} Returns `object`.
  30525. * @example
  30526. *
  30527. * function customizer(objValue, srcValue) {
  30528. * if (_.isArray(objValue)) {
  30529. * return objValue.concat(srcValue);
  30530. * }
  30531. * }
  30532. *
  30533. * var object = { 'a': [1], 'b': [2] };
  30534. * var other = { 'a': [3], 'b': [4] };
  30535. *
  30536. * _.mergeWith(object, other, customizer);
  30537. * // => { 'a': [1, 3], 'b': [2, 4] }
  30538. */
  30539. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30540. baseMerge(object, source, srcIndex, customizer);
  30541. });
  30542. /**
  30543. * The opposite of `_.pick`; this method creates an object composed of the
  30544. * own and inherited enumerable property paths of `object` that are not omitted.
  30545. *
  30546. * **Note:** This method is considerably slower than `_.pick`.
  30547. *
  30548. * @static
  30549. * @since 0.1.0
  30550. * @memberOf _
  30551. * @category Object
  30552. * @param {Object} object The source object.
  30553. * @param {...(string|string[])} [paths] The property paths to omit.
  30554. * @returns {Object} Returns the new object.
  30555. * @example
  30556. *
  30557. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30558. *
  30559. * _.omit(object, ['a', 'c']);
  30560. * // => { 'b': '2' }
  30561. */
  30562. var omit = flatRest(function(object, paths) {
  30563. var result = {};
  30564. if (object == null) {
  30565. return result;
  30566. }
  30567. var isDeep = false;
  30568. paths = arrayMap(paths, function(path) {
  30569. path = castPath(path, object);
  30570. isDeep || (isDeep = path.length > 1);
  30571. return path;
  30572. });
  30573. copyObject(object, getAllKeysIn(object), result);
  30574. if (isDeep) {
  30575. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30576. }
  30577. var length = paths.length;
  30578. while (length--) {
  30579. baseUnset(result, paths[length]);
  30580. }
  30581. return result;
  30582. });
  30583. /**
  30584. * The opposite of `_.pickBy`; this method creates an object composed of
  30585. * the own and inherited enumerable string keyed properties of `object` that
  30586. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30587. * arguments: (value, key).
  30588. *
  30589. * @static
  30590. * @memberOf _
  30591. * @since 4.0.0
  30592. * @category Object
  30593. * @param {Object} object The source object.
  30594. * @param {Function} [predicate=_.identity] The function invoked per property.
  30595. * @returns {Object} Returns the new object.
  30596. * @example
  30597. *
  30598. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30599. *
  30600. * _.omitBy(object, _.isNumber);
  30601. * // => { 'b': '2' }
  30602. */
  30603. function omitBy(object, predicate) {
  30604. return pickBy(object, negate(getIteratee(predicate)));
  30605. }
  30606. /**
  30607. * Creates an object composed of the picked `object` properties.
  30608. *
  30609. * @static
  30610. * @since 0.1.0
  30611. * @memberOf _
  30612. * @category Object
  30613. * @param {Object} object The source object.
  30614. * @param {...(string|string[])} [paths] The property paths to pick.
  30615. * @returns {Object} Returns the new object.
  30616. * @example
  30617. *
  30618. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30619. *
  30620. * _.pick(object, ['a', 'c']);
  30621. * // => { 'a': 1, 'c': 3 }
  30622. */
  30623. var pick = flatRest(function(object, paths) {
  30624. return object == null ? {} : basePick(object, paths);
  30625. });
  30626. /**
  30627. * Creates an object composed of the `object` properties `predicate` returns
  30628. * truthy for. The predicate is invoked with two arguments: (value, key).
  30629. *
  30630. * @static
  30631. * @memberOf _
  30632. * @since 4.0.0
  30633. * @category Object
  30634. * @param {Object} object The source object.
  30635. * @param {Function} [predicate=_.identity] The function invoked per property.
  30636. * @returns {Object} Returns the new object.
  30637. * @example
  30638. *
  30639. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30640. *
  30641. * _.pickBy(object, _.isNumber);
  30642. * // => { 'a': 1, 'c': 3 }
  30643. */
  30644. function pickBy(object, predicate) {
  30645. if (object == null) {
  30646. return {};
  30647. }
  30648. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30649. return [prop];
  30650. });
  30651. predicate = getIteratee(predicate);
  30652. return basePickBy(object, props, function(value, path) {
  30653. return predicate(value, path[0]);
  30654. });
  30655. }
  30656. /**
  30657. * This method is like `_.get` except that if the resolved value is a
  30658. * function it's invoked with the `this` binding of its parent object and
  30659. * its result is returned.
  30660. *
  30661. * @static
  30662. * @since 0.1.0
  30663. * @memberOf _
  30664. * @category Object
  30665. * @param {Object} object The object to query.
  30666. * @param {Array|string} path The path of the property to resolve.
  30667. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30668. * @returns {*} Returns the resolved value.
  30669. * @example
  30670. *
  30671. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30672. *
  30673. * _.result(object, 'a[0].b.c1');
  30674. * // => 3
  30675. *
  30676. * _.result(object, 'a[0].b.c2');
  30677. * // => 4
  30678. *
  30679. * _.result(object, 'a[0].b.c3', 'default');
  30680. * // => 'default'
  30681. *
  30682. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30683. * // => 'default'
  30684. */
  30685. function result(object, path, defaultValue) {
  30686. path = castPath(path, object);
  30687. var index = -1,
  30688. length = path.length;
  30689. // Ensure the loop is entered when path is empty.
  30690. if (!length) {
  30691. length = 1;
  30692. object = undefined;
  30693. }
  30694. while (++index < length) {
  30695. var value = object == null ? undefined : object[toKey(path[index])];
  30696. if (value === undefined) {
  30697. index = length;
  30698. value = defaultValue;
  30699. }
  30700. object = isFunction(value) ? value.call(object) : value;
  30701. }
  30702. return object;
  30703. }
  30704. /**
  30705. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30706. * it's created. Arrays are created for missing index properties while objects
  30707. * are created for all other missing properties. Use `_.setWith` to customize
  30708. * `path` creation.
  30709. *
  30710. * **Note:** This method mutates `object`.
  30711. *
  30712. * @static
  30713. * @memberOf _
  30714. * @since 3.7.0
  30715. * @category Object
  30716. * @param {Object} object The object to modify.
  30717. * @param {Array|string} path The path of the property to set.
  30718. * @param {*} value The value to set.
  30719. * @returns {Object} Returns `object`.
  30720. * @example
  30721. *
  30722. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30723. *
  30724. * _.set(object, 'a[0].b.c', 4);
  30725. * console.log(object.a[0].b.c);
  30726. * // => 4
  30727. *
  30728. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30729. * console.log(object.x[0].y.z);
  30730. * // => 5
  30731. */
  30732. function set(object, path, value) {
  30733. return object == null ? object : baseSet(object, path, value);
  30734. }
  30735. /**
  30736. * This method is like `_.set` except that it accepts `customizer` which is
  30737. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30738. * path creation is handled by the method instead. The `customizer` is invoked
  30739. * with three arguments: (nsValue, key, nsObject).
  30740. *
  30741. * **Note:** This method mutates `object`.
  30742. *
  30743. * @static
  30744. * @memberOf _
  30745. * @since 4.0.0
  30746. * @category Object
  30747. * @param {Object} object The object to modify.
  30748. * @param {Array|string} path The path of the property to set.
  30749. * @param {*} value The value to set.
  30750. * @param {Function} [customizer] The function to customize assigned values.
  30751. * @returns {Object} Returns `object`.
  30752. * @example
  30753. *
  30754. * var object = {};
  30755. *
  30756. * _.setWith(object, '[0][1]', 'a', Object);
  30757. * // => { '0': { '1': 'a' } }
  30758. */
  30759. function setWith(object, path, value, customizer) {
  30760. customizer = typeof customizer == 'function' ? customizer : undefined;
  30761. return object == null ? object : baseSet(object, path, value, customizer);
  30762. }
  30763. /**
  30764. * Creates an array of own enumerable string keyed-value pairs for `object`
  30765. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30766. * entries are returned.
  30767. *
  30768. * @static
  30769. * @memberOf _
  30770. * @since 4.0.0
  30771. * @alias entries
  30772. * @category Object
  30773. * @param {Object} object The object to query.
  30774. * @returns {Array} Returns the key-value pairs.
  30775. * @example
  30776. *
  30777. * function Foo() {
  30778. * this.a = 1;
  30779. * this.b = 2;
  30780. * }
  30781. *
  30782. * Foo.prototype.c = 3;
  30783. *
  30784. * _.toPairs(new Foo);
  30785. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30786. */
  30787. var toPairs = createToPairs(keys);
  30788. /**
  30789. * Creates an array of own and inherited enumerable string keyed-value pairs
  30790. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30791. * or set, its entries are returned.
  30792. *
  30793. * @static
  30794. * @memberOf _
  30795. * @since 4.0.0
  30796. * @alias entriesIn
  30797. * @category Object
  30798. * @param {Object} object The object to query.
  30799. * @returns {Array} Returns the key-value pairs.
  30800. * @example
  30801. *
  30802. * function Foo() {
  30803. * this.a = 1;
  30804. * this.b = 2;
  30805. * }
  30806. *
  30807. * Foo.prototype.c = 3;
  30808. *
  30809. * _.toPairsIn(new Foo);
  30810. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30811. */
  30812. var toPairsIn = createToPairs(keysIn);
  30813. /**
  30814. * An alternative to `_.reduce`; this method transforms `object` to a new
  30815. * `accumulator` object which is the result of running each of its own
  30816. * enumerable string keyed properties thru `iteratee`, with each invocation
  30817. * potentially mutating the `accumulator` object. If `accumulator` is not
  30818. * provided, a new object with the same `[[Prototype]]` will be used. The
  30819. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30820. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30821. *
  30822. * @static
  30823. * @memberOf _
  30824. * @since 1.3.0
  30825. * @category Object
  30826. * @param {Object} object The object to iterate over.
  30827. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30828. * @param {*} [accumulator] The custom accumulator value.
  30829. * @returns {*} Returns the accumulated value.
  30830. * @example
  30831. *
  30832. * _.transform([2, 3, 4], function(result, n) {
  30833. * result.push(n *= n);
  30834. * return n % 2 == 0;
  30835. * }, []);
  30836. * // => [4, 9]
  30837. *
  30838. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30839. * (result[value] || (result[value] = [])).push(key);
  30840. * }, {});
  30841. * // => { '1': ['a', 'c'], '2': ['b'] }
  30842. */
  30843. function transform(object, iteratee, accumulator) {
  30844. var isArr = isArray(object),
  30845. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30846. iteratee = getIteratee(iteratee, 4);
  30847. if (accumulator == null) {
  30848. var Ctor = object && object.constructor;
  30849. if (isArrLike) {
  30850. accumulator = isArr ? new Ctor : [];
  30851. }
  30852. else if (isObject(object)) {
  30853. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30854. }
  30855. else {
  30856. accumulator = {};
  30857. }
  30858. }
  30859. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30860. return iteratee(accumulator, value, index, object);
  30861. });
  30862. return accumulator;
  30863. }
  30864. /**
  30865. * Removes the property at `path` of `object`.
  30866. *
  30867. * **Note:** This method mutates `object`.
  30868. *
  30869. * @static
  30870. * @memberOf _
  30871. * @since 4.0.0
  30872. * @category Object
  30873. * @param {Object} object The object to modify.
  30874. * @param {Array|string} path The path of the property to unset.
  30875. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30876. * @example
  30877. *
  30878. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30879. * _.unset(object, 'a[0].b.c');
  30880. * // => true
  30881. *
  30882. * console.log(object);
  30883. * // => { 'a': [{ 'b': {} }] };
  30884. *
  30885. * _.unset(object, ['a', '0', 'b', 'c']);
  30886. * // => true
  30887. *
  30888. * console.log(object);
  30889. * // => { 'a': [{ 'b': {} }] };
  30890. */
  30891. function unset(object, path) {
  30892. return object == null ? true : baseUnset(object, path);
  30893. }
  30894. /**
  30895. * This method is like `_.set` except that accepts `updater` to produce the
  30896. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30897. * is invoked with one argument: (value).
  30898. *
  30899. * **Note:** This method mutates `object`.
  30900. *
  30901. * @static
  30902. * @memberOf _
  30903. * @since 4.6.0
  30904. * @category Object
  30905. * @param {Object} object The object to modify.
  30906. * @param {Array|string} path The path of the property to set.
  30907. * @param {Function} updater The function to produce the updated value.
  30908. * @returns {Object} Returns `object`.
  30909. * @example
  30910. *
  30911. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30912. *
  30913. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30914. * console.log(object.a[0].b.c);
  30915. * // => 9
  30916. *
  30917. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30918. * console.log(object.x[0].y.z);
  30919. * // => 0
  30920. */
  30921. function update(object, path, updater) {
  30922. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30923. }
  30924. /**
  30925. * This method is like `_.update` except that it accepts `customizer` which is
  30926. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30927. * path creation is handled by the method instead. The `customizer` is invoked
  30928. * with three arguments: (nsValue, key, nsObject).
  30929. *
  30930. * **Note:** This method mutates `object`.
  30931. *
  30932. * @static
  30933. * @memberOf _
  30934. * @since 4.6.0
  30935. * @category Object
  30936. * @param {Object} object The object to modify.
  30937. * @param {Array|string} path The path of the property to set.
  30938. * @param {Function} updater The function to produce the updated value.
  30939. * @param {Function} [customizer] The function to customize assigned values.
  30940. * @returns {Object} Returns `object`.
  30941. * @example
  30942. *
  30943. * var object = {};
  30944. *
  30945. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  30946. * // => { '0': { '1': 'a' } }
  30947. */
  30948. function updateWith(object, path, updater, customizer) {
  30949. customizer = typeof customizer == 'function' ? customizer : undefined;
  30950. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  30951. }
  30952. /**
  30953. * Creates an array of the own enumerable string keyed property values of `object`.
  30954. *
  30955. * **Note:** Non-object values are coerced to objects.
  30956. *
  30957. * @static
  30958. * @since 0.1.0
  30959. * @memberOf _
  30960. * @category Object
  30961. * @param {Object} object The object to query.
  30962. * @returns {Array} Returns the array of property values.
  30963. * @example
  30964. *
  30965. * function Foo() {
  30966. * this.a = 1;
  30967. * this.b = 2;
  30968. * }
  30969. *
  30970. * Foo.prototype.c = 3;
  30971. *
  30972. * _.values(new Foo);
  30973. * // => [1, 2] (iteration order is not guaranteed)
  30974. *
  30975. * _.values('hi');
  30976. * // => ['h', 'i']
  30977. */
  30978. function values(object) {
  30979. return object == null ? [] : baseValues(object, keys(object));
  30980. }
  30981. /**
  30982. * Creates an array of the own and inherited enumerable string keyed property
  30983. * values of `object`.
  30984. *
  30985. * **Note:** Non-object values are coerced to objects.
  30986. *
  30987. * @static
  30988. * @memberOf _
  30989. * @since 3.0.0
  30990. * @category Object
  30991. * @param {Object} object The object to query.
  30992. * @returns {Array} Returns the array of property values.
  30993. * @example
  30994. *
  30995. * function Foo() {
  30996. * this.a = 1;
  30997. * this.b = 2;
  30998. * }
  30999. *
  31000. * Foo.prototype.c = 3;
  31001. *
  31002. * _.valuesIn(new Foo);
  31003. * // => [1, 2, 3] (iteration order is not guaranteed)
  31004. */
  31005. function valuesIn(object) {
  31006. return object == null ? [] : baseValues(object, keysIn(object));
  31007. }
  31008. /*------------------------------------------------------------------------*/
  31009. /**
  31010. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31011. *
  31012. * @static
  31013. * @memberOf _
  31014. * @since 4.0.0
  31015. * @category Number
  31016. * @param {number} number The number to clamp.
  31017. * @param {number} [lower] The lower bound.
  31018. * @param {number} upper The upper bound.
  31019. * @returns {number} Returns the clamped number.
  31020. * @example
  31021. *
  31022. * _.clamp(-10, -5, 5);
  31023. * // => -5
  31024. *
  31025. * _.clamp(10, -5, 5);
  31026. * // => 5
  31027. */
  31028. function clamp(number, lower, upper) {
  31029. if (upper === undefined) {
  31030. upper = lower;
  31031. lower = undefined;
  31032. }
  31033. if (upper !== undefined) {
  31034. upper = toNumber(upper);
  31035. upper = upper === upper ? upper : 0;
  31036. }
  31037. if (lower !== undefined) {
  31038. lower = toNumber(lower);
  31039. lower = lower === lower ? lower : 0;
  31040. }
  31041. return baseClamp(toNumber(number), lower, upper);
  31042. }
  31043. /**
  31044. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31045. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31046. * If `start` is greater than `end` the params are swapped to support
  31047. * negative ranges.
  31048. *
  31049. * @static
  31050. * @memberOf _
  31051. * @since 3.3.0
  31052. * @category Number
  31053. * @param {number} number The number to check.
  31054. * @param {number} [start=0] The start of the range.
  31055. * @param {number} end The end of the range.
  31056. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31057. * @see _.range, _.rangeRight
  31058. * @example
  31059. *
  31060. * _.inRange(3, 2, 4);
  31061. * // => true
  31062. *
  31063. * _.inRange(4, 8);
  31064. * // => true
  31065. *
  31066. * _.inRange(4, 2);
  31067. * // => false
  31068. *
  31069. * _.inRange(2, 2);
  31070. * // => false
  31071. *
  31072. * _.inRange(1.2, 2);
  31073. * // => true
  31074. *
  31075. * _.inRange(5.2, 4);
  31076. * // => false
  31077. *
  31078. * _.inRange(-3, -2, -6);
  31079. * // => true
  31080. */
  31081. function inRange(number, start, end) {
  31082. start = toFinite(start);
  31083. if (end === undefined) {
  31084. end = start;
  31085. start = 0;
  31086. } else {
  31087. end = toFinite(end);
  31088. }
  31089. number = toNumber(number);
  31090. return baseInRange(number, start, end);
  31091. }
  31092. /**
  31093. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31094. * If only one argument is provided a number between `0` and the given number
  31095. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31096. * floats, a floating-point number is returned instead of an integer.
  31097. *
  31098. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31099. * floating-point values which can produce unexpected results.
  31100. *
  31101. * @static
  31102. * @memberOf _
  31103. * @since 0.7.0
  31104. * @category Number
  31105. * @param {number} [lower=0] The lower bound.
  31106. * @param {number} [upper=1] The upper bound.
  31107. * @param {boolean} [floating] Specify returning a floating-point number.
  31108. * @returns {number} Returns the random number.
  31109. * @example
  31110. *
  31111. * _.random(0, 5);
  31112. * // => an integer between 0 and 5
  31113. *
  31114. * _.random(5);
  31115. * // => also an integer between 0 and 5
  31116. *
  31117. * _.random(5, true);
  31118. * // => a floating-point number between 0 and 5
  31119. *
  31120. * _.random(1.2, 5.2);
  31121. * // => a floating-point number between 1.2 and 5.2
  31122. */
  31123. function random(lower, upper, floating) {
  31124. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31125. upper = floating = undefined;
  31126. }
  31127. if (floating === undefined) {
  31128. if (typeof upper == 'boolean') {
  31129. floating = upper;
  31130. upper = undefined;
  31131. }
  31132. else if (typeof lower == 'boolean') {
  31133. floating = lower;
  31134. lower = undefined;
  31135. }
  31136. }
  31137. if (lower === undefined && upper === undefined) {
  31138. lower = 0;
  31139. upper = 1;
  31140. }
  31141. else {
  31142. lower = toFinite(lower);
  31143. if (upper === undefined) {
  31144. upper = lower;
  31145. lower = 0;
  31146. } else {
  31147. upper = toFinite(upper);
  31148. }
  31149. }
  31150. if (lower > upper) {
  31151. var temp = lower;
  31152. lower = upper;
  31153. upper = temp;
  31154. }
  31155. if (floating || lower % 1 || upper % 1) {
  31156. var rand = nativeRandom();
  31157. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31158. }
  31159. return baseRandom(lower, upper);
  31160. }
  31161. /*------------------------------------------------------------------------*/
  31162. /**
  31163. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31164. *
  31165. * @static
  31166. * @memberOf _
  31167. * @since 3.0.0
  31168. * @category String
  31169. * @param {string} [string=''] The string to convert.
  31170. * @returns {string} Returns the camel cased string.
  31171. * @example
  31172. *
  31173. * _.camelCase('Foo Bar');
  31174. * // => 'fooBar'
  31175. *
  31176. * _.camelCase('--foo-bar--');
  31177. * // => 'fooBar'
  31178. *
  31179. * _.camelCase('__FOO_BAR__');
  31180. * // => 'fooBar'
  31181. */
  31182. var camelCase = createCompounder(function(result, word, index) {
  31183. word = word.toLowerCase();
  31184. return result + (index ? capitalize(word) : word);
  31185. });
  31186. /**
  31187. * Converts the first character of `string` to upper case and the remaining
  31188. * to lower case.
  31189. *
  31190. * @static
  31191. * @memberOf _
  31192. * @since 3.0.0
  31193. * @category String
  31194. * @param {string} [string=''] The string to capitalize.
  31195. * @returns {string} Returns the capitalized string.
  31196. * @example
  31197. *
  31198. * _.capitalize('FRED');
  31199. * // => 'Fred'
  31200. */
  31201. function capitalize(string) {
  31202. return upperFirst(toString(string).toLowerCase());
  31203. }
  31204. /**
  31205. * Deburrs `string` by converting
  31206. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31207. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31208. * letters to basic Latin letters and removing
  31209. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31210. *
  31211. * @static
  31212. * @memberOf _
  31213. * @since 3.0.0
  31214. * @category String
  31215. * @param {string} [string=''] The string to deburr.
  31216. * @returns {string} Returns the deburred string.
  31217. * @example
  31218. *
  31219. * _.deburr('déjà vu');
  31220. * // => 'deja vu'
  31221. */
  31222. function deburr(string) {
  31223. string = toString(string);
  31224. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31225. }
  31226. /**
  31227. * Checks if `string` ends with the given target string.
  31228. *
  31229. * @static
  31230. * @memberOf _
  31231. * @since 3.0.0
  31232. * @category String
  31233. * @param {string} [string=''] The string to inspect.
  31234. * @param {string} [target] The string to search for.
  31235. * @param {number} [position=string.length] The position to search up to.
  31236. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31237. * else `false`.
  31238. * @example
  31239. *
  31240. * _.endsWith('abc', 'c');
  31241. * // => true
  31242. *
  31243. * _.endsWith('abc', 'b');
  31244. * // => false
  31245. *
  31246. * _.endsWith('abc', 'b', 2);
  31247. * // => true
  31248. */
  31249. function endsWith(string, target, position) {
  31250. string = toString(string);
  31251. target = baseToString(target);
  31252. var length = string.length;
  31253. position = position === undefined
  31254. ? length
  31255. : baseClamp(toInteger(position), 0, length);
  31256. var end = position;
  31257. position -= target.length;
  31258. return position >= 0 && string.slice(position, end) == target;
  31259. }
  31260. /**
  31261. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31262. * corresponding HTML entities.
  31263. *
  31264. * **Note:** No other characters are escaped. To escape additional
  31265. * characters use a third-party library like [_he_](https://mths.be/he).
  31266. *
  31267. * Though the ">" character is escaped for symmetry, characters like
  31268. * ">" and "/" don't need escaping in HTML and have no special meaning
  31269. * unless they're part of a tag or unquoted attribute value. See
  31270. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31271. * (under "semi-related fun fact") for more details.
  31272. *
  31273. * When working with HTML you should always
  31274. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31275. * XSS vectors.
  31276. *
  31277. * @static
  31278. * @since 0.1.0
  31279. * @memberOf _
  31280. * @category String
  31281. * @param {string} [string=''] The string to escape.
  31282. * @returns {string} Returns the escaped string.
  31283. * @example
  31284. *
  31285. * _.escape('fred, barney, & pebbles');
  31286. * // => 'fred, barney, &amp; pebbles'
  31287. */
  31288. function escape(string) {
  31289. string = toString(string);
  31290. return (string && reHasUnescapedHtml.test(string))
  31291. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31292. : string;
  31293. }
  31294. /**
  31295. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31296. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31297. *
  31298. * @static
  31299. * @memberOf _
  31300. * @since 3.0.0
  31301. * @category String
  31302. * @param {string} [string=''] The string to escape.
  31303. * @returns {string} Returns the escaped string.
  31304. * @example
  31305. *
  31306. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31307. * // => '\[lodash\]\(https://lodash\.com/\)'
  31308. */
  31309. function escapeRegExp(string) {
  31310. string = toString(string);
  31311. return (string && reHasRegExpChar.test(string))
  31312. ? string.replace(reRegExpChar, '\\$&')
  31313. : string;
  31314. }
  31315. /**
  31316. * Converts `string` to
  31317. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31318. *
  31319. * @static
  31320. * @memberOf _
  31321. * @since 3.0.0
  31322. * @category String
  31323. * @param {string} [string=''] The string to convert.
  31324. * @returns {string} Returns the kebab cased string.
  31325. * @example
  31326. *
  31327. * _.kebabCase('Foo Bar');
  31328. * // => 'foo-bar'
  31329. *
  31330. * _.kebabCase('fooBar');
  31331. * // => 'foo-bar'
  31332. *
  31333. * _.kebabCase('__FOO_BAR__');
  31334. * // => 'foo-bar'
  31335. */
  31336. var kebabCase = createCompounder(function(result, word, index) {
  31337. return result + (index ? '-' : '') + word.toLowerCase();
  31338. });
  31339. /**
  31340. * Converts `string`, as space separated words, to lower case.
  31341. *
  31342. * @static
  31343. * @memberOf _
  31344. * @since 4.0.0
  31345. * @category String
  31346. * @param {string} [string=''] The string to convert.
  31347. * @returns {string} Returns the lower cased string.
  31348. * @example
  31349. *
  31350. * _.lowerCase('--Foo-Bar--');
  31351. * // => 'foo bar'
  31352. *
  31353. * _.lowerCase('fooBar');
  31354. * // => 'foo bar'
  31355. *
  31356. * _.lowerCase('__FOO_BAR__');
  31357. * // => 'foo bar'
  31358. */
  31359. var lowerCase = createCompounder(function(result, word, index) {
  31360. return result + (index ? ' ' : '') + word.toLowerCase();
  31361. });
  31362. /**
  31363. * Converts the first character of `string` to lower case.
  31364. *
  31365. * @static
  31366. * @memberOf _
  31367. * @since 4.0.0
  31368. * @category String
  31369. * @param {string} [string=''] The string to convert.
  31370. * @returns {string} Returns the converted string.
  31371. * @example
  31372. *
  31373. * _.lowerFirst('Fred');
  31374. * // => 'fred'
  31375. *
  31376. * _.lowerFirst('FRED');
  31377. * // => 'fRED'
  31378. */
  31379. var lowerFirst = createCaseFirst('toLowerCase');
  31380. /**
  31381. * Pads `string` on the left and right sides if it's shorter than `length`.
  31382. * Padding characters are truncated if they can't be evenly divided by `length`.
  31383. *
  31384. * @static
  31385. * @memberOf _
  31386. * @since 3.0.0
  31387. * @category String
  31388. * @param {string} [string=''] The string to pad.
  31389. * @param {number} [length=0] The padding length.
  31390. * @param {string} [chars=' '] The string used as padding.
  31391. * @returns {string} Returns the padded string.
  31392. * @example
  31393. *
  31394. * _.pad('abc', 8);
  31395. * // => ' abc '
  31396. *
  31397. * _.pad('abc', 8, '_-');
  31398. * // => '_-abc_-_'
  31399. *
  31400. * _.pad('abc', 3);
  31401. * // => 'abc'
  31402. */
  31403. function pad(string, length, chars) {
  31404. string = toString(string);
  31405. length = toInteger(length);
  31406. var strLength = length ? stringSize(string) : 0;
  31407. if (!length || strLength >= length) {
  31408. return string;
  31409. }
  31410. var mid = (length - strLength) / 2;
  31411. return (
  31412. createPadding(nativeFloor(mid), chars) +
  31413. string +
  31414. createPadding(nativeCeil(mid), chars)
  31415. );
  31416. }
  31417. /**
  31418. * Pads `string` on the right side if it's shorter than `length`. Padding
  31419. * characters are truncated if they exceed `length`.
  31420. *
  31421. * @static
  31422. * @memberOf _
  31423. * @since 4.0.0
  31424. * @category String
  31425. * @param {string} [string=''] The string to pad.
  31426. * @param {number} [length=0] The padding length.
  31427. * @param {string} [chars=' '] The string used as padding.
  31428. * @returns {string} Returns the padded string.
  31429. * @example
  31430. *
  31431. * _.padEnd('abc', 6);
  31432. * // => 'abc '
  31433. *
  31434. * _.padEnd('abc', 6, '_-');
  31435. * // => 'abc_-_'
  31436. *
  31437. * _.padEnd('abc', 3);
  31438. * // => 'abc'
  31439. */
  31440. function padEnd(string, length, chars) {
  31441. string = toString(string);
  31442. length = toInteger(length);
  31443. var strLength = length ? stringSize(string) : 0;
  31444. return (length && strLength < length)
  31445. ? (string + createPadding(length - strLength, chars))
  31446. : string;
  31447. }
  31448. /**
  31449. * Pads `string` on the left side if it's shorter than `length`. Padding
  31450. * characters are truncated if they exceed `length`.
  31451. *
  31452. * @static
  31453. * @memberOf _
  31454. * @since 4.0.0
  31455. * @category String
  31456. * @param {string} [string=''] The string to pad.
  31457. * @param {number} [length=0] The padding length.
  31458. * @param {string} [chars=' '] The string used as padding.
  31459. * @returns {string} Returns the padded string.
  31460. * @example
  31461. *
  31462. * _.padStart('abc', 6);
  31463. * // => ' abc'
  31464. *
  31465. * _.padStart('abc', 6, '_-');
  31466. * // => '_-_abc'
  31467. *
  31468. * _.padStart('abc', 3);
  31469. * // => 'abc'
  31470. */
  31471. function padStart(string, length, chars) {
  31472. string = toString(string);
  31473. length = toInteger(length);
  31474. var strLength = length ? stringSize(string) : 0;
  31475. return (length && strLength < length)
  31476. ? (createPadding(length - strLength, chars) + string)
  31477. : string;
  31478. }
  31479. /**
  31480. * Converts `string` to an integer of the specified radix. If `radix` is
  31481. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31482. * hexadecimal, in which case a `radix` of `16` is used.
  31483. *
  31484. * **Note:** This method aligns with the
  31485. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31486. *
  31487. * @static
  31488. * @memberOf _
  31489. * @since 1.1.0
  31490. * @category String
  31491. * @param {string} string The string to convert.
  31492. * @param {number} [radix=10] The radix to interpret `value` by.
  31493. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31494. * @returns {number} Returns the converted integer.
  31495. * @example
  31496. *
  31497. * _.parseInt('08');
  31498. * // => 8
  31499. *
  31500. * _.map(['6', '08', '10'], _.parseInt);
  31501. * // => [6, 8, 10]
  31502. */
  31503. function parseInt(string, radix, guard) {
  31504. if (guard || radix == null) {
  31505. radix = 0;
  31506. } else if (radix) {
  31507. radix = +radix;
  31508. }
  31509. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31510. }
  31511. /**
  31512. * Repeats the given string `n` times.
  31513. *
  31514. * @static
  31515. * @memberOf _
  31516. * @since 3.0.0
  31517. * @category String
  31518. * @param {string} [string=''] The string to repeat.
  31519. * @param {number} [n=1] The number of times to repeat the string.
  31520. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31521. * @returns {string} Returns the repeated string.
  31522. * @example
  31523. *
  31524. * _.repeat('*', 3);
  31525. * // => '***'
  31526. *
  31527. * _.repeat('abc', 2);
  31528. * // => 'abcabc'
  31529. *
  31530. * _.repeat('abc', 0);
  31531. * // => ''
  31532. */
  31533. function repeat(string, n, guard) {
  31534. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31535. n = 1;
  31536. } else {
  31537. n = toInteger(n);
  31538. }
  31539. return baseRepeat(toString(string), n);
  31540. }
  31541. /**
  31542. * Replaces matches for `pattern` in `string` with `replacement`.
  31543. *
  31544. * **Note:** This method is based on
  31545. * [`String#replace`](https://mdn.io/String/replace).
  31546. *
  31547. * @static
  31548. * @memberOf _
  31549. * @since 4.0.0
  31550. * @category String
  31551. * @param {string} [string=''] The string to modify.
  31552. * @param {RegExp|string} pattern The pattern to replace.
  31553. * @param {Function|string} replacement The match replacement.
  31554. * @returns {string} Returns the modified string.
  31555. * @example
  31556. *
  31557. * _.replace('Hi Fred', 'Fred', 'Barney');
  31558. * // => 'Hi Barney'
  31559. */
  31560. function replace() {
  31561. var args = arguments,
  31562. string = toString(args[0]);
  31563. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31564. }
  31565. /**
  31566. * Converts `string` to
  31567. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31568. *
  31569. * @static
  31570. * @memberOf _
  31571. * @since 3.0.0
  31572. * @category String
  31573. * @param {string} [string=''] The string to convert.
  31574. * @returns {string} Returns the snake cased string.
  31575. * @example
  31576. *
  31577. * _.snakeCase('Foo Bar');
  31578. * // => 'foo_bar'
  31579. *
  31580. * _.snakeCase('fooBar');
  31581. * // => 'foo_bar'
  31582. *
  31583. * _.snakeCase('--FOO-BAR--');
  31584. * // => 'foo_bar'
  31585. */
  31586. var snakeCase = createCompounder(function(result, word, index) {
  31587. return result + (index ? '_' : '') + word.toLowerCase();
  31588. });
  31589. /**
  31590. * Splits `string` by `separator`.
  31591. *
  31592. * **Note:** This method is based on
  31593. * [`String#split`](https://mdn.io/String/split).
  31594. *
  31595. * @static
  31596. * @memberOf _
  31597. * @since 4.0.0
  31598. * @category String
  31599. * @param {string} [string=''] The string to split.
  31600. * @param {RegExp|string} separator The separator pattern to split by.
  31601. * @param {number} [limit] The length to truncate results to.
  31602. * @returns {Array} Returns the string segments.
  31603. * @example
  31604. *
  31605. * _.split('a-b-c', '-', 2);
  31606. * // => ['a', 'b']
  31607. */
  31608. function split(string, separator, limit) {
  31609. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31610. separator = limit = undefined;
  31611. }
  31612. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31613. if (!limit) {
  31614. return [];
  31615. }
  31616. string = toString(string);
  31617. if (string && (
  31618. typeof separator == 'string' ||
  31619. (separator != null && !isRegExp(separator))
  31620. )) {
  31621. separator = baseToString(separator);
  31622. if (!separator && hasUnicode(string)) {
  31623. return castSlice(stringToArray(string), 0, limit);
  31624. }
  31625. }
  31626. return string.split(separator, limit);
  31627. }
  31628. /**
  31629. * Converts `string` to
  31630. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31631. *
  31632. * @static
  31633. * @memberOf _
  31634. * @since 3.1.0
  31635. * @category String
  31636. * @param {string} [string=''] The string to convert.
  31637. * @returns {string} Returns the start cased string.
  31638. * @example
  31639. *
  31640. * _.startCase('--foo-bar--');
  31641. * // => 'Foo Bar'
  31642. *
  31643. * _.startCase('fooBar');
  31644. * // => 'Foo Bar'
  31645. *
  31646. * _.startCase('__FOO_BAR__');
  31647. * // => 'FOO BAR'
  31648. */
  31649. var startCase = createCompounder(function(result, word, index) {
  31650. return result + (index ? ' ' : '') + upperFirst(word);
  31651. });
  31652. /**
  31653. * Checks if `string` starts with the given target string.
  31654. *
  31655. * @static
  31656. * @memberOf _
  31657. * @since 3.0.0
  31658. * @category String
  31659. * @param {string} [string=''] The string to inspect.
  31660. * @param {string} [target] The string to search for.
  31661. * @param {number} [position=0] The position to search from.
  31662. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31663. * else `false`.
  31664. * @example
  31665. *
  31666. * _.startsWith('abc', 'a');
  31667. * // => true
  31668. *
  31669. * _.startsWith('abc', 'b');
  31670. * // => false
  31671. *
  31672. * _.startsWith('abc', 'b', 1);
  31673. * // => true
  31674. */
  31675. function startsWith(string, target, position) {
  31676. string = toString(string);
  31677. position = position == null
  31678. ? 0
  31679. : baseClamp(toInteger(position), 0, string.length);
  31680. target = baseToString(target);
  31681. return string.slice(position, position + target.length) == target;
  31682. }
  31683. /**
  31684. * Creates a compiled template function that can interpolate data properties
  31685. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31686. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31687. * properties may be accessed as free variables in the template. If a setting
  31688. * object is given, it takes precedence over `_.templateSettings` values.
  31689. *
  31690. * **Note:** In the development build `_.template` utilizes
  31691. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31692. * for easier debugging.
  31693. *
  31694. * For more information on precompiling templates see
  31695. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31696. *
  31697. * For more information on Chrome extension sandboxes see
  31698. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31699. *
  31700. * @static
  31701. * @since 0.1.0
  31702. * @memberOf _
  31703. * @category String
  31704. * @param {string} [string=''] The template string.
  31705. * @param {Object} [options={}] The options object.
  31706. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31707. * The HTML "escape" delimiter.
  31708. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31709. * The "evaluate" delimiter.
  31710. * @param {Object} [options.imports=_.templateSettings.imports]
  31711. * An object to import into the template as free variables.
  31712. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31713. * The "interpolate" delimiter.
  31714. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31715. * The sourceURL of the compiled template.
  31716. * @param {string} [options.variable='obj']
  31717. * The data object variable name.
  31718. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31719. * @returns {Function} Returns the compiled template function.
  31720. * @example
  31721. *
  31722. * // Use the "interpolate" delimiter to create a compiled template.
  31723. * var compiled = _.template('hello <%= user %>!');
  31724. * compiled({ 'user': 'fred' });
  31725. * // => 'hello fred!'
  31726. *
  31727. * // Use the HTML "escape" delimiter to escape data property values.
  31728. * var compiled = _.template('<b><%- value %></b>');
  31729. * compiled({ 'value': '<script>' });
  31730. * // => '<b>&lt;script&gt;</b>'
  31731. *
  31732. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31733. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31734. * compiled({ 'users': ['fred', 'barney'] });
  31735. * // => '<li>fred</li><li>barney</li>'
  31736. *
  31737. * // Use the internal `print` function in "evaluate" delimiters.
  31738. * var compiled = _.template('<% print("hello " + user); %>!');
  31739. * compiled({ 'user': 'barney' });
  31740. * // => 'hello barney!'
  31741. *
  31742. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31743. * // Disable support by replacing the "interpolate" delimiter.
  31744. * var compiled = _.template('hello ${ user }!');
  31745. * compiled({ 'user': 'pebbles' });
  31746. * // => 'hello pebbles!'
  31747. *
  31748. * // Use backslashes to treat delimiters as plain text.
  31749. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31750. * compiled({ 'value': 'ignored' });
  31751. * // => '<%- value %>'
  31752. *
  31753. * // Use the `imports` option to import `jQuery` as `jq`.
  31754. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31755. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31756. * compiled({ 'users': ['fred', 'barney'] });
  31757. * // => '<li>fred</li><li>barney</li>'
  31758. *
  31759. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31760. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31761. * compiled(data);
  31762. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31763. *
  31764. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31765. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31766. * compiled.source;
  31767. * // => function(data) {
  31768. * // var __t, __p = '';
  31769. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31770. * // return __p;
  31771. * // }
  31772. *
  31773. * // Use custom template delimiters.
  31774. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31775. * var compiled = _.template('hello {{ user }}!');
  31776. * compiled({ 'user': 'mustache' });
  31777. * // => 'hello mustache!'
  31778. *
  31779. * // Use the `source` property to inline compiled templates for meaningful
  31780. * // line numbers in error messages and stack traces.
  31781. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31782. * var JST = {\
  31783. * "main": ' + _.template(mainText).source + '\
  31784. * };\
  31785. * ');
  31786. */
  31787. function template(string, options, guard) {
  31788. // Based on John Resig's `tmpl` implementation
  31789. // (http://ejohn.org/blog/javascript-micro-templating/)
  31790. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31791. var settings = lodash.templateSettings;
  31792. if (guard && isIterateeCall(string, options, guard)) {
  31793. options = undefined;
  31794. }
  31795. string = toString(string);
  31796. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31797. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31798. importsKeys = keys(imports),
  31799. importsValues = baseValues(imports, importsKeys);
  31800. var isEscaping,
  31801. isEvaluating,
  31802. index = 0,
  31803. interpolate = options.interpolate || reNoMatch,
  31804. source = "__p += '";
  31805. // Compile the regexp to match each delimiter.
  31806. var reDelimiters = RegExp(
  31807. (options.escape || reNoMatch).source + '|' +
  31808. interpolate.source + '|' +
  31809. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31810. (options.evaluate || reNoMatch).source + '|$'
  31811. , 'g');
  31812. // Use a sourceURL for easier debugging.
  31813. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31814. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31815. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31816. var sourceURL = '//# sourceURL=' +
  31817. (hasOwnProperty.call(options, 'sourceURL')
  31818. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31819. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31820. ) + '\n';
  31821. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31822. interpolateValue || (interpolateValue = esTemplateValue);
  31823. // Escape characters that can't be included in string literals.
  31824. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31825. // Replace delimiters with snippets.
  31826. if (escapeValue) {
  31827. isEscaping = true;
  31828. source += "' +\n__e(" + escapeValue + ") +\n'";
  31829. }
  31830. if (evaluateValue) {
  31831. isEvaluating = true;
  31832. source += "';\n" + evaluateValue + ";\n__p += '";
  31833. }
  31834. if (interpolateValue) {
  31835. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31836. }
  31837. index = offset + match.length;
  31838. // The JS engine embedded in Adobe products needs `match` returned in
  31839. // order to produce the correct `offset` value.
  31840. return match;
  31841. });
  31842. source += "';\n";
  31843. // If `variable` is not specified wrap a with-statement around the generated
  31844. // code to add the data object to the top of the scope chain.
  31845. // Like with sourceURL, we take care to not check the option's prototype,
  31846. // as this configuration is a code injection vector.
  31847. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31848. if (!variable) {
  31849. source = 'with (obj) {\n' + source + '\n}\n';
  31850. }
  31851. // Cleanup code by stripping empty strings.
  31852. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31853. .replace(reEmptyStringMiddle, '$1')
  31854. .replace(reEmptyStringTrailing, '$1;');
  31855. // Frame code as the function body.
  31856. source = 'function(' + (variable || 'obj') + ') {\n' +
  31857. (variable
  31858. ? ''
  31859. : 'obj || (obj = {});\n'
  31860. ) +
  31861. "var __t, __p = ''" +
  31862. (isEscaping
  31863. ? ', __e = _.escape'
  31864. : ''
  31865. ) +
  31866. (isEvaluating
  31867. ? ', __j = Array.prototype.join;\n' +
  31868. "function print() { __p += __j.call(arguments, '') }\n"
  31869. : ';\n'
  31870. ) +
  31871. source +
  31872. 'return __p\n}';
  31873. var result = attempt(function() {
  31874. return Function(importsKeys, sourceURL + 'return ' + source)
  31875. .apply(undefined, importsValues);
  31876. });
  31877. // Provide the compiled function's source by its `toString` method or
  31878. // the `source` property as a convenience for inlining compiled templates.
  31879. result.source = source;
  31880. if (isError(result)) {
  31881. throw result;
  31882. }
  31883. return result;
  31884. }
  31885. /**
  31886. * Converts `string`, as a whole, to lower case just like
  31887. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31888. *
  31889. * @static
  31890. * @memberOf _
  31891. * @since 4.0.0
  31892. * @category String
  31893. * @param {string} [string=''] The string to convert.
  31894. * @returns {string} Returns the lower cased string.
  31895. * @example
  31896. *
  31897. * _.toLower('--Foo-Bar--');
  31898. * // => '--foo-bar--'
  31899. *
  31900. * _.toLower('fooBar');
  31901. * // => 'foobar'
  31902. *
  31903. * _.toLower('__FOO_BAR__');
  31904. * // => '__foo_bar__'
  31905. */
  31906. function toLower(value) {
  31907. return toString(value).toLowerCase();
  31908. }
  31909. /**
  31910. * Converts `string`, as a whole, to upper case just like
  31911. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31912. *
  31913. * @static
  31914. * @memberOf _
  31915. * @since 4.0.0
  31916. * @category String
  31917. * @param {string} [string=''] The string to convert.
  31918. * @returns {string} Returns the upper cased string.
  31919. * @example
  31920. *
  31921. * _.toUpper('--foo-bar--');
  31922. * // => '--FOO-BAR--'
  31923. *
  31924. * _.toUpper('fooBar');
  31925. * // => 'FOOBAR'
  31926. *
  31927. * _.toUpper('__foo_bar__');
  31928. * // => '__FOO_BAR__'
  31929. */
  31930. function toUpper(value) {
  31931. return toString(value).toUpperCase();
  31932. }
  31933. /**
  31934. * Removes leading and trailing whitespace or specified characters from `string`.
  31935. *
  31936. * @static
  31937. * @memberOf _
  31938. * @since 3.0.0
  31939. * @category String
  31940. * @param {string} [string=''] The string to trim.
  31941. * @param {string} [chars=whitespace] The characters to trim.
  31942. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31943. * @returns {string} Returns the trimmed string.
  31944. * @example
  31945. *
  31946. * _.trim(' abc ');
  31947. * // => 'abc'
  31948. *
  31949. * _.trim('-_-abc-_-', '_-');
  31950. * // => 'abc'
  31951. *
  31952. * _.map([' foo ', ' bar '], _.trim);
  31953. * // => ['foo', 'bar']
  31954. */
  31955. function trim(string, chars, guard) {
  31956. string = toString(string);
  31957. if (string && (guard || chars === undefined)) {
  31958. return string.replace(reTrim, '');
  31959. }
  31960. if (!string || !(chars = baseToString(chars))) {
  31961. return string;
  31962. }
  31963. var strSymbols = stringToArray(string),
  31964. chrSymbols = stringToArray(chars),
  31965. start = charsStartIndex(strSymbols, chrSymbols),
  31966. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  31967. return castSlice(strSymbols, start, end).join('');
  31968. }
  31969. /**
  31970. * Removes trailing whitespace or specified characters from `string`.
  31971. *
  31972. * @static
  31973. * @memberOf _
  31974. * @since 4.0.0
  31975. * @category String
  31976. * @param {string} [string=''] The string to trim.
  31977. * @param {string} [chars=whitespace] The characters to trim.
  31978. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31979. * @returns {string} Returns the trimmed string.
  31980. * @example
  31981. *
  31982. * _.trimEnd(' abc ');
  31983. * // => ' abc'
  31984. *
  31985. * _.trimEnd('-_-abc-_-', '_-');
  31986. * // => '-_-abc'
  31987. */
  31988. function trimEnd(string, chars, guard) {
  31989. string = toString(string);
  31990. if (string && (guard || chars === undefined)) {
  31991. return string.replace(reTrimEnd, '');
  31992. }
  31993. if (!string || !(chars = baseToString(chars))) {
  31994. return string;
  31995. }
  31996. var strSymbols = stringToArray(string),
  31997. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  31998. return castSlice(strSymbols, 0, end).join('');
  31999. }
  32000. /**
  32001. * Removes leading whitespace or specified characters from `string`.
  32002. *
  32003. * @static
  32004. * @memberOf _
  32005. * @since 4.0.0
  32006. * @category String
  32007. * @param {string} [string=''] The string to trim.
  32008. * @param {string} [chars=whitespace] The characters to trim.
  32009. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32010. * @returns {string} Returns the trimmed string.
  32011. * @example
  32012. *
  32013. * _.trimStart(' abc ');
  32014. * // => 'abc '
  32015. *
  32016. * _.trimStart('-_-abc-_-', '_-');
  32017. * // => 'abc-_-'
  32018. */
  32019. function trimStart(string, chars, guard) {
  32020. string = toString(string);
  32021. if (string && (guard || chars === undefined)) {
  32022. return string.replace(reTrimStart, '');
  32023. }
  32024. if (!string || !(chars = baseToString(chars))) {
  32025. return string;
  32026. }
  32027. var strSymbols = stringToArray(string),
  32028. start = charsStartIndex(strSymbols, stringToArray(chars));
  32029. return castSlice(strSymbols, start).join('');
  32030. }
  32031. /**
  32032. * Truncates `string` if it's longer than the given maximum string length.
  32033. * The last characters of the truncated string are replaced with the omission
  32034. * string which defaults to "...".
  32035. *
  32036. * @static
  32037. * @memberOf _
  32038. * @since 4.0.0
  32039. * @category String
  32040. * @param {string} [string=''] The string to truncate.
  32041. * @param {Object} [options={}] The options object.
  32042. * @param {number} [options.length=30] The maximum string length.
  32043. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32044. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32045. * @returns {string} Returns the truncated string.
  32046. * @example
  32047. *
  32048. * _.truncate('hi-diddly-ho there, neighborino');
  32049. * // => 'hi-diddly-ho there, neighbo...'
  32050. *
  32051. * _.truncate('hi-diddly-ho there, neighborino', {
  32052. * 'length': 24,
  32053. * 'separator': ' '
  32054. * });
  32055. * // => 'hi-diddly-ho there,...'
  32056. *
  32057. * _.truncate('hi-diddly-ho there, neighborino', {
  32058. * 'length': 24,
  32059. * 'separator': /,? +/
  32060. * });
  32061. * // => 'hi-diddly-ho there...'
  32062. *
  32063. * _.truncate('hi-diddly-ho there, neighborino', {
  32064. * 'omission': ' [...]'
  32065. * });
  32066. * // => 'hi-diddly-ho there, neig [...]'
  32067. */
  32068. function truncate(string, options) {
  32069. var length = DEFAULT_TRUNC_LENGTH,
  32070. omission = DEFAULT_TRUNC_OMISSION;
  32071. if (isObject(options)) {
  32072. var separator = 'separator' in options ? options.separator : separator;
  32073. length = 'length' in options ? toInteger(options.length) : length;
  32074. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32075. }
  32076. string = toString(string);
  32077. var strLength = string.length;
  32078. if (hasUnicode(string)) {
  32079. var strSymbols = stringToArray(string);
  32080. strLength = strSymbols.length;
  32081. }
  32082. if (length >= strLength) {
  32083. return string;
  32084. }
  32085. var end = length - stringSize(omission);
  32086. if (end < 1) {
  32087. return omission;
  32088. }
  32089. var result = strSymbols
  32090. ? castSlice(strSymbols, 0, end).join('')
  32091. : string.slice(0, end);
  32092. if (separator === undefined) {
  32093. return result + omission;
  32094. }
  32095. if (strSymbols) {
  32096. end += (result.length - end);
  32097. }
  32098. if (isRegExp(separator)) {
  32099. if (string.slice(end).search(separator)) {
  32100. var match,
  32101. substring = result;
  32102. if (!separator.global) {
  32103. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32104. }
  32105. separator.lastIndex = 0;
  32106. while ((match = separator.exec(substring))) {
  32107. var newEnd = match.index;
  32108. }
  32109. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32110. }
  32111. } else if (string.indexOf(baseToString(separator), end) != end) {
  32112. var index = result.lastIndexOf(separator);
  32113. if (index > -1) {
  32114. result = result.slice(0, index);
  32115. }
  32116. }
  32117. return result + omission;
  32118. }
  32119. /**
  32120. * The inverse of `_.escape`; this method converts the HTML entities
  32121. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32122. * their corresponding characters.
  32123. *
  32124. * **Note:** No other HTML entities are unescaped. To unescape additional
  32125. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32126. *
  32127. * @static
  32128. * @memberOf _
  32129. * @since 0.6.0
  32130. * @category String
  32131. * @param {string} [string=''] The string to unescape.
  32132. * @returns {string} Returns the unescaped string.
  32133. * @example
  32134. *
  32135. * _.unescape('fred, barney, &amp; pebbles');
  32136. * // => 'fred, barney, & pebbles'
  32137. */
  32138. function unescape(string) {
  32139. string = toString(string);
  32140. return (string && reHasEscapedHtml.test(string))
  32141. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32142. : string;
  32143. }
  32144. /**
  32145. * Converts `string`, as space separated words, to upper case.
  32146. *
  32147. * @static
  32148. * @memberOf _
  32149. * @since 4.0.0
  32150. * @category String
  32151. * @param {string} [string=''] The string to convert.
  32152. * @returns {string} Returns the upper cased string.
  32153. * @example
  32154. *
  32155. * _.upperCase('--foo-bar');
  32156. * // => 'FOO BAR'
  32157. *
  32158. * _.upperCase('fooBar');
  32159. * // => 'FOO BAR'
  32160. *
  32161. * _.upperCase('__foo_bar__');
  32162. * // => 'FOO BAR'
  32163. */
  32164. var upperCase = createCompounder(function(result, word, index) {
  32165. return result + (index ? ' ' : '') + word.toUpperCase();
  32166. });
  32167. /**
  32168. * Converts the first character of `string` to upper case.
  32169. *
  32170. * @static
  32171. * @memberOf _
  32172. * @since 4.0.0
  32173. * @category String
  32174. * @param {string} [string=''] The string to convert.
  32175. * @returns {string} Returns the converted string.
  32176. * @example
  32177. *
  32178. * _.upperFirst('fred');
  32179. * // => 'Fred'
  32180. *
  32181. * _.upperFirst('FRED');
  32182. * // => 'FRED'
  32183. */
  32184. var upperFirst = createCaseFirst('toUpperCase');
  32185. /**
  32186. * Splits `string` into an array of its words.
  32187. *
  32188. * @static
  32189. * @memberOf _
  32190. * @since 3.0.0
  32191. * @category String
  32192. * @param {string} [string=''] The string to inspect.
  32193. * @param {RegExp|string} [pattern] The pattern to match words.
  32194. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32195. * @returns {Array} Returns the words of `string`.
  32196. * @example
  32197. *
  32198. * _.words('fred, barney, & pebbles');
  32199. * // => ['fred', 'barney', 'pebbles']
  32200. *
  32201. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32202. * // => ['fred', 'barney', '&', 'pebbles']
  32203. */
  32204. function words(string, pattern, guard) {
  32205. string = toString(string);
  32206. pattern = guard ? undefined : pattern;
  32207. if (pattern === undefined) {
  32208. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32209. }
  32210. return string.match(pattern) || [];
  32211. }
  32212. /*------------------------------------------------------------------------*/
  32213. /**
  32214. * Attempts to invoke `func`, returning either the result or the caught error
  32215. * object. Any additional arguments are provided to `func` when it's invoked.
  32216. *
  32217. * @static
  32218. * @memberOf _
  32219. * @since 3.0.0
  32220. * @category Util
  32221. * @param {Function} func The function to attempt.
  32222. * @param {...*} [args] The arguments to invoke `func` with.
  32223. * @returns {*} Returns the `func` result or error object.
  32224. * @example
  32225. *
  32226. * // Avoid throwing errors for invalid selectors.
  32227. * var elements = _.attempt(function(selector) {
  32228. * return document.querySelectorAll(selector);
  32229. * }, '>_>');
  32230. *
  32231. * if (_.isError(elements)) {
  32232. * elements = [];
  32233. * }
  32234. */
  32235. var attempt = baseRest(function(func, args) {
  32236. try {
  32237. return apply(func, undefined, args);
  32238. } catch (e) {
  32239. return isError(e) ? e : new Error(e);
  32240. }
  32241. });
  32242. /**
  32243. * Binds methods of an object to the object itself, overwriting the existing
  32244. * method.
  32245. *
  32246. * **Note:** This method doesn't set the "length" property of bound functions.
  32247. *
  32248. * @static
  32249. * @since 0.1.0
  32250. * @memberOf _
  32251. * @category Util
  32252. * @param {Object} object The object to bind and assign the bound methods to.
  32253. * @param {...(string|string[])} methodNames The object method names to bind.
  32254. * @returns {Object} Returns `object`.
  32255. * @example
  32256. *
  32257. * var view = {
  32258. * 'label': 'docs',
  32259. * 'click': function() {
  32260. * console.log('clicked ' + this.label);
  32261. * }
  32262. * };
  32263. *
  32264. * _.bindAll(view, ['click']);
  32265. * jQuery(element).on('click', view.click);
  32266. * // => Logs 'clicked docs' when clicked.
  32267. */
  32268. var bindAll = flatRest(function(object, methodNames) {
  32269. arrayEach(methodNames, function(key) {
  32270. key = toKey(key);
  32271. baseAssignValue(object, key, bind(object[key], object));
  32272. });
  32273. return object;
  32274. });
  32275. /**
  32276. * Creates a function that iterates over `pairs` and invokes the corresponding
  32277. * function of the first predicate to return truthy. The predicate-function
  32278. * pairs are invoked with the `this` binding and arguments of the created
  32279. * function.
  32280. *
  32281. * @static
  32282. * @memberOf _
  32283. * @since 4.0.0
  32284. * @category Util
  32285. * @param {Array} pairs The predicate-function pairs.
  32286. * @returns {Function} Returns the new composite function.
  32287. * @example
  32288. *
  32289. * var func = _.cond([
  32290. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32291. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32292. * [_.stubTrue, _.constant('no match')]
  32293. * ]);
  32294. *
  32295. * func({ 'a': 1, 'b': 2 });
  32296. * // => 'matches A'
  32297. *
  32298. * func({ 'a': 0, 'b': 1 });
  32299. * // => 'matches B'
  32300. *
  32301. * func({ 'a': '1', 'b': '2' });
  32302. * // => 'no match'
  32303. */
  32304. function cond(pairs) {
  32305. var length = pairs == null ? 0 : pairs.length,
  32306. toIteratee = getIteratee();
  32307. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32308. if (typeof pair[1] != 'function') {
  32309. throw new TypeError(FUNC_ERROR_TEXT);
  32310. }
  32311. return [toIteratee(pair[0]), pair[1]];
  32312. });
  32313. return baseRest(function(args) {
  32314. var index = -1;
  32315. while (++index < length) {
  32316. var pair = pairs[index];
  32317. if (apply(pair[0], this, args)) {
  32318. return apply(pair[1], this, args);
  32319. }
  32320. }
  32321. });
  32322. }
  32323. /**
  32324. * Creates a function that invokes the predicate properties of `source` with
  32325. * the corresponding property values of a given object, returning `true` if
  32326. * all predicates return truthy, else `false`.
  32327. *
  32328. * **Note:** The created function is equivalent to `_.conformsTo` with
  32329. * `source` partially applied.
  32330. *
  32331. * @static
  32332. * @memberOf _
  32333. * @since 4.0.0
  32334. * @category Util
  32335. * @param {Object} source The object of property predicates to conform to.
  32336. * @returns {Function} Returns the new spec function.
  32337. * @example
  32338. *
  32339. * var objects = [
  32340. * { 'a': 2, 'b': 1 },
  32341. * { 'a': 1, 'b': 2 }
  32342. * ];
  32343. *
  32344. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32345. * // => [{ 'a': 1, 'b': 2 }]
  32346. */
  32347. function conforms(source) {
  32348. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32349. }
  32350. /**
  32351. * Creates a function that returns `value`.
  32352. *
  32353. * @static
  32354. * @memberOf _
  32355. * @since 2.4.0
  32356. * @category Util
  32357. * @param {*} value The value to return from the new function.
  32358. * @returns {Function} Returns the new constant function.
  32359. * @example
  32360. *
  32361. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32362. *
  32363. * console.log(objects);
  32364. * // => [{ 'a': 1 }, { 'a': 1 }]
  32365. *
  32366. * console.log(objects[0] === objects[1]);
  32367. * // => true
  32368. */
  32369. function constant(value) {
  32370. return function() {
  32371. return value;
  32372. };
  32373. }
  32374. /**
  32375. * Checks `value` to determine whether a default value should be returned in
  32376. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32377. * or `undefined`.
  32378. *
  32379. * @static
  32380. * @memberOf _
  32381. * @since 4.14.0
  32382. * @category Util
  32383. * @param {*} value The value to check.
  32384. * @param {*} defaultValue The default value.
  32385. * @returns {*} Returns the resolved value.
  32386. * @example
  32387. *
  32388. * _.defaultTo(1, 10);
  32389. * // => 1
  32390. *
  32391. * _.defaultTo(undefined, 10);
  32392. * // => 10
  32393. */
  32394. function defaultTo(value, defaultValue) {
  32395. return (value == null || value !== value) ? defaultValue : value;
  32396. }
  32397. /**
  32398. * Creates a function that returns the result of invoking the given functions
  32399. * with the `this` binding of the created function, where each successive
  32400. * invocation is supplied the return value of the previous.
  32401. *
  32402. * @static
  32403. * @memberOf _
  32404. * @since 3.0.0
  32405. * @category Util
  32406. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32407. * @returns {Function} Returns the new composite function.
  32408. * @see _.flowRight
  32409. * @example
  32410. *
  32411. * function square(n) {
  32412. * return n * n;
  32413. * }
  32414. *
  32415. * var addSquare = _.flow([_.add, square]);
  32416. * addSquare(1, 2);
  32417. * // => 9
  32418. */
  32419. var flow = createFlow();
  32420. /**
  32421. * This method is like `_.flow` except that it creates a function that
  32422. * invokes the given functions from right to left.
  32423. *
  32424. * @static
  32425. * @since 3.0.0
  32426. * @memberOf _
  32427. * @category Util
  32428. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32429. * @returns {Function} Returns the new composite function.
  32430. * @see _.flow
  32431. * @example
  32432. *
  32433. * function square(n) {
  32434. * return n * n;
  32435. * }
  32436. *
  32437. * var addSquare = _.flowRight([square, _.add]);
  32438. * addSquare(1, 2);
  32439. * // => 9
  32440. */
  32441. var flowRight = createFlow(true);
  32442. /**
  32443. * This method returns the first argument it receives.
  32444. *
  32445. * @static
  32446. * @since 0.1.0
  32447. * @memberOf _
  32448. * @category Util
  32449. * @param {*} value Any value.
  32450. * @returns {*} Returns `value`.
  32451. * @example
  32452. *
  32453. * var object = { 'a': 1 };
  32454. *
  32455. * console.log(_.identity(object) === object);
  32456. * // => true
  32457. */
  32458. function identity(value) {
  32459. return value;
  32460. }
  32461. /**
  32462. * Creates a function that invokes `func` with the arguments of the created
  32463. * function. If `func` is a property name, the created function returns the
  32464. * property value for a given element. If `func` is an array or object, the
  32465. * created function returns `true` for elements that contain the equivalent
  32466. * source properties, otherwise it returns `false`.
  32467. *
  32468. * @static
  32469. * @since 4.0.0
  32470. * @memberOf _
  32471. * @category Util
  32472. * @param {*} [func=_.identity] The value to convert to a callback.
  32473. * @returns {Function} Returns the callback.
  32474. * @example
  32475. *
  32476. * var users = [
  32477. * { 'user': 'barney', 'age': 36, 'active': true },
  32478. * { 'user': 'fred', 'age': 40, 'active': false }
  32479. * ];
  32480. *
  32481. * // The `_.matches` iteratee shorthand.
  32482. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32483. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32484. *
  32485. * // The `_.matchesProperty` iteratee shorthand.
  32486. * _.filter(users, _.iteratee(['user', 'fred']));
  32487. * // => [{ 'user': 'fred', 'age': 40 }]
  32488. *
  32489. * // The `_.property` iteratee shorthand.
  32490. * _.map(users, _.iteratee('user'));
  32491. * // => ['barney', 'fred']
  32492. *
  32493. * // Create custom iteratee shorthands.
  32494. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32495. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32496. * return func.test(string);
  32497. * };
  32498. * });
  32499. *
  32500. * _.filter(['abc', 'def'], /ef/);
  32501. * // => ['def']
  32502. */
  32503. function iteratee(func) {
  32504. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32505. }
  32506. /**
  32507. * Creates a function that performs a partial deep comparison between a given
  32508. * object and `source`, returning `true` if the given object has equivalent
  32509. * property values, else `false`.
  32510. *
  32511. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32512. * partially applied.
  32513. *
  32514. * Partial comparisons will match empty array and empty object `source`
  32515. * values against any array or object value, respectively. See `_.isEqual`
  32516. * for a list of supported value comparisons.
  32517. *
  32518. * @static
  32519. * @memberOf _
  32520. * @since 3.0.0
  32521. * @category Util
  32522. * @param {Object} source The object of property values to match.
  32523. * @returns {Function} Returns the new spec function.
  32524. * @example
  32525. *
  32526. * var objects = [
  32527. * { 'a': 1, 'b': 2, 'c': 3 },
  32528. * { 'a': 4, 'b': 5, 'c': 6 }
  32529. * ];
  32530. *
  32531. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32532. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32533. */
  32534. function matches(source) {
  32535. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32536. }
  32537. /**
  32538. * Creates a function that performs a partial deep comparison between the
  32539. * value at `path` of a given object to `srcValue`, returning `true` if the
  32540. * object value is equivalent, else `false`.
  32541. *
  32542. * **Note:** Partial comparisons will match empty array and empty object
  32543. * `srcValue` values against any array or object value, respectively. See
  32544. * `_.isEqual` for a list of supported value comparisons.
  32545. *
  32546. * @static
  32547. * @memberOf _
  32548. * @since 3.2.0
  32549. * @category Util
  32550. * @param {Array|string} path The path of the property to get.
  32551. * @param {*} srcValue The value to match.
  32552. * @returns {Function} Returns the new spec function.
  32553. * @example
  32554. *
  32555. * var objects = [
  32556. * { 'a': 1, 'b': 2, 'c': 3 },
  32557. * { 'a': 4, 'b': 5, 'c': 6 }
  32558. * ];
  32559. *
  32560. * _.find(objects, _.matchesProperty('a', 4));
  32561. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32562. */
  32563. function matchesProperty(path, srcValue) {
  32564. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32565. }
  32566. /**
  32567. * Creates a function that invokes the method at `path` of a given object.
  32568. * Any additional arguments are provided to the invoked method.
  32569. *
  32570. * @static
  32571. * @memberOf _
  32572. * @since 3.7.0
  32573. * @category Util
  32574. * @param {Array|string} path The path of the method to invoke.
  32575. * @param {...*} [args] The arguments to invoke the method with.
  32576. * @returns {Function} Returns the new invoker function.
  32577. * @example
  32578. *
  32579. * var objects = [
  32580. * { 'a': { 'b': _.constant(2) } },
  32581. * { 'a': { 'b': _.constant(1) } }
  32582. * ];
  32583. *
  32584. * _.map(objects, _.method('a.b'));
  32585. * // => [2, 1]
  32586. *
  32587. * _.map(objects, _.method(['a', 'b']));
  32588. * // => [2, 1]
  32589. */
  32590. var method = baseRest(function(path, args) {
  32591. return function(object) {
  32592. return baseInvoke(object, path, args);
  32593. };
  32594. });
  32595. /**
  32596. * The opposite of `_.method`; this method creates a function that invokes
  32597. * the method at a given path of `object`. Any additional arguments are
  32598. * provided to the invoked method.
  32599. *
  32600. * @static
  32601. * @memberOf _
  32602. * @since 3.7.0
  32603. * @category Util
  32604. * @param {Object} object The object to query.
  32605. * @param {...*} [args] The arguments to invoke the method with.
  32606. * @returns {Function} Returns the new invoker function.
  32607. * @example
  32608. *
  32609. * var array = _.times(3, _.constant),
  32610. * object = { 'a': array, 'b': array, 'c': array };
  32611. *
  32612. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32613. * // => [2, 0]
  32614. *
  32615. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32616. * // => [2, 0]
  32617. */
  32618. var methodOf = baseRest(function(object, args) {
  32619. return function(path) {
  32620. return baseInvoke(object, path, args);
  32621. };
  32622. });
  32623. /**
  32624. * Adds all own enumerable string keyed function properties of a source
  32625. * object to the destination object. If `object` is a function, then methods
  32626. * are added to its prototype as well.
  32627. *
  32628. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32629. * avoid conflicts caused by modifying the original.
  32630. *
  32631. * @static
  32632. * @since 0.1.0
  32633. * @memberOf _
  32634. * @category Util
  32635. * @param {Function|Object} [object=lodash] The destination object.
  32636. * @param {Object} source The object of functions to add.
  32637. * @param {Object} [options={}] The options object.
  32638. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32639. * @returns {Function|Object} Returns `object`.
  32640. * @example
  32641. *
  32642. * function vowels(string) {
  32643. * return _.filter(string, function(v) {
  32644. * return /[aeiou]/i.test(v);
  32645. * });
  32646. * }
  32647. *
  32648. * _.mixin({ 'vowels': vowels });
  32649. * _.vowels('fred');
  32650. * // => ['e']
  32651. *
  32652. * _('fred').vowels().value();
  32653. * // => ['e']
  32654. *
  32655. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32656. * _('fred').vowels();
  32657. * // => ['e']
  32658. */
  32659. function mixin(object, source, options) {
  32660. var props = keys(source),
  32661. methodNames = baseFunctions(source, props);
  32662. if (options == null &&
  32663. !(isObject(source) && (methodNames.length || !props.length))) {
  32664. options = source;
  32665. source = object;
  32666. object = this;
  32667. methodNames = baseFunctions(source, keys(source));
  32668. }
  32669. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32670. isFunc = isFunction(object);
  32671. arrayEach(methodNames, function(methodName) {
  32672. var func = source[methodName];
  32673. object[methodName] = func;
  32674. if (isFunc) {
  32675. object.prototype[methodName] = function() {
  32676. var chainAll = this.__chain__;
  32677. if (chain || chainAll) {
  32678. var result = object(this.__wrapped__),
  32679. actions = result.__actions__ = copyArray(this.__actions__);
  32680. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32681. result.__chain__ = chainAll;
  32682. return result;
  32683. }
  32684. return func.apply(object, arrayPush([this.value()], arguments));
  32685. };
  32686. }
  32687. });
  32688. return object;
  32689. }
  32690. /**
  32691. * Reverts the `_` variable to its previous value and returns a reference to
  32692. * the `lodash` function.
  32693. *
  32694. * @static
  32695. * @since 0.1.0
  32696. * @memberOf _
  32697. * @category Util
  32698. * @returns {Function} Returns the `lodash` function.
  32699. * @example
  32700. *
  32701. * var lodash = _.noConflict();
  32702. */
  32703. function noConflict() {
  32704. if (root._ === this) {
  32705. root._ = oldDash;
  32706. }
  32707. return this;
  32708. }
  32709. /**
  32710. * This method returns `undefined`.
  32711. *
  32712. * @static
  32713. * @memberOf _
  32714. * @since 2.3.0
  32715. * @category Util
  32716. * @example
  32717. *
  32718. * _.times(2, _.noop);
  32719. * // => [undefined, undefined]
  32720. */
  32721. function noop() {
  32722. // No operation performed.
  32723. }
  32724. /**
  32725. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32726. * the nth argument from the end is returned.
  32727. *
  32728. * @static
  32729. * @memberOf _
  32730. * @since 4.0.0
  32731. * @category Util
  32732. * @param {number} [n=0] The index of the argument to return.
  32733. * @returns {Function} Returns the new pass-thru function.
  32734. * @example
  32735. *
  32736. * var func = _.nthArg(1);
  32737. * func('a', 'b', 'c', 'd');
  32738. * // => 'b'
  32739. *
  32740. * var func = _.nthArg(-2);
  32741. * func('a', 'b', 'c', 'd');
  32742. * // => 'c'
  32743. */
  32744. function nthArg(n) {
  32745. n = toInteger(n);
  32746. return baseRest(function(args) {
  32747. return baseNth(args, n);
  32748. });
  32749. }
  32750. /**
  32751. * Creates a function that invokes `iteratees` with the arguments it receives
  32752. * and returns their results.
  32753. *
  32754. * @static
  32755. * @memberOf _
  32756. * @since 4.0.0
  32757. * @category Util
  32758. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32759. * The iteratees to invoke.
  32760. * @returns {Function} Returns the new function.
  32761. * @example
  32762. *
  32763. * var func = _.over([Math.max, Math.min]);
  32764. *
  32765. * func(1, 2, 3, 4);
  32766. * // => [4, 1]
  32767. */
  32768. var over = createOver(arrayMap);
  32769. /**
  32770. * Creates a function that checks if **all** of the `predicates` return
  32771. * truthy when invoked with the arguments it receives.
  32772. *
  32773. * @static
  32774. * @memberOf _
  32775. * @since 4.0.0
  32776. * @category Util
  32777. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32778. * The predicates to check.
  32779. * @returns {Function} Returns the new function.
  32780. * @example
  32781. *
  32782. * var func = _.overEvery([Boolean, isFinite]);
  32783. *
  32784. * func('1');
  32785. * // => true
  32786. *
  32787. * func(null);
  32788. * // => false
  32789. *
  32790. * func(NaN);
  32791. * // => false
  32792. */
  32793. var overEvery = createOver(arrayEvery);
  32794. /**
  32795. * Creates a function that checks if **any** of the `predicates` return
  32796. * truthy when invoked with the arguments it receives.
  32797. *
  32798. * @static
  32799. * @memberOf _
  32800. * @since 4.0.0
  32801. * @category Util
  32802. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32803. * The predicates to check.
  32804. * @returns {Function} Returns the new function.
  32805. * @example
  32806. *
  32807. * var func = _.overSome([Boolean, isFinite]);
  32808. *
  32809. * func('1');
  32810. * // => true
  32811. *
  32812. * func(null);
  32813. * // => true
  32814. *
  32815. * func(NaN);
  32816. * // => false
  32817. */
  32818. var overSome = createOver(arraySome);
  32819. /**
  32820. * Creates a function that returns the value at `path` of a given object.
  32821. *
  32822. * @static
  32823. * @memberOf _
  32824. * @since 2.4.0
  32825. * @category Util
  32826. * @param {Array|string} path The path of the property to get.
  32827. * @returns {Function} Returns the new accessor function.
  32828. * @example
  32829. *
  32830. * var objects = [
  32831. * { 'a': { 'b': 2 } },
  32832. * { 'a': { 'b': 1 } }
  32833. * ];
  32834. *
  32835. * _.map(objects, _.property('a.b'));
  32836. * // => [2, 1]
  32837. *
  32838. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32839. * // => [1, 2]
  32840. */
  32841. function property(path) {
  32842. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32843. }
  32844. /**
  32845. * The opposite of `_.property`; this method creates a function that returns
  32846. * the value at a given path of `object`.
  32847. *
  32848. * @static
  32849. * @memberOf _
  32850. * @since 3.0.0
  32851. * @category Util
  32852. * @param {Object} object The object to query.
  32853. * @returns {Function} Returns the new accessor function.
  32854. * @example
  32855. *
  32856. * var array = [0, 1, 2],
  32857. * object = { 'a': array, 'b': array, 'c': array };
  32858. *
  32859. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32860. * // => [2, 0]
  32861. *
  32862. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32863. * // => [2, 0]
  32864. */
  32865. function propertyOf(object) {
  32866. return function(path) {
  32867. return object == null ? undefined : baseGet(object, path);
  32868. };
  32869. }
  32870. /**
  32871. * Creates an array of numbers (positive and/or negative) progressing from
  32872. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32873. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32874. * it's set to `start` with `start` then set to `0`.
  32875. *
  32876. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32877. * floating-point values which can produce unexpected results.
  32878. *
  32879. * @static
  32880. * @since 0.1.0
  32881. * @memberOf _
  32882. * @category Util
  32883. * @param {number} [start=0] The start of the range.
  32884. * @param {number} end The end of the range.
  32885. * @param {number} [step=1] The value to increment or decrement by.
  32886. * @returns {Array} Returns the range of numbers.
  32887. * @see _.inRange, _.rangeRight
  32888. * @example
  32889. *
  32890. * _.range(4);
  32891. * // => [0, 1, 2, 3]
  32892. *
  32893. * _.range(-4);
  32894. * // => [0, -1, -2, -3]
  32895. *
  32896. * _.range(1, 5);
  32897. * // => [1, 2, 3, 4]
  32898. *
  32899. * _.range(0, 20, 5);
  32900. * // => [0, 5, 10, 15]
  32901. *
  32902. * _.range(0, -4, -1);
  32903. * // => [0, -1, -2, -3]
  32904. *
  32905. * _.range(1, 4, 0);
  32906. * // => [1, 1, 1]
  32907. *
  32908. * _.range(0);
  32909. * // => []
  32910. */
  32911. var range = createRange();
  32912. /**
  32913. * This method is like `_.range` except that it populates values in
  32914. * descending order.
  32915. *
  32916. * @static
  32917. * @memberOf _
  32918. * @since 4.0.0
  32919. * @category Util
  32920. * @param {number} [start=0] The start of the range.
  32921. * @param {number} end The end of the range.
  32922. * @param {number} [step=1] The value to increment or decrement by.
  32923. * @returns {Array} Returns the range of numbers.
  32924. * @see _.inRange, _.range
  32925. * @example
  32926. *
  32927. * _.rangeRight(4);
  32928. * // => [3, 2, 1, 0]
  32929. *
  32930. * _.rangeRight(-4);
  32931. * // => [-3, -2, -1, 0]
  32932. *
  32933. * _.rangeRight(1, 5);
  32934. * // => [4, 3, 2, 1]
  32935. *
  32936. * _.rangeRight(0, 20, 5);
  32937. * // => [15, 10, 5, 0]
  32938. *
  32939. * _.rangeRight(0, -4, -1);
  32940. * // => [-3, -2, -1, 0]
  32941. *
  32942. * _.rangeRight(1, 4, 0);
  32943. * // => [1, 1, 1]
  32944. *
  32945. * _.rangeRight(0);
  32946. * // => []
  32947. */
  32948. var rangeRight = createRange(true);
  32949. /**
  32950. * This method returns a new empty array.
  32951. *
  32952. * @static
  32953. * @memberOf _
  32954. * @since 4.13.0
  32955. * @category Util
  32956. * @returns {Array} Returns the new empty array.
  32957. * @example
  32958. *
  32959. * var arrays = _.times(2, _.stubArray);
  32960. *
  32961. * console.log(arrays);
  32962. * // => [[], []]
  32963. *
  32964. * console.log(arrays[0] === arrays[1]);
  32965. * // => false
  32966. */
  32967. function stubArray() {
  32968. return [];
  32969. }
  32970. /**
  32971. * This method returns `false`.
  32972. *
  32973. * @static
  32974. * @memberOf _
  32975. * @since 4.13.0
  32976. * @category Util
  32977. * @returns {boolean} Returns `false`.
  32978. * @example
  32979. *
  32980. * _.times(2, _.stubFalse);
  32981. * // => [false, false]
  32982. */
  32983. function stubFalse() {
  32984. return false;
  32985. }
  32986. /**
  32987. * This method returns a new empty object.
  32988. *
  32989. * @static
  32990. * @memberOf _
  32991. * @since 4.13.0
  32992. * @category Util
  32993. * @returns {Object} Returns the new empty object.
  32994. * @example
  32995. *
  32996. * var objects = _.times(2, _.stubObject);
  32997. *
  32998. * console.log(objects);
  32999. * // => [{}, {}]
  33000. *
  33001. * console.log(objects[0] === objects[1]);
  33002. * // => false
  33003. */
  33004. function stubObject() {
  33005. return {};
  33006. }
  33007. /**
  33008. * This method returns an empty string.
  33009. *
  33010. * @static
  33011. * @memberOf _
  33012. * @since 4.13.0
  33013. * @category Util
  33014. * @returns {string} Returns the empty string.
  33015. * @example
  33016. *
  33017. * _.times(2, _.stubString);
  33018. * // => ['', '']
  33019. */
  33020. function stubString() {
  33021. return '';
  33022. }
  33023. /**
  33024. * This method returns `true`.
  33025. *
  33026. * @static
  33027. * @memberOf _
  33028. * @since 4.13.0
  33029. * @category Util
  33030. * @returns {boolean} Returns `true`.
  33031. * @example
  33032. *
  33033. * _.times(2, _.stubTrue);
  33034. * // => [true, true]
  33035. */
  33036. function stubTrue() {
  33037. return true;
  33038. }
  33039. /**
  33040. * Invokes the iteratee `n` times, returning an array of the results of
  33041. * each invocation. The iteratee is invoked with one argument; (index).
  33042. *
  33043. * @static
  33044. * @since 0.1.0
  33045. * @memberOf _
  33046. * @category Util
  33047. * @param {number} n The number of times to invoke `iteratee`.
  33048. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33049. * @returns {Array} Returns the array of results.
  33050. * @example
  33051. *
  33052. * _.times(3, String);
  33053. * // => ['0', '1', '2']
  33054. *
  33055. * _.times(4, _.constant(0));
  33056. * // => [0, 0, 0, 0]
  33057. */
  33058. function times(n, iteratee) {
  33059. n = toInteger(n);
  33060. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33061. return [];
  33062. }
  33063. var index = MAX_ARRAY_LENGTH,
  33064. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33065. iteratee = getIteratee(iteratee);
  33066. n -= MAX_ARRAY_LENGTH;
  33067. var result = baseTimes(length, iteratee);
  33068. while (++index < n) {
  33069. iteratee(index);
  33070. }
  33071. return result;
  33072. }
  33073. /**
  33074. * Converts `value` to a property path array.
  33075. *
  33076. * @static
  33077. * @memberOf _
  33078. * @since 4.0.0
  33079. * @category Util
  33080. * @param {*} value The value to convert.
  33081. * @returns {Array} Returns the new property path array.
  33082. * @example
  33083. *
  33084. * _.toPath('a.b.c');
  33085. * // => ['a', 'b', 'c']
  33086. *
  33087. * _.toPath('a[0].b.c');
  33088. * // => ['a', '0', 'b', 'c']
  33089. */
  33090. function toPath(value) {
  33091. if (isArray(value)) {
  33092. return arrayMap(value, toKey);
  33093. }
  33094. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33095. }
  33096. /**
  33097. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33098. *
  33099. * @static
  33100. * @since 0.1.0
  33101. * @memberOf _
  33102. * @category Util
  33103. * @param {string} [prefix=''] The value to prefix the ID with.
  33104. * @returns {string} Returns the unique ID.
  33105. * @example
  33106. *
  33107. * _.uniqueId('contact_');
  33108. * // => 'contact_104'
  33109. *
  33110. * _.uniqueId();
  33111. * // => '105'
  33112. */
  33113. function uniqueId(prefix) {
  33114. var id = ++idCounter;
  33115. return toString(prefix) + id;
  33116. }
  33117. /*------------------------------------------------------------------------*/
  33118. /**
  33119. * Adds two numbers.
  33120. *
  33121. * @static
  33122. * @memberOf _
  33123. * @since 3.4.0
  33124. * @category Math
  33125. * @param {number} augend The first number in an addition.
  33126. * @param {number} addend The second number in an addition.
  33127. * @returns {number} Returns the total.
  33128. * @example
  33129. *
  33130. * _.add(6, 4);
  33131. * // => 10
  33132. */
  33133. var add = createMathOperation(function(augend, addend) {
  33134. return augend + addend;
  33135. }, 0);
  33136. /**
  33137. * Computes `number` rounded up to `precision`.
  33138. *
  33139. * @static
  33140. * @memberOf _
  33141. * @since 3.10.0
  33142. * @category Math
  33143. * @param {number} number The number to round up.
  33144. * @param {number} [precision=0] The precision to round up to.
  33145. * @returns {number} Returns the rounded up number.
  33146. * @example
  33147. *
  33148. * _.ceil(4.006);
  33149. * // => 5
  33150. *
  33151. * _.ceil(6.004, 2);
  33152. * // => 6.01
  33153. *
  33154. * _.ceil(6040, -2);
  33155. * // => 6100
  33156. */
  33157. var ceil = createRound('ceil');
  33158. /**
  33159. * Divide two numbers.
  33160. *
  33161. * @static
  33162. * @memberOf _
  33163. * @since 4.7.0
  33164. * @category Math
  33165. * @param {number} dividend The first number in a division.
  33166. * @param {number} divisor The second number in a division.
  33167. * @returns {number} Returns the quotient.
  33168. * @example
  33169. *
  33170. * _.divide(6, 4);
  33171. * // => 1.5
  33172. */
  33173. var divide = createMathOperation(function(dividend, divisor) {
  33174. return dividend / divisor;
  33175. }, 1);
  33176. /**
  33177. * Computes `number` rounded down to `precision`.
  33178. *
  33179. * @static
  33180. * @memberOf _
  33181. * @since 3.10.0
  33182. * @category Math
  33183. * @param {number} number The number to round down.
  33184. * @param {number} [precision=0] The precision to round down to.
  33185. * @returns {number} Returns the rounded down number.
  33186. * @example
  33187. *
  33188. * _.floor(4.006);
  33189. * // => 4
  33190. *
  33191. * _.floor(0.046, 2);
  33192. * // => 0.04
  33193. *
  33194. * _.floor(4060, -2);
  33195. * // => 4000
  33196. */
  33197. var floor = createRound('floor');
  33198. /**
  33199. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33200. * `undefined` is returned.
  33201. *
  33202. * @static
  33203. * @since 0.1.0
  33204. * @memberOf _
  33205. * @category Math
  33206. * @param {Array} array The array to iterate over.
  33207. * @returns {*} Returns the maximum value.
  33208. * @example
  33209. *
  33210. * _.max([4, 2, 8, 6]);
  33211. * // => 8
  33212. *
  33213. * _.max([]);
  33214. * // => undefined
  33215. */
  33216. function max(array) {
  33217. return (array && array.length)
  33218. ? baseExtremum(array, identity, baseGt)
  33219. : undefined;
  33220. }
  33221. /**
  33222. * This method is like `_.max` except that it accepts `iteratee` which is
  33223. * invoked for each element in `array` to generate the criterion by which
  33224. * the value is ranked. The iteratee is invoked with one argument: (value).
  33225. *
  33226. * @static
  33227. * @memberOf _
  33228. * @since 4.0.0
  33229. * @category Math
  33230. * @param {Array} array The array to iterate over.
  33231. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33232. * @returns {*} Returns the maximum value.
  33233. * @example
  33234. *
  33235. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33236. *
  33237. * _.maxBy(objects, function(o) { return o.n; });
  33238. * // => { 'n': 2 }
  33239. *
  33240. * // The `_.property` iteratee shorthand.
  33241. * _.maxBy(objects, 'n');
  33242. * // => { 'n': 2 }
  33243. */
  33244. function maxBy(array, iteratee) {
  33245. return (array && array.length)
  33246. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33247. : undefined;
  33248. }
  33249. /**
  33250. * Computes the mean of the values in `array`.
  33251. *
  33252. * @static
  33253. * @memberOf _
  33254. * @since 4.0.0
  33255. * @category Math
  33256. * @param {Array} array The array to iterate over.
  33257. * @returns {number} Returns the mean.
  33258. * @example
  33259. *
  33260. * _.mean([4, 2, 8, 6]);
  33261. * // => 5
  33262. */
  33263. function mean(array) {
  33264. return baseMean(array, identity);
  33265. }
  33266. /**
  33267. * This method is like `_.mean` except that it accepts `iteratee` which is
  33268. * invoked for each element in `array` to generate the value to be averaged.
  33269. * The iteratee is invoked with one argument: (value).
  33270. *
  33271. * @static
  33272. * @memberOf _
  33273. * @since 4.7.0
  33274. * @category Math
  33275. * @param {Array} array The array to iterate over.
  33276. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33277. * @returns {number} Returns the mean.
  33278. * @example
  33279. *
  33280. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33281. *
  33282. * _.meanBy(objects, function(o) { return o.n; });
  33283. * // => 5
  33284. *
  33285. * // The `_.property` iteratee shorthand.
  33286. * _.meanBy(objects, 'n');
  33287. * // => 5
  33288. */
  33289. function meanBy(array, iteratee) {
  33290. return baseMean(array, getIteratee(iteratee, 2));
  33291. }
  33292. /**
  33293. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33294. * `undefined` is returned.
  33295. *
  33296. * @static
  33297. * @since 0.1.0
  33298. * @memberOf _
  33299. * @category Math
  33300. * @param {Array} array The array to iterate over.
  33301. * @returns {*} Returns the minimum value.
  33302. * @example
  33303. *
  33304. * _.min([4, 2, 8, 6]);
  33305. * // => 2
  33306. *
  33307. * _.min([]);
  33308. * // => undefined
  33309. */
  33310. function min(array) {
  33311. return (array && array.length)
  33312. ? baseExtremum(array, identity, baseLt)
  33313. : undefined;
  33314. }
  33315. /**
  33316. * This method is like `_.min` except that it accepts `iteratee` which is
  33317. * invoked for each element in `array` to generate the criterion by which
  33318. * the value is ranked. The iteratee is invoked with one argument: (value).
  33319. *
  33320. * @static
  33321. * @memberOf _
  33322. * @since 4.0.0
  33323. * @category Math
  33324. * @param {Array} array The array to iterate over.
  33325. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33326. * @returns {*} Returns the minimum value.
  33327. * @example
  33328. *
  33329. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33330. *
  33331. * _.minBy(objects, function(o) { return o.n; });
  33332. * // => { 'n': 1 }
  33333. *
  33334. * // The `_.property` iteratee shorthand.
  33335. * _.minBy(objects, 'n');
  33336. * // => { 'n': 1 }
  33337. */
  33338. function minBy(array, iteratee) {
  33339. return (array && array.length)
  33340. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33341. : undefined;
  33342. }
  33343. /**
  33344. * Multiply two numbers.
  33345. *
  33346. * @static
  33347. * @memberOf _
  33348. * @since 4.7.0
  33349. * @category Math
  33350. * @param {number} multiplier The first number in a multiplication.
  33351. * @param {number} multiplicand The second number in a multiplication.
  33352. * @returns {number} Returns the product.
  33353. * @example
  33354. *
  33355. * _.multiply(6, 4);
  33356. * // => 24
  33357. */
  33358. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33359. return multiplier * multiplicand;
  33360. }, 1);
  33361. /**
  33362. * Computes `number` rounded to `precision`.
  33363. *
  33364. * @static
  33365. * @memberOf _
  33366. * @since 3.10.0
  33367. * @category Math
  33368. * @param {number} number The number to round.
  33369. * @param {number} [precision=0] The precision to round to.
  33370. * @returns {number} Returns the rounded number.
  33371. * @example
  33372. *
  33373. * _.round(4.006);
  33374. * // => 4
  33375. *
  33376. * _.round(4.006, 2);
  33377. * // => 4.01
  33378. *
  33379. * _.round(4060, -2);
  33380. * // => 4100
  33381. */
  33382. var round = createRound('round');
  33383. /**
  33384. * Subtract two numbers.
  33385. *
  33386. * @static
  33387. * @memberOf _
  33388. * @since 4.0.0
  33389. * @category Math
  33390. * @param {number} minuend The first number in a subtraction.
  33391. * @param {number} subtrahend The second number in a subtraction.
  33392. * @returns {number} Returns the difference.
  33393. * @example
  33394. *
  33395. * _.subtract(6, 4);
  33396. * // => 2
  33397. */
  33398. var subtract = createMathOperation(function(minuend, subtrahend) {
  33399. return minuend - subtrahend;
  33400. }, 0);
  33401. /**
  33402. * Computes the sum of the values in `array`.
  33403. *
  33404. * @static
  33405. * @memberOf _
  33406. * @since 3.4.0
  33407. * @category Math
  33408. * @param {Array} array The array to iterate over.
  33409. * @returns {number} Returns the sum.
  33410. * @example
  33411. *
  33412. * _.sum([4, 2, 8, 6]);
  33413. * // => 20
  33414. */
  33415. function sum(array) {
  33416. return (array && array.length)
  33417. ? baseSum(array, identity)
  33418. : 0;
  33419. }
  33420. /**
  33421. * This method is like `_.sum` except that it accepts `iteratee` which is
  33422. * invoked for each element in `array` to generate the value to be summed.
  33423. * The iteratee is invoked with one argument: (value).
  33424. *
  33425. * @static
  33426. * @memberOf _
  33427. * @since 4.0.0
  33428. * @category Math
  33429. * @param {Array} array The array to iterate over.
  33430. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33431. * @returns {number} Returns the sum.
  33432. * @example
  33433. *
  33434. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33435. *
  33436. * _.sumBy(objects, function(o) { return o.n; });
  33437. * // => 20
  33438. *
  33439. * // The `_.property` iteratee shorthand.
  33440. * _.sumBy(objects, 'n');
  33441. * // => 20
  33442. */
  33443. function sumBy(array, iteratee) {
  33444. return (array && array.length)
  33445. ? baseSum(array, getIteratee(iteratee, 2))
  33446. : 0;
  33447. }
  33448. /*------------------------------------------------------------------------*/
  33449. // Add methods that return wrapped values in chain sequences.
  33450. lodash.after = after;
  33451. lodash.ary = ary;
  33452. lodash.assign = assign;
  33453. lodash.assignIn = assignIn;
  33454. lodash.assignInWith = assignInWith;
  33455. lodash.assignWith = assignWith;
  33456. lodash.at = at;
  33457. lodash.before = before;
  33458. lodash.bind = bind;
  33459. lodash.bindAll = bindAll;
  33460. lodash.bindKey = bindKey;
  33461. lodash.castArray = castArray;
  33462. lodash.chain = chain;
  33463. lodash.chunk = chunk;
  33464. lodash.compact = compact;
  33465. lodash.concat = concat;
  33466. lodash.cond = cond;
  33467. lodash.conforms = conforms;
  33468. lodash.constant = constant;
  33469. lodash.countBy = countBy;
  33470. lodash.create = create;
  33471. lodash.curry = curry;
  33472. lodash.curryRight = curryRight;
  33473. lodash.debounce = debounce;
  33474. lodash.defaults = defaults;
  33475. lodash.defaultsDeep = defaultsDeep;
  33476. lodash.defer = defer;
  33477. lodash.delay = delay;
  33478. lodash.difference = difference;
  33479. lodash.differenceBy = differenceBy;
  33480. lodash.differenceWith = differenceWith;
  33481. lodash.drop = drop;
  33482. lodash.dropRight = dropRight;
  33483. lodash.dropRightWhile = dropRightWhile;
  33484. lodash.dropWhile = dropWhile;
  33485. lodash.fill = fill;
  33486. lodash.filter = filter;
  33487. lodash.flatMap = flatMap;
  33488. lodash.flatMapDeep = flatMapDeep;
  33489. lodash.flatMapDepth = flatMapDepth;
  33490. lodash.flatten = flatten;
  33491. lodash.flattenDeep = flattenDeep;
  33492. lodash.flattenDepth = flattenDepth;
  33493. lodash.flip = flip;
  33494. lodash.flow = flow;
  33495. lodash.flowRight = flowRight;
  33496. lodash.fromPairs = fromPairs;
  33497. lodash.functions = functions;
  33498. lodash.functionsIn = functionsIn;
  33499. lodash.groupBy = groupBy;
  33500. lodash.initial = initial;
  33501. lodash.intersection = intersection;
  33502. lodash.intersectionBy = intersectionBy;
  33503. lodash.intersectionWith = intersectionWith;
  33504. lodash.invert = invert;
  33505. lodash.invertBy = invertBy;
  33506. lodash.invokeMap = invokeMap;
  33507. lodash.iteratee = iteratee;
  33508. lodash.keyBy = keyBy;
  33509. lodash.keys = keys;
  33510. lodash.keysIn = keysIn;
  33511. lodash.map = map;
  33512. lodash.mapKeys = mapKeys;
  33513. lodash.mapValues = mapValues;
  33514. lodash.matches = matches;
  33515. lodash.matchesProperty = matchesProperty;
  33516. lodash.memoize = memoize;
  33517. lodash.merge = merge;
  33518. lodash.mergeWith = mergeWith;
  33519. lodash.method = method;
  33520. lodash.methodOf = methodOf;
  33521. lodash.mixin = mixin;
  33522. lodash.negate = negate;
  33523. lodash.nthArg = nthArg;
  33524. lodash.omit = omit;
  33525. lodash.omitBy = omitBy;
  33526. lodash.once = once;
  33527. lodash.orderBy = orderBy;
  33528. lodash.over = over;
  33529. lodash.overArgs = overArgs;
  33530. lodash.overEvery = overEvery;
  33531. lodash.overSome = overSome;
  33532. lodash.partial = partial;
  33533. lodash.partialRight = partialRight;
  33534. lodash.partition = partition;
  33535. lodash.pick = pick;
  33536. lodash.pickBy = pickBy;
  33537. lodash.property = property;
  33538. lodash.propertyOf = propertyOf;
  33539. lodash.pull = pull;
  33540. lodash.pullAll = pullAll;
  33541. lodash.pullAllBy = pullAllBy;
  33542. lodash.pullAllWith = pullAllWith;
  33543. lodash.pullAt = pullAt;
  33544. lodash.range = range;
  33545. lodash.rangeRight = rangeRight;
  33546. lodash.rearg = rearg;
  33547. lodash.reject = reject;
  33548. lodash.remove = remove;
  33549. lodash.rest = rest;
  33550. lodash.reverse = reverse;
  33551. lodash.sampleSize = sampleSize;
  33552. lodash.set = set;
  33553. lodash.setWith = setWith;
  33554. lodash.shuffle = shuffle;
  33555. lodash.slice = slice;
  33556. lodash.sortBy = sortBy;
  33557. lodash.sortedUniq = sortedUniq;
  33558. lodash.sortedUniqBy = sortedUniqBy;
  33559. lodash.split = split;
  33560. lodash.spread = spread;
  33561. lodash.tail = tail;
  33562. lodash.take = take;
  33563. lodash.takeRight = takeRight;
  33564. lodash.takeRightWhile = takeRightWhile;
  33565. lodash.takeWhile = takeWhile;
  33566. lodash.tap = tap;
  33567. lodash.throttle = throttle;
  33568. lodash.thru = thru;
  33569. lodash.toArray = toArray;
  33570. lodash.toPairs = toPairs;
  33571. lodash.toPairsIn = toPairsIn;
  33572. lodash.toPath = toPath;
  33573. lodash.toPlainObject = toPlainObject;
  33574. lodash.transform = transform;
  33575. lodash.unary = unary;
  33576. lodash.union = union;
  33577. lodash.unionBy = unionBy;
  33578. lodash.unionWith = unionWith;
  33579. lodash.uniq = uniq;
  33580. lodash.uniqBy = uniqBy;
  33581. lodash.uniqWith = uniqWith;
  33582. lodash.unset = unset;
  33583. lodash.unzip = unzip;
  33584. lodash.unzipWith = unzipWith;
  33585. lodash.update = update;
  33586. lodash.updateWith = updateWith;
  33587. lodash.values = values;
  33588. lodash.valuesIn = valuesIn;
  33589. lodash.without = without;
  33590. lodash.words = words;
  33591. lodash.wrap = wrap;
  33592. lodash.xor = xor;
  33593. lodash.xorBy = xorBy;
  33594. lodash.xorWith = xorWith;
  33595. lodash.zip = zip;
  33596. lodash.zipObject = zipObject;
  33597. lodash.zipObjectDeep = zipObjectDeep;
  33598. lodash.zipWith = zipWith;
  33599. // Add aliases.
  33600. lodash.entries = toPairs;
  33601. lodash.entriesIn = toPairsIn;
  33602. lodash.extend = assignIn;
  33603. lodash.extendWith = assignInWith;
  33604. // Add methods to `lodash.prototype`.
  33605. mixin(lodash, lodash);
  33606. /*------------------------------------------------------------------------*/
  33607. // Add methods that return unwrapped values in chain sequences.
  33608. lodash.add = add;
  33609. lodash.attempt = attempt;
  33610. lodash.camelCase = camelCase;
  33611. lodash.capitalize = capitalize;
  33612. lodash.ceil = ceil;
  33613. lodash.clamp = clamp;
  33614. lodash.clone = clone;
  33615. lodash.cloneDeep = cloneDeep;
  33616. lodash.cloneDeepWith = cloneDeepWith;
  33617. lodash.cloneWith = cloneWith;
  33618. lodash.conformsTo = conformsTo;
  33619. lodash.deburr = deburr;
  33620. lodash.defaultTo = defaultTo;
  33621. lodash.divide = divide;
  33622. lodash.endsWith = endsWith;
  33623. lodash.eq = eq;
  33624. lodash.escape = escape;
  33625. lodash.escapeRegExp = escapeRegExp;
  33626. lodash.every = every;
  33627. lodash.find = find;
  33628. lodash.findIndex = findIndex;
  33629. lodash.findKey = findKey;
  33630. lodash.findLast = findLast;
  33631. lodash.findLastIndex = findLastIndex;
  33632. lodash.findLastKey = findLastKey;
  33633. lodash.floor = floor;
  33634. lodash.forEach = forEach;
  33635. lodash.forEachRight = forEachRight;
  33636. lodash.forIn = forIn;
  33637. lodash.forInRight = forInRight;
  33638. lodash.forOwn = forOwn;
  33639. lodash.forOwnRight = forOwnRight;
  33640. lodash.get = get;
  33641. lodash.gt = gt;
  33642. lodash.gte = gte;
  33643. lodash.has = has;
  33644. lodash.hasIn = hasIn;
  33645. lodash.head = head;
  33646. lodash.identity = identity;
  33647. lodash.includes = includes;
  33648. lodash.indexOf = indexOf;
  33649. lodash.inRange = inRange;
  33650. lodash.invoke = invoke;
  33651. lodash.isArguments = isArguments;
  33652. lodash.isArray = isArray;
  33653. lodash.isArrayBuffer = isArrayBuffer;
  33654. lodash.isArrayLike = isArrayLike;
  33655. lodash.isArrayLikeObject = isArrayLikeObject;
  33656. lodash.isBoolean = isBoolean;
  33657. lodash.isBuffer = isBuffer;
  33658. lodash.isDate = isDate;
  33659. lodash.isElement = isElement;
  33660. lodash.isEmpty = isEmpty;
  33661. lodash.isEqual = isEqual;
  33662. lodash.isEqualWith = isEqualWith;
  33663. lodash.isError = isError;
  33664. lodash.isFinite = isFinite;
  33665. lodash.isFunction = isFunction;
  33666. lodash.isInteger = isInteger;
  33667. lodash.isLength = isLength;
  33668. lodash.isMap = isMap;
  33669. lodash.isMatch = isMatch;
  33670. lodash.isMatchWith = isMatchWith;
  33671. lodash.isNaN = isNaN;
  33672. lodash.isNative = isNative;
  33673. lodash.isNil = isNil;
  33674. lodash.isNull = isNull;
  33675. lodash.isNumber = isNumber;
  33676. lodash.isObject = isObject;
  33677. lodash.isObjectLike = isObjectLike;
  33678. lodash.isPlainObject = isPlainObject;
  33679. lodash.isRegExp = isRegExp;
  33680. lodash.isSafeInteger = isSafeInteger;
  33681. lodash.isSet = isSet;
  33682. lodash.isString = isString;
  33683. lodash.isSymbol = isSymbol;
  33684. lodash.isTypedArray = isTypedArray;
  33685. lodash.isUndefined = isUndefined;
  33686. lodash.isWeakMap = isWeakMap;
  33687. lodash.isWeakSet = isWeakSet;
  33688. lodash.join = join;
  33689. lodash.kebabCase = kebabCase;
  33690. lodash.last = last;
  33691. lodash.lastIndexOf = lastIndexOf;
  33692. lodash.lowerCase = lowerCase;
  33693. lodash.lowerFirst = lowerFirst;
  33694. lodash.lt = lt;
  33695. lodash.lte = lte;
  33696. lodash.max = max;
  33697. lodash.maxBy = maxBy;
  33698. lodash.mean = mean;
  33699. lodash.meanBy = meanBy;
  33700. lodash.min = min;
  33701. lodash.minBy = minBy;
  33702. lodash.stubArray = stubArray;
  33703. lodash.stubFalse = stubFalse;
  33704. lodash.stubObject = stubObject;
  33705. lodash.stubString = stubString;
  33706. lodash.stubTrue = stubTrue;
  33707. lodash.multiply = multiply;
  33708. lodash.nth = nth;
  33709. lodash.noConflict = noConflict;
  33710. lodash.noop = noop;
  33711. lodash.now = now;
  33712. lodash.pad = pad;
  33713. lodash.padEnd = padEnd;
  33714. lodash.padStart = padStart;
  33715. lodash.parseInt = parseInt;
  33716. lodash.random = random;
  33717. lodash.reduce = reduce;
  33718. lodash.reduceRight = reduceRight;
  33719. lodash.repeat = repeat;
  33720. lodash.replace = replace;
  33721. lodash.result = result;
  33722. lodash.round = round;
  33723. lodash.runInContext = runInContext;
  33724. lodash.sample = sample;
  33725. lodash.size = size;
  33726. lodash.snakeCase = snakeCase;
  33727. lodash.some = some;
  33728. lodash.sortedIndex = sortedIndex;
  33729. lodash.sortedIndexBy = sortedIndexBy;
  33730. lodash.sortedIndexOf = sortedIndexOf;
  33731. lodash.sortedLastIndex = sortedLastIndex;
  33732. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33733. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33734. lodash.startCase = startCase;
  33735. lodash.startsWith = startsWith;
  33736. lodash.subtract = subtract;
  33737. lodash.sum = sum;
  33738. lodash.sumBy = sumBy;
  33739. lodash.template = template;
  33740. lodash.times = times;
  33741. lodash.toFinite = toFinite;
  33742. lodash.toInteger = toInteger;
  33743. lodash.toLength = toLength;
  33744. lodash.toLower = toLower;
  33745. lodash.toNumber = toNumber;
  33746. lodash.toSafeInteger = toSafeInteger;
  33747. lodash.toString = toString;
  33748. lodash.toUpper = toUpper;
  33749. lodash.trim = trim;
  33750. lodash.trimEnd = trimEnd;
  33751. lodash.trimStart = trimStart;
  33752. lodash.truncate = truncate;
  33753. lodash.unescape = unescape;
  33754. lodash.uniqueId = uniqueId;
  33755. lodash.upperCase = upperCase;
  33756. lodash.upperFirst = upperFirst;
  33757. // Add aliases.
  33758. lodash.each = forEach;
  33759. lodash.eachRight = forEachRight;
  33760. lodash.first = head;
  33761. mixin(lodash, (function() {
  33762. var source = {};
  33763. baseForOwn(lodash, function(func, methodName) {
  33764. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33765. source[methodName] = func;
  33766. }
  33767. });
  33768. return source;
  33769. }()), { 'chain': false });
  33770. /*------------------------------------------------------------------------*/
  33771. /**
  33772. * The semantic version number.
  33773. *
  33774. * @static
  33775. * @memberOf _
  33776. * @type {string}
  33777. */
  33778. lodash.VERSION = VERSION;
  33779. // Assign default placeholders.
  33780. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33781. lodash[methodName].placeholder = lodash;
  33782. });
  33783. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33784. arrayEach(['drop', 'take'], function(methodName, index) {
  33785. LazyWrapper.prototype[methodName] = function(n) {
  33786. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33787. var result = (this.__filtered__ && !index)
  33788. ? new LazyWrapper(this)
  33789. : this.clone();
  33790. if (result.__filtered__) {
  33791. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33792. } else {
  33793. result.__views__.push({
  33794. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33795. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33796. });
  33797. }
  33798. return result;
  33799. };
  33800. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33801. return this.reverse()[methodName](n).reverse();
  33802. };
  33803. });
  33804. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33805. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33806. var type = index + 1,
  33807. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33808. LazyWrapper.prototype[methodName] = function(iteratee) {
  33809. var result = this.clone();
  33810. result.__iteratees__.push({
  33811. 'iteratee': getIteratee(iteratee, 3),
  33812. 'type': type
  33813. });
  33814. result.__filtered__ = result.__filtered__ || isFilter;
  33815. return result;
  33816. };
  33817. });
  33818. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33819. arrayEach(['head', 'last'], function(methodName, index) {
  33820. var takeName = 'take' + (index ? 'Right' : '');
  33821. LazyWrapper.prototype[methodName] = function() {
  33822. return this[takeName](1).value()[0];
  33823. };
  33824. });
  33825. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33826. arrayEach(['initial', 'tail'], function(methodName, index) {
  33827. var dropName = 'drop' + (index ? '' : 'Right');
  33828. LazyWrapper.prototype[methodName] = function() {
  33829. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33830. };
  33831. });
  33832. LazyWrapper.prototype.compact = function() {
  33833. return this.filter(identity);
  33834. };
  33835. LazyWrapper.prototype.find = function(predicate) {
  33836. return this.filter(predicate).head();
  33837. };
  33838. LazyWrapper.prototype.findLast = function(predicate) {
  33839. return this.reverse().find(predicate);
  33840. };
  33841. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33842. if (typeof path == 'function') {
  33843. return new LazyWrapper(this);
  33844. }
  33845. return this.map(function(value) {
  33846. return baseInvoke(value, path, args);
  33847. });
  33848. });
  33849. LazyWrapper.prototype.reject = function(predicate) {
  33850. return this.filter(negate(getIteratee(predicate)));
  33851. };
  33852. LazyWrapper.prototype.slice = function(start, end) {
  33853. start = toInteger(start);
  33854. var result = this;
  33855. if (result.__filtered__ && (start > 0 || end < 0)) {
  33856. return new LazyWrapper(result);
  33857. }
  33858. if (start < 0) {
  33859. result = result.takeRight(-start);
  33860. } else if (start) {
  33861. result = result.drop(start);
  33862. }
  33863. if (end !== undefined) {
  33864. end = toInteger(end);
  33865. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33866. }
  33867. return result;
  33868. };
  33869. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33870. return this.reverse().takeWhile(predicate).reverse();
  33871. };
  33872. LazyWrapper.prototype.toArray = function() {
  33873. return this.take(MAX_ARRAY_LENGTH);
  33874. };
  33875. // Add `LazyWrapper` methods to `lodash.prototype`.
  33876. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33877. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33878. isTaker = /^(?:head|last)$/.test(methodName),
  33879. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33880. retUnwrapped = isTaker || /^find/.test(methodName);
  33881. if (!lodashFunc) {
  33882. return;
  33883. }
  33884. lodash.prototype[methodName] = function() {
  33885. var value = this.__wrapped__,
  33886. args = isTaker ? [1] : arguments,
  33887. isLazy = value instanceof LazyWrapper,
  33888. iteratee = args[0],
  33889. useLazy = isLazy || isArray(value);
  33890. var interceptor = function(value) {
  33891. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33892. return (isTaker && chainAll) ? result[0] : result;
  33893. };
  33894. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33895. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33896. isLazy = useLazy = false;
  33897. }
  33898. var chainAll = this.__chain__,
  33899. isHybrid = !!this.__actions__.length,
  33900. isUnwrapped = retUnwrapped && !chainAll,
  33901. onlyLazy = isLazy && !isHybrid;
  33902. if (!retUnwrapped && useLazy) {
  33903. value = onlyLazy ? value : new LazyWrapper(this);
  33904. var result = func.apply(value, args);
  33905. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33906. return new LodashWrapper(result, chainAll);
  33907. }
  33908. if (isUnwrapped && onlyLazy) {
  33909. return func.apply(this, args);
  33910. }
  33911. result = this.thru(interceptor);
  33912. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33913. };
  33914. });
  33915. // Add `Array` methods to `lodash.prototype`.
  33916. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33917. var func = arrayProto[methodName],
  33918. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33919. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33920. lodash.prototype[methodName] = function() {
  33921. var args = arguments;
  33922. if (retUnwrapped && !this.__chain__) {
  33923. var value = this.value();
  33924. return func.apply(isArray(value) ? value : [], args);
  33925. }
  33926. return this[chainName](function(value) {
  33927. return func.apply(isArray(value) ? value : [], args);
  33928. });
  33929. };
  33930. });
  33931. // Map minified method names to their real names.
  33932. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33933. var lodashFunc = lodash[methodName];
  33934. if (lodashFunc) {
  33935. var key = lodashFunc.name + '';
  33936. if (!hasOwnProperty.call(realNames, key)) {
  33937. realNames[key] = [];
  33938. }
  33939. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  33940. }
  33941. });
  33942. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  33943. 'name': 'wrapper',
  33944. 'func': undefined
  33945. }];
  33946. // Add methods to `LazyWrapper`.
  33947. LazyWrapper.prototype.clone = lazyClone;
  33948. LazyWrapper.prototype.reverse = lazyReverse;
  33949. LazyWrapper.prototype.value = lazyValue;
  33950. // Add chain sequence methods to the `lodash` wrapper.
  33951. lodash.prototype.at = wrapperAt;
  33952. lodash.prototype.chain = wrapperChain;
  33953. lodash.prototype.commit = wrapperCommit;
  33954. lodash.prototype.next = wrapperNext;
  33955. lodash.prototype.plant = wrapperPlant;
  33956. lodash.prototype.reverse = wrapperReverse;
  33957. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  33958. // Add lazy aliases.
  33959. lodash.prototype.first = lodash.prototype.head;
  33960. if (symIterator) {
  33961. lodash.prototype[symIterator] = wrapperToIterator;
  33962. }
  33963. return lodash;
  33964. });
  33965. /*--------------------------------------------------------------------------*/
  33966. // Export lodash.
  33967. var _ = runInContext();
  33968. // Some AMD build optimizers, like r.js, check for condition patterns like:
  33969. if (true) {
  33970. // Expose Lodash on the global object to prevent errors when Lodash is
  33971. // loaded by a script tag in the presence of an AMD loader.
  33972. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  33973. // Use `_.noConflict` to remove Lodash from the global object.
  33974. root._ = _;
  33975. // Define as an anonymous module so, through path mapping, it can be
  33976. // referenced as the "underscore" module.
  33977. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  33978. return _;
  33979. }).call(exports, __webpack_require__, exports, module),
  33980. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  33981. }
  33982. // Check for `exports` after `define` in case a build optimizer adds it.
  33983. else {}
  33984. }.call(this));
  33985. /* 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)))
  33986. /***/ }),
  33987. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  33988. /*!***************************************************!*\
  33989. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  33990. \***************************************************/
  33991. /*! exports provided: default */
  33992. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  33993. "use strict";
  33994. __webpack_require__.r(__webpack_exports__);
  33995. /* WEBPACK VAR INJECTION */(function(global) {/**!
  33996. * @fileOverview Kickass library to create and place poppers near their reference elements.
  33997. * @version 1.16.1
  33998. * @license
  33999. * Copyright (c) 2016 Federico Zivolo and contributors
  34000. *
  34001. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34002. * of this software and associated documentation files (the "Software"), to deal
  34003. * in the Software without restriction, including without limitation the rights
  34004. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34005. * copies of the Software, and to permit persons to whom the Software is
  34006. * furnished to do so, subject to the following conditions:
  34007. *
  34008. * The above copyright notice and this permission notice shall be included in all
  34009. * copies or substantial portions of the Software.
  34010. *
  34011. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34012. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34013. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34014. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34015. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34016. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34017. * SOFTWARE.
  34018. */
  34019. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34020. var timeoutDuration = function () {
  34021. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34022. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34023. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34024. return 1;
  34025. }
  34026. }
  34027. return 0;
  34028. }();
  34029. function microtaskDebounce(fn) {
  34030. var called = false;
  34031. return function () {
  34032. if (called) {
  34033. return;
  34034. }
  34035. called = true;
  34036. window.Promise.resolve().then(function () {
  34037. called = false;
  34038. fn();
  34039. });
  34040. };
  34041. }
  34042. function taskDebounce(fn) {
  34043. var scheduled = false;
  34044. return function () {
  34045. if (!scheduled) {
  34046. scheduled = true;
  34047. setTimeout(function () {
  34048. scheduled = false;
  34049. fn();
  34050. }, timeoutDuration);
  34051. }
  34052. };
  34053. }
  34054. var supportsMicroTasks = isBrowser && window.Promise;
  34055. /**
  34056. * Create a debounced version of a method, that's asynchronously deferred
  34057. * but called in the minimum time possible.
  34058. *
  34059. * @method
  34060. * @memberof Popper.Utils
  34061. * @argument {Function} fn
  34062. * @returns {Function}
  34063. */
  34064. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34065. /**
  34066. * Check if the given variable is a function
  34067. * @method
  34068. * @memberof Popper.Utils
  34069. * @argument {Any} functionToCheck - variable to check
  34070. * @returns {Boolean} answer to: is a function?
  34071. */
  34072. function isFunction(functionToCheck) {
  34073. var getType = {};
  34074. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34075. }
  34076. /**
  34077. * Get CSS computed property of the given element
  34078. * @method
  34079. * @memberof Popper.Utils
  34080. * @argument {Eement} element
  34081. * @argument {String} property
  34082. */
  34083. function getStyleComputedProperty(element, property) {
  34084. if (element.nodeType !== 1) {
  34085. return [];
  34086. }
  34087. // NOTE: 1 DOM access here
  34088. var window = element.ownerDocument.defaultView;
  34089. var css = window.getComputedStyle(element, null);
  34090. return property ? css[property] : css;
  34091. }
  34092. /**
  34093. * Returns the parentNode or the host of the element
  34094. * @method
  34095. * @memberof Popper.Utils
  34096. * @argument {Element} element
  34097. * @returns {Element} parent
  34098. */
  34099. function getParentNode(element) {
  34100. if (element.nodeName === 'HTML') {
  34101. return element;
  34102. }
  34103. return element.parentNode || element.host;
  34104. }
  34105. /**
  34106. * Returns the scrolling parent of the given element
  34107. * @method
  34108. * @memberof Popper.Utils
  34109. * @argument {Element} element
  34110. * @returns {Element} scroll parent
  34111. */
  34112. function getScrollParent(element) {
  34113. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34114. if (!element) {
  34115. return document.body;
  34116. }
  34117. switch (element.nodeName) {
  34118. case 'HTML':
  34119. case 'BODY':
  34120. return element.ownerDocument.body;
  34121. case '#document':
  34122. return element.body;
  34123. }
  34124. // Firefox want us to check `-x` and `-y` variations as well
  34125. var _getStyleComputedProp = getStyleComputedProperty(element),
  34126. overflow = _getStyleComputedProp.overflow,
  34127. overflowX = _getStyleComputedProp.overflowX,
  34128. overflowY = _getStyleComputedProp.overflowY;
  34129. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34130. return element;
  34131. }
  34132. return getScrollParent(getParentNode(element));
  34133. }
  34134. /**
  34135. * Returns the reference node of the reference object, or the reference object itself.
  34136. * @method
  34137. * @memberof Popper.Utils
  34138. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34139. * @returns {Element} parent
  34140. */
  34141. function getReferenceNode(reference) {
  34142. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34143. }
  34144. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34145. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34146. /**
  34147. * Determines if the browser is Internet Explorer
  34148. * @method
  34149. * @memberof Popper.Utils
  34150. * @param {Number} version to check
  34151. * @returns {Boolean} isIE
  34152. */
  34153. function isIE(version) {
  34154. if (version === 11) {
  34155. return isIE11;
  34156. }
  34157. if (version === 10) {
  34158. return isIE10;
  34159. }
  34160. return isIE11 || isIE10;
  34161. }
  34162. /**
  34163. * Returns the offset parent of the given element
  34164. * @method
  34165. * @memberof Popper.Utils
  34166. * @argument {Element} element
  34167. * @returns {Element} offset parent
  34168. */
  34169. function getOffsetParent(element) {
  34170. if (!element) {
  34171. return document.documentElement;
  34172. }
  34173. var noOffsetParent = isIE(10) ? document.body : null;
  34174. // NOTE: 1 DOM access here
  34175. var offsetParent = element.offsetParent || null;
  34176. // Skip hidden elements which don't have an offsetParent
  34177. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34178. offsetParent = (element = element.nextElementSibling).offsetParent;
  34179. }
  34180. var nodeName = offsetParent && offsetParent.nodeName;
  34181. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34182. return element ? element.ownerDocument.documentElement : document.documentElement;
  34183. }
  34184. // .offsetParent will return the closest TH, TD or TABLE in case
  34185. // no offsetParent is present, I hate this job...
  34186. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34187. return getOffsetParent(offsetParent);
  34188. }
  34189. return offsetParent;
  34190. }
  34191. function isOffsetContainer(element) {
  34192. var nodeName = element.nodeName;
  34193. if (nodeName === 'BODY') {
  34194. return false;
  34195. }
  34196. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34197. }
  34198. /**
  34199. * Finds the root node (document, shadowDOM root) of the given element
  34200. * @method
  34201. * @memberof Popper.Utils
  34202. * @argument {Element} node
  34203. * @returns {Element} root node
  34204. */
  34205. function getRoot(node) {
  34206. if (node.parentNode !== null) {
  34207. return getRoot(node.parentNode);
  34208. }
  34209. return node;
  34210. }
  34211. /**
  34212. * Finds the offset parent common to the two provided nodes
  34213. * @method
  34214. * @memberof Popper.Utils
  34215. * @argument {Element} element1
  34216. * @argument {Element} element2
  34217. * @returns {Element} common offset parent
  34218. */
  34219. function findCommonOffsetParent(element1, element2) {
  34220. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34221. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34222. return document.documentElement;
  34223. }
  34224. // Here we make sure to give as "start" the element that comes first in the DOM
  34225. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34226. var start = order ? element1 : element2;
  34227. var end = order ? element2 : element1;
  34228. // Get common ancestor container
  34229. var range = document.createRange();
  34230. range.setStart(start, 0);
  34231. range.setEnd(end, 0);
  34232. var commonAncestorContainer = range.commonAncestorContainer;
  34233. // Both nodes are inside #document
  34234. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34235. if (isOffsetContainer(commonAncestorContainer)) {
  34236. return commonAncestorContainer;
  34237. }
  34238. return getOffsetParent(commonAncestorContainer);
  34239. }
  34240. // one of the nodes is inside shadowDOM, find which one
  34241. var element1root = getRoot(element1);
  34242. if (element1root.host) {
  34243. return findCommonOffsetParent(element1root.host, element2);
  34244. } else {
  34245. return findCommonOffsetParent(element1, getRoot(element2).host);
  34246. }
  34247. }
  34248. /**
  34249. * Gets the scroll value of the given element in the given side (top and left)
  34250. * @method
  34251. * @memberof Popper.Utils
  34252. * @argument {Element} element
  34253. * @argument {String} side `top` or `left`
  34254. * @returns {number} amount of scrolled pixels
  34255. */
  34256. function getScroll(element) {
  34257. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34258. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34259. var nodeName = element.nodeName;
  34260. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34261. var html = element.ownerDocument.documentElement;
  34262. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34263. return scrollingElement[upperSide];
  34264. }
  34265. return element[upperSide];
  34266. }
  34267. /*
  34268. * Sum or subtract the element scroll values (left and top) from a given rect object
  34269. * @method
  34270. * @memberof Popper.Utils
  34271. * @param {Object} rect - Rect object you want to change
  34272. * @param {HTMLElement} element - The element from the function reads the scroll values
  34273. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34274. * @return {Object} rect - The modifier rect object
  34275. */
  34276. function includeScroll(rect, element) {
  34277. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34278. var scrollTop = getScroll(element, 'top');
  34279. var scrollLeft = getScroll(element, 'left');
  34280. var modifier = subtract ? -1 : 1;
  34281. rect.top += scrollTop * modifier;
  34282. rect.bottom += scrollTop * modifier;
  34283. rect.left += scrollLeft * modifier;
  34284. rect.right += scrollLeft * modifier;
  34285. return rect;
  34286. }
  34287. /*
  34288. * Helper to detect borders of a given element
  34289. * @method
  34290. * @memberof Popper.Utils
  34291. * @param {CSSStyleDeclaration} styles
  34292. * Result of `getStyleComputedProperty` on the given element
  34293. * @param {String} axis - `x` or `y`
  34294. * @return {number} borders - The borders size of the given axis
  34295. */
  34296. function getBordersSize(styles, axis) {
  34297. var sideA = axis === 'x' ? 'Left' : 'Top';
  34298. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34299. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34300. }
  34301. function getSize(axis, body, html, computedStyle) {
  34302. 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);
  34303. }
  34304. function getWindowSizes(document) {
  34305. var body = document.body;
  34306. var html = document.documentElement;
  34307. var computedStyle = isIE(10) && getComputedStyle(html);
  34308. return {
  34309. height: getSize('Height', body, html, computedStyle),
  34310. width: getSize('Width', body, html, computedStyle)
  34311. };
  34312. }
  34313. var classCallCheck = function (instance, Constructor) {
  34314. if (!(instance instanceof Constructor)) {
  34315. throw new TypeError("Cannot call a class as a function");
  34316. }
  34317. };
  34318. var createClass = function () {
  34319. function defineProperties(target, props) {
  34320. for (var i = 0; i < props.length; i++) {
  34321. var descriptor = props[i];
  34322. descriptor.enumerable = descriptor.enumerable || false;
  34323. descriptor.configurable = true;
  34324. if ("value" in descriptor) descriptor.writable = true;
  34325. Object.defineProperty(target, descriptor.key, descriptor);
  34326. }
  34327. }
  34328. return function (Constructor, protoProps, staticProps) {
  34329. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34330. if (staticProps) defineProperties(Constructor, staticProps);
  34331. return Constructor;
  34332. };
  34333. }();
  34334. var defineProperty = function (obj, key, value) {
  34335. if (key in obj) {
  34336. Object.defineProperty(obj, key, {
  34337. value: value,
  34338. enumerable: true,
  34339. configurable: true,
  34340. writable: true
  34341. });
  34342. } else {
  34343. obj[key] = value;
  34344. }
  34345. return obj;
  34346. };
  34347. var _extends = Object.assign || function (target) {
  34348. for (var i = 1; i < arguments.length; i++) {
  34349. var source = arguments[i];
  34350. for (var key in source) {
  34351. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34352. target[key] = source[key];
  34353. }
  34354. }
  34355. }
  34356. return target;
  34357. };
  34358. /**
  34359. * Given element offsets, generate an output similar to getBoundingClientRect
  34360. * @method
  34361. * @memberof Popper.Utils
  34362. * @argument {Object} offsets
  34363. * @returns {Object} ClientRect like output
  34364. */
  34365. function getClientRect(offsets) {
  34366. return _extends({}, offsets, {
  34367. right: offsets.left + offsets.width,
  34368. bottom: offsets.top + offsets.height
  34369. });
  34370. }
  34371. /**
  34372. * Get bounding client rect of given element
  34373. * @method
  34374. * @memberof Popper.Utils
  34375. * @param {HTMLElement} element
  34376. * @return {Object} client rect
  34377. */
  34378. function getBoundingClientRect(element) {
  34379. var rect = {};
  34380. // IE10 10 FIX: Please, don't ask, the element isn't
  34381. // considered in DOM in some circumstances...
  34382. // This isn't reproducible in IE10 compatibility mode of IE11
  34383. try {
  34384. if (isIE(10)) {
  34385. rect = element.getBoundingClientRect();
  34386. var scrollTop = getScroll(element, 'top');
  34387. var scrollLeft = getScroll(element, 'left');
  34388. rect.top += scrollTop;
  34389. rect.left += scrollLeft;
  34390. rect.bottom += scrollTop;
  34391. rect.right += scrollLeft;
  34392. } else {
  34393. rect = element.getBoundingClientRect();
  34394. }
  34395. } catch (e) {}
  34396. var result = {
  34397. left: rect.left,
  34398. top: rect.top,
  34399. width: rect.right - rect.left,
  34400. height: rect.bottom - rect.top
  34401. };
  34402. // subtract scrollbar size from sizes
  34403. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34404. var width = sizes.width || element.clientWidth || result.width;
  34405. var height = sizes.height || element.clientHeight || result.height;
  34406. var horizScrollbar = element.offsetWidth - width;
  34407. var vertScrollbar = element.offsetHeight - height;
  34408. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34409. // we make this check conditional for performance reasons
  34410. if (horizScrollbar || vertScrollbar) {
  34411. var styles = getStyleComputedProperty(element);
  34412. horizScrollbar -= getBordersSize(styles, 'x');
  34413. vertScrollbar -= getBordersSize(styles, 'y');
  34414. result.width -= horizScrollbar;
  34415. result.height -= vertScrollbar;
  34416. }
  34417. return getClientRect(result);
  34418. }
  34419. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34420. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34421. var isIE10 = isIE(10);
  34422. var isHTML = parent.nodeName === 'HTML';
  34423. var childrenRect = getBoundingClientRect(children);
  34424. var parentRect = getBoundingClientRect(parent);
  34425. var scrollParent = getScrollParent(children);
  34426. var styles = getStyleComputedProperty(parent);
  34427. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34428. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34429. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34430. if (fixedPosition && isHTML) {
  34431. parentRect.top = Math.max(parentRect.top, 0);
  34432. parentRect.left = Math.max(parentRect.left, 0);
  34433. }
  34434. var offsets = getClientRect({
  34435. top: childrenRect.top - parentRect.top - borderTopWidth,
  34436. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34437. width: childrenRect.width,
  34438. height: childrenRect.height
  34439. });
  34440. offsets.marginTop = 0;
  34441. offsets.marginLeft = 0;
  34442. // Subtract margins of documentElement in case it's being used as parent
  34443. // we do this only on HTML because it's the only element that behaves
  34444. // differently when margins are applied to it. The margins are included in
  34445. // the box of the documentElement, in the other cases not.
  34446. if (!isIE10 && isHTML) {
  34447. var marginTop = parseFloat(styles.marginTop);
  34448. var marginLeft = parseFloat(styles.marginLeft);
  34449. offsets.top -= borderTopWidth - marginTop;
  34450. offsets.bottom -= borderTopWidth - marginTop;
  34451. offsets.left -= borderLeftWidth - marginLeft;
  34452. offsets.right -= borderLeftWidth - marginLeft;
  34453. // Attach marginTop and marginLeft because in some circumstances we may need them
  34454. offsets.marginTop = marginTop;
  34455. offsets.marginLeft = marginLeft;
  34456. }
  34457. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34458. offsets = includeScroll(offsets, parent);
  34459. }
  34460. return offsets;
  34461. }
  34462. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34463. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34464. var html = element.ownerDocument.documentElement;
  34465. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34466. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34467. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34468. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34469. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34470. var offset = {
  34471. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34472. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34473. width: width,
  34474. height: height
  34475. };
  34476. return getClientRect(offset);
  34477. }
  34478. /**
  34479. * Check if the given element is fixed or is inside a fixed parent
  34480. * @method
  34481. * @memberof Popper.Utils
  34482. * @argument {Element} element
  34483. * @argument {Element} customContainer
  34484. * @returns {Boolean} answer to "isFixed?"
  34485. */
  34486. function isFixed(element) {
  34487. var nodeName = element.nodeName;
  34488. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34489. return false;
  34490. }
  34491. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34492. return true;
  34493. }
  34494. var parentNode = getParentNode(element);
  34495. if (!parentNode) {
  34496. return false;
  34497. }
  34498. return isFixed(parentNode);
  34499. }
  34500. /**
  34501. * Finds the first parent of an element that has a transformed property defined
  34502. * @method
  34503. * @memberof Popper.Utils
  34504. * @argument {Element} element
  34505. * @returns {Element} first transformed parent or documentElement
  34506. */
  34507. function getFixedPositionOffsetParent(element) {
  34508. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34509. if (!element || !element.parentElement || isIE()) {
  34510. return document.documentElement;
  34511. }
  34512. var el = element.parentElement;
  34513. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34514. el = el.parentElement;
  34515. }
  34516. return el || document.documentElement;
  34517. }
  34518. /**
  34519. * Computed the boundaries limits and return them
  34520. * @method
  34521. * @memberof Popper.Utils
  34522. * @param {HTMLElement} popper
  34523. * @param {HTMLElement} reference
  34524. * @param {number} padding
  34525. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34526. * @param {Boolean} fixedPosition - Is in fixed position mode
  34527. * @returns {Object} Coordinates of the boundaries
  34528. */
  34529. function getBoundaries(popper, reference, padding, boundariesElement) {
  34530. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34531. // NOTE: 1 DOM access here
  34532. var boundaries = { top: 0, left: 0 };
  34533. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34534. // Handle viewport case
  34535. if (boundariesElement === 'viewport') {
  34536. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34537. } else {
  34538. // Handle other cases based on DOM element used as boundaries
  34539. var boundariesNode = void 0;
  34540. if (boundariesElement === 'scrollParent') {
  34541. boundariesNode = getScrollParent(getParentNode(reference));
  34542. if (boundariesNode.nodeName === 'BODY') {
  34543. boundariesNode = popper.ownerDocument.documentElement;
  34544. }
  34545. } else if (boundariesElement === 'window') {
  34546. boundariesNode = popper.ownerDocument.documentElement;
  34547. } else {
  34548. boundariesNode = boundariesElement;
  34549. }
  34550. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34551. // In case of HTML, we need a different computation
  34552. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34553. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34554. height = _getWindowSizes.height,
  34555. width = _getWindowSizes.width;
  34556. boundaries.top += offsets.top - offsets.marginTop;
  34557. boundaries.bottom = height + offsets.top;
  34558. boundaries.left += offsets.left - offsets.marginLeft;
  34559. boundaries.right = width + offsets.left;
  34560. } else {
  34561. // for all the other DOM elements, this one is good
  34562. boundaries = offsets;
  34563. }
  34564. }
  34565. // Add paddings
  34566. padding = padding || 0;
  34567. var isPaddingNumber = typeof padding === 'number';
  34568. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34569. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34570. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34571. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34572. return boundaries;
  34573. }
  34574. function getArea(_ref) {
  34575. var width = _ref.width,
  34576. height = _ref.height;
  34577. return width * height;
  34578. }
  34579. /**
  34580. * Utility used to transform the `auto` placement to the placement with more
  34581. * available space.
  34582. * @method
  34583. * @memberof Popper.Utils
  34584. * @argument {Object} data - The data object generated by update method
  34585. * @argument {Object} options - Modifiers configuration and options
  34586. * @returns {Object} The data object, properly modified
  34587. */
  34588. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34589. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34590. if (placement.indexOf('auto') === -1) {
  34591. return placement;
  34592. }
  34593. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34594. var rects = {
  34595. top: {
  34596. width: boundaries.width,
  34597. height: refRect.top - boundaries.top
  34598. },
  34599. right: {
  34600. width: boundaries.right - refRect.right,
  34601. height: boundaries.height
  34602. },
  34603. bottom: {
  34604. width: boundaries.width,
  34605. height: boundaries.bottom - refRect.bottom
  34606. },
  34607. left: {
  34608. width: refRect.left - boundaries.left,
  34609. height: boundaries.height
  34610. }
  34611. };
  34612. var sortedAreas = Object.keys(rects).map(function (key) {
  34613. return _extends({
  34614. key: key
  34615. }, rects[key], {
  34616. area: getArea(rects[key])
  34617. });
  34618. }).sort(function (a, b) {
  34619. return b.area - a.area;
  34620. });
  34621. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34622. var width = _ref2.width,
  34623. height = _ref2.height;
  34624. return width >= popper.clientWidth && height >= popper.clientHeight;
  34625. });
  34626. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34627. var variation = placement.split('-')[1];
  34628. return computedPlacement + (variation ? '-' + variation : '');
  34629. }
  34630. /**
  34631. * Get offsets to the reference element
  34632. * @method
  34633. * @memberof Popper.Utils
  34634. * @param {Object} state
  34635. * @param {Element} popper - the popper element
  34636. * @param {Element} reference - the reference element (the popper will be relative to this)
  34637. * @param {Element} fixedPosition - is in fixed position mode
  34638. * @returns {Object} An object containing the offsets which will be applied to the popper
  34639. */
  34640. function getReferenceOffsets(state, popper, reference) {
  34641. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34642. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34643. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34644. }
  34645. /**
  34646. * Get the outer sizes of the given element (offset size + margins)
  34647. * @method
  34648. * @memberof Popper.Utils
  34649. * @argument {Element} element
  34650. * @returns {Object} object containing width and height properties
  34651. */
  34652. function getOuterSizes(element) {
  34653. var window = element.ownerDocument.defaultView;
  34654. var styles = window.getComputedStyle(element);
  34655. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34656. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34657. var result = {
  34658. width: element.offsetWidth + y,
  34659. height: element.offsetHeight + x
  34660. };
  34661. return result;
  34662. }
  34663. /**
  34664. * Get the opposite placement of the given one
  34665. * @method
  34666. * @memberof Popper.Utils
  34667. * @argument {String} placement
  34668. * @returns {String} flipped placement
  34669. */
  34670. function getOppositePlacement(placement) {
  34671. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34672. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34673. return hash[matched];
  34674. });
  34675. }
  34676. /**
  34677. * Get offsets to the popper
  34678. * @method
  34679. * @memberof Popper.Utils
  34680. * @param {Object} position - CSS position the Popper will get applied
  34681. * @param {HTMLElement} popper - the popper element
  34682. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34683. * @param {String} placement - one of the valid placement options
  34684. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34685. */
  34686. function getPopperOffsets(popper, referenceOffsets, placement) {
  34687. placement = placement.split('-')[0];
  34688. // Get popper node sizes
  34689. var popperRect = getOuterSizes(popper);
  34690. // Add position, width and height to our offsets object
  34691. var popperOffsets = {
  34692. width: popperRect.width,
  34693. height: popperRect.height
  34694. };
  34695. // depending by the popper placement we have to compute its offsets slightly differently
  34696. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34697. var mainSide = isHoriz ? 'top' : 'left';
  34698. var secondarySide = isHoriz ? 'left' : 'top';
  34699. var measurement = isHoriz ? 'height' : 'width';
  34700. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34701. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34702. if (placement === secondarySide) {
  34703. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34704. } else {
  34705. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34706. }
  34707. return popperOffsets;
  34708. }
  34709. /**
  34710. * Mimics the `find` method of Array
  34711. * @method
  34712. * @memberof Popper.Utils
  34713. * @argument {Array} arr
  34714. * @argument prop
  34715. * @argument value
  34716. * @returns index or -1
  34717. */
  34718. function find(arr, check) {
  34719. // use native find if supported
  34720. if (Array.prototype.find) {
  34721. return arr.find(check);
  34722. }
  34723. // use `filter` to obtain the same behavior of `find`
  34724. return arr.filter(check)[0];
  34725. }
  34726. /**
  34727. * Return the index of the matching object
  34728. * @method
  34729. * @memberof Popper.Utils
  34730. * @argument {Array} arr
  34731. * @argument prop
  34732. * @argument value
  34733. * @returns index or -1
  34734. */
  34735. function findIndex(arr, prop, value) {
  34736. // use native findIndex if supported
  34737. if (Array.prototype.findIndex) {
  34738. return arr.findIndex(function (cur) {
  34739. return cur[prop] === value;
  34740. });
  34741. }
  34742. // use `find` + `indexOf` if `findIndex` isn't supported
  34743. var match = find(arr, function (obj) {
  34744. return obj[prop] === value;
  34745. });
  34746. return arr.indexOf(match);
  34747. }
  34748. /**
  34749. * Loop trough the list of modifiers and run them in order,
  34750. * each of them will then edit the data object.
  34751. * @method
  34752. * @memberof Popper.Utils
  34753. * @param {dataObject} data
  34754. * @param {Array} modifiers
  34755. * @param {String} ends - Optional modifier name used as stopper
  34756. * @returns {dataObject}
  34757. */
  34758. function runModifiers(modifiers, data, ends) {
  34759. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34760. modifiersToRun.forEach(function (modifier) {
  34761. if (modifier['function']) {
  34762. // eslint-disable-line dot-notation
  34763. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34764. }
  34765. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34766. if (modifier.enabled && isFunction(fn)) {
  34767. // Add properties to offsets to make them a complete clientRect object
  34768. // we do this before each modifier to make sure the previous one doesn't
  34769. // mess with these values
  34770. data.offsets.popper = getClientRect(data.offsets.popper);
  34771. data.offsets.reference = getClientRect(data.offsets.reference);
  34772. data = fn(data, modifier);
  34773. }
  34774. });
  34775. return data;
  34776. }
  34777. /**
  34778. * Updates the position of the popper, computing the new offsets and applying
  34779. * the new style.<br />
  34780. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34781. * @method
  34782. * @memberof Popper
  34783. */
  34784. function update() {
  34785. // if popper is destroyed, don't perform any further update
  34786. if (this.state.isDestroyed) {
  34787. return;
  34788. }
  34789. var data = {
  34790. instance: this,
  34791. styles: {},
  34792. arrowStyles: {},
  34793. attributes: {},
  34794. flipped: false,
  34795. offsets: {}
  34796. };
  34797. // compute reference element offsets
  34798. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34799. // compute auto placement, store placement inside the data object,
  34800. // modifiers will be able to edit `placement` if needed
  34801. // and refer to originalPlacement to know the original value
  34802. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34803. // store the computed placement inside `originalPlacement`
  34804. data.originalPlacement = data.placement;
  34805. data.positionFixed = this.options.positionFixed;
  34806. // compute the popper offsets
  34807. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34808. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34809. // run the modifiers
  34810. data = runModifiers(this.modifiers, data);
  34811. // the first `update` will call `onCreate` callback
  34812. // the other ones will call `onUpdate` callback
  34813. if (!this.state.isCreated) {
  34814. this.state.isCreated = true;
  34815. this.options.onCreate(data);
  34816. } else {
  34817. this.options.onUpdate(data);
  34818. }
  34819. }
  34820. /**
  34821. * Helper used to know if the given modifier is enabled.
  34822. * @method
  34823. * @memberof Popper.Utils
  34824. * @returns {Boolean}
  34825. */
  34826. function isModifierEnabled(modifiers, modifierName) {
  34827. return modifiers.some(function (_ref) {
  34828. var name = _ref.name,
  34829. enabled = _ref.enabled;
  34830. return enabled && name === modifierName;
  34831. });
  34832. }
  34833. /**
  34834. * Get the prefixed supported property name
  34835. * @method
  34836. * @memberof Popper.Utils
  34837. * @argument {String} property (camelCase)
  34838. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34839. */
  34840. function getSupportedPropertyName(property) {
  34841. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34842. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34843. for (var i = 0; i < prefixes.length; i++) {
  34844. var prefix = prefixes[i];
  34845. var toCheck = prefix ? '' + prefix + upperProp : property;
  34846. if (typeof document.body.style[toCheck] !== 'undefined') {
  34847. return toCheck;
  34848. }
  34849. }
  34850. return null;
  34851. }
  34852. /**
  34853. * Destroys the popper.
  34854. * @method
  34855. * @memberof Popper
  34856. */
  34857. function destroy() {
  34858. this.state.isDestroyed = true;
  34859. // touch DOM only if `applyStyle` modifier is enabled
  34860. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34861. this.popper.removeAttribute('x-placement');
  34862. this.popper.style.position = '';
  34863. this.popper.style.top = '';
  34864. this.popper.style.left = '';
  34865. this.popper.style.right = '';
  34866. this.popper.style.bottom = '';
  34867. this.popper.style.willChange = '';
  34868. this.popper.style[getSupportedPropertyName('transform')] = '';
  34869. }
  34870. this.disableEventListeners();
  34871. // remove the popper if user explicitly asked for the deletion on destroy
  34872. // do not use `remove` because IE11 doesn't support it
  34873. if (this.options.removeOnDestroy) {
  34874. this.popper.parentNode.removeChild(this.popper);
  34875. }
  34876. return this;
  34877. }
  34878. /**
  34879. * Get the window associated with the element
  34880. * @argument {Element} element
  34881. * @returns {Window}
  34882. */
  34883. function getWindow(element) {
  34884. var ownerDocument = element.ownerDocument;
  34885. return ownerDocument ? ownerDocument.defaultView : window;
  34886. }
  34887. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34888. var isBody = scrollParent.nodeName === 'BODY';
  34889. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34890. target.addEventListener(event, callback, { passive: true });
  34891. if (!isBody) {
  34892. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34893. }
  34894. scrollParents.push(target);
  34895. }
  34896. /**
  34897. * Setup needed event listeners used to update the popper position
  34898. * @method
  34899. * @memberof Popper.Utils
  34900. * @private
  34901. */
  34902. function setupEventListeners(reference, options, state, updateBound) {
  34903. // Resize event listener on window
  34904. state.updateBound = updateBound;
  34905. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34906. // Scroll event listener on scroll parents
  34907. var scrollElement = getScrollParent(reference);
  34908. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34909. state.scrollElement = scrollElement;
  34910. state.eventsEnabled = true;
  34911. return state;
  34912. }
  34913. /**
  34914. * It will add resize/scroll events and start recalculating
  34915. * position of the popper element when they are triggered.
  34916. * @method
  34917. * @memberof Popper
  34918. */
  34919. function enableEventListeners() {
  34920. if (!this.state.eventsEnabled) {
  34921. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34922. }
  34923. }
  34924. /**
  34925. * Remove event listeners used to update the popper position
  34926. * @method
  34927. * @memberof Popper.Utils
  34928. * @private
  34929. */
  34930. function removeEventListeners(reference, state) {
  34931. // Remove resize event listener on window
  34932. getWindow(reference).removeEventListener('resize', state.updateBound);
  34933. // Remove scroll event listener on scroll parents
  34934. state.scrollParents.forEach(function (target) {
  34935. target.removeEventListener('scroll', state.updateBound);
  34936. });
  34937. // Reset state
  34938. state.updateBound = null;
  34939. state.scrollParents = [];
  34940. state.scrollElement = null;
  34941. state.eventsEnabled = false;
  34942. return state;
  34943. }
  34944. /**
  34945. * It will remove resize/scroll events and won't recalculate popper position
  34946. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  34947. * unless you call `update` method manually.
  34948. * @method
  34949. * @memberof Popper
  34950. */
  34951. function disableEventListeners() {
  34952. if (this.state.eventsEnabled) {
  34953. cancelAnimationFrame(this.scheduleUpdate);
  34954. this.state = removeEventListeners(this.reference, this.state);
  34955. }
  34956. }
  34957. /**
  34958. * Tells if a given input is a number
  34959. * @method
  34960. * @memberof Popper.Utils
  34961. * @param {*} input to check
  34962. * @return {Boolean}
  34963. */
  34964. function isNumeric(n) {
  34965. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  34966. }
  34967. /**
  34968. * Set the style to the given popper
  34969. * @method
  34970. * @memberof Popper.Utils
  34971. * @argument {Element} element - Element to apply the style to
  34972. * @argument {Object} styles
  34973. * Object with a list of properties and values which will be applied to the element
  34974. */
  34975. function setStyles(element, styles) {
  34976. Object.keys(styles).forEach(function (prop) {
  34977. var unit = '';
  34978. // add unit if the value is numeric and is one of the following
  34979. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  34980. unit = 'px';
  34981. }
  34982. element.style[prop] = styles[prop] + unit;
  34983. });
  34984. }
  34985. /**
  34986. * Set the attributes to the given popper
  34987. * @method
  34988. * @memberof Popper.Utils
  34989. * @argument {Element} element - Element to apply the attributes to
  34990. * @argument {Object} styles
  34991. * Object with a list of properties and values which will be applied to the element
  34992. */
  34993. function setAttributes(element, attributes) {
  34994. Object.keys(attributes).forEach(function (prop) {
  34995. var value = attributes[prop];
  34996. if (value !== false) {
  34997. element.setAttribute(prop, attributes[prop]);
  34998. } else {
  34999. element.removeAttribute(prop);
  35000. }
  35001. });
  35002. }
  35003. /**
  35004. * @function
  35005. * @memberof Modifiers
  35006. * @argument {Object} data - The data object generated by `update` method
  35007. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35008. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35009. * @argument {Object} options - Modifiers configuration and options
  35010. * @returns {Object} The same data object
  35011. */
  35012. function applyStyle(data) {
  35013. // any property present in `data.styles` will be applied to the popper,
  35014. // in this way we can make the 3rd party modifiers add custom styles to it
  35015. // Be aware, modifiers could override the properties defined in the previous
  35016. // lines of this modifier!
  35017. setStyles(data.instance.popper, data.styles);
  35018. // any property present in `data.attributes` will be applied to the popper,
  35019. // they will be set as HTML attributes of the element
  35020. setAttributes(data.instance.popper, data.attributes);
  35021. // if arrowElement is defined and arrowStyles has some properties
  35022. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35023. setStyles(data.arrowElement, data.arrowStyles);
  35024. }
  35025. return data;
  35026. }
  35027. /**
  35028. * Set the x-placement attribute before everything else because it could be used
  35029. * to add margins to the popper margins needs to be calculated to get the
  35030. * correct popper offsets.
  35031. * @method
  35032. * @memberof Popper.modifiers
  35033. * @param {HTMLElement} reference - The reference element used to position the popper
  35034. * @param {HTMLElement} popper - The HTML element used as popper
  35035. * @param {Object} options - Popper.js options
  35036. */
  35037. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35038. // compute reference element offsets
  35039. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35040. // compute auto placement, store placement inside the data object,
  35041. // modifiers will be able to edit `placement` if needed
  35042. // and refer to originalPlacement to know the original value
  35043. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35044. popper.setAttribute('x-placement', placement);
  35045. // Apply `position` to popper before anything else because
  35046. // without the position applied we can't guarantee correct computations
  35047. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35048. return options;
  35049. }
  35050. /**
  35051. * @function
  35052. * @memberof Popper.Utils
  35053. * @argument {Object} data - The data object generated by `update` method
  35054. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35055. * @returns {Object} The popper's position offsets rounded
  35056. *
  35057. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35058. * good as it can be within reason.
  35059. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35060. *
  35061. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35062. * as well on High DPI screens).
  35063. *
  35064. * Firefox prefers no rounding for positioning and does not have blurriness on
  35065. * high DPI screens.
  35066. *
  35067. * Only horizontal placement and left/right values need to be considered.
  35068. */
  35069. function getRoundedOffsets(data, shouldRound) {
  35070. var _data$offsets = data.offsets,
  35071. popper = _data$offsets.popper,
  35072. reference = _data$offsets.reference;
  35073. var round = Math.round,
  35074. floor = Math.floor;
  35075. var noRound = function noRound(v) {
  35076. return v;
  35077. };
  35078. var referenceWidth = round(reference.width);
  35079. var popperWidth = round(popper.width);
  35080. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35081. var isVariation = data.placement.indexOf('-') !== -1;
  35082. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35083. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35084. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35085. var verticalToInteger = !shouldRound ? noRound : round;
  35086. return {
  35087. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35088. top: verticalToInteger(popper.top),
  35089. bottom: verticalToInteger(popper.bottom),
  35090. right: horizontalToInteger(popper.right)
  35091. };
  35092. }
  35093. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35094. /**
  35095. * @function
  35096. * @memberof Modifiers
  35097. * @argument {Object} data - The data object generated by `update` method
  35098. * @argument {Object} options - Modifiers configuration and options
  35099. * @returns {Object} The data object, properly modified
  35100. */
  35101. function computeStyle(data, options) {
  35102. var x = options.x,
  35103. y = options.y;
  35104. var popper = data.offsets.popper;
  35105. // Remove this legacy support in Popper.js v2
  35106. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35107. return modifier.name === 'applyStyle';
  35108. }).gpuAcceleration;
  35109. if (legacyGpuAccelerationOption !== undefined) {
  35110. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35111. }
  35112. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35113. var offsetParent = getOffsetParent(data.instance.popper);
  35114. var offsetParentRect = getBoundingClientRect(offsetParent);
  35115. // Styles
  35116. var styles = {
  35117. position: popper.position
  35118. };
  35119. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35120. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35121. var sideB = y === 'right' ? 'left' : 'right';
  35122. // if gpuAcceleration is set to `true` and transform is supported,
  35123. // we use `translate3d` to apply the position to the popper we
  35124. // automatically use the supported prefixed version if needed
  35125. var prefixedProperty = getSupportedPropertyName('transform');
  35126. // now, let's make a step back and look at this code closely (wtf?)
  35127. // If the content of the popper grows once it's been positioned, it
  35128. // may happen that the popper gets misplaced because of the new content
  35129. // overflowing its reference element
  35130. // To avoid this problem, we provide two options (x and y), which allow
  35131. // the consumer to define the offset origin.
  35132. // If we position a popper on top of a reference element, we can set
  35133. // `x` to `top` to make the popper grow towards its top instead of
  35134. // its bottom.
  35135. var left = void 0,
  35136. top = void 0;
  35137. if (sideA === 'bottom') {
  35138. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35139. // and not the bottom of the html element
  35140. if (offsetParent.nodeName === 'HTML') {
  35141. top = -offsetParent.clientHeight + offsets.bottom;
  35142. } else {
  35143. top = -offsetParentRect.height + offsets.bottom;
  35144. }
  35145. } else {
  35146. top = offsets.top;
  35147. }
  35148. if (sideB === 'right') {
  35149. if (offsetParent.nodeName === 'HTML') {
  35150. left = -offsetParent.clientWidth + offsets.right;
  35151. } else {
  35152. left = -offsetParentRect.width + offsets.right;
  35153. }
  35154. } else {
  35155. left = offsets.left;
  35156. }
  35157. if (gpuAcceleration && prefixedProperty) {
  35158. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35159. styles[sideA] = 0;
  35160. styles[sideB] = 0;
  35161. styles.willChange = 'transform';
  35162. } else {
  35163. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35164. var invertTop = sideA === 'bottom' ? -1 : 1;
  35165. var invertLeft = sideB === 'right' ? -1 : 1;
  35166. styles[sideA] = top * invertTop;
  35167. styles[sideB] = left * invertLeft;
  35168. styles.willChange = sideA + ', ' + sideB;
  35169. }
  35170. // Attributes
  35171. var attributes = {
  35172. 'x-placement': data.placement
  35173. };
  35174. // Update `data` attributes, styles and arrowStyles
  35175. data.attributes = _extends({}, attributes, data.attributes);
  35176. data.styles = _extends({}, styles, data.styles);
  35177. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35178. return data;
  35179. }
  35180. /**
  35181. * Helper used to know if the given modifier depends from another one.<br />
  35182. * It checks if the needed modifier is listed and enabled.
  35183. * @method
  35184. * @memberof Popper.Utils
  35185. * @param {Array} modifiers - list of modifiers
  35186. * @param {String} requestingName - name of requesting modifier
  35187. * @param {String} requestedName - name of requested modifier
  35188. * @returns {Boolean}
  35189. */
  35190. function isModifierRequired(modifiers, requestingName, requestedName) {
  35191. var requesting = find(modifiers, function (_ref) {
  35192. var name = _ref.name;
  35193. return name === requestingName;
  35194. });
  35195. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35196. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35197. });
  35198. if (!isRequired) {
  35199. var _requesting = '`' + requestingName + '`';
  35200. var requested = '`' + requestedName + '`';
  35201. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35202. }
  35203. return isRequired;
  35204. }
  35205. /**
  35206. * @function
  35207. * @memberof Modifiers
  35208. * @argument {Object} data - The data object generated by update method
  35209. * @argument {Object} options - Modifiers configuration and options
  35210. * @returns {Object} The data object, properly modified
  35211. */
  35212. function arrow(data, options) {
  35213. var _data$offsets$arrow;
  35214. // arrow depends on keepTogether in order to work
  35215. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35216. return data;
  35217. }
  35218. var arrowElement = options.element;
  35219. // if arrowElement is a string, suppose it's a CSS selector
  35220. if (typeof arrowElement === 'string') {
  35221. arrowElement = data.instance.popper.querySelector(arrowElement);
  35222. // if arrowElement is not found, don't run the modifier
  35223. if (!arrowElement) {
  35224. return data;
  35225. }
  35226. } else {
  35227. // if the arrowElement isn't a query selector we must check that the
  35228. // provided DOM node is child of its popper node
  35229. if (!data.instance.popper.contains(arrowElement)) {
  35230. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35231. return data;
  35232. }
  35233. }
  35234. var placement = data.placement.split('-')[0];
  35235. var _data$offsets = data.offsets,
  35236. popper = _data$offsets.popper,
  35237. reference = _data$offsets.reference;
  35238. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35239. var len = isVertical ? 'height' : 'width';
  35240. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35241. var side = sideCapitalized.toLowerCase();
  35242. var altSide = isVertical ? 'left' : 'top';
  35243. var opSide = isVertical ? 'bottom' : 'right';
  35244. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35245. //
  35246. // extends keepTogether behavior making sure the popper and its
  35247. // reference have enough pixels in conjunction
  35248. //
  35249. // top/left side
  35250. if (reference[opSide] - arrowElementSize < popper[side]) {
  35251. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35252. }
  35253. // bottom/right side
  35254. if (reference[side] + arrowElementSize > popper[opSide]) {
  35255. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35256. }
  35257. data.offsets.popper = getClientRect(data.offsets.popper);
  35258. // compute center of the popper
  35259. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35260. // Compute the sideValue using the updated popper offsets
  35261. // take popper margin in account because we don't have this info available
  35262. var css = getStyleComputedProperty(data.instance.popper);
  35263. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35264. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35265. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35266. // prevent arrowElement from being placed not contiguously to its popper
  35267. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35268. data.arrowElement = arrowElement;
  35269. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35270. return data;
  35271. }
  35272. /**
  35273. * Get the opposite placement variation of the given one
  35274. * @method
  35275. * @memberof Popper.Utils
  35276. * @argument {String} placement variation
  35277. * @returns {String} flipped placement variation
  35278. */
  35279. function getOppositeVariation(variation) {
  35280. if (variation === 'end') {
  35281. return 'start';
  35282. } else if (variation === 'start') {
  35283. return 'end';
  35284. }
  35285. return variation;
  35286. }
  35287. /**
  35288. * List of accepted placements to use as values of the `placement` option.<br />
  35289. * Valid placements are:
  35290. * - `auto`
  35291. * - `top`
  35292. * - `right`
  35293. * - `bottom`
  35294. * - `left`
  35295. *
  35296. * Each placement can have a variation from this list:
  35297. * - `-start`
  35298. * - `-end`
  35299. *
  35300. * Variations are interpreted easily if you think of them as the left to right
  35301. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35302. * is right.<br />
  35303. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35304. *
  35305. * Some valid examples are:
  35306. * - `top-end` (on top of reference, right aligned)
  35307. * - `right-start` (on right of reference, top aligned)
  35308. * - `bottom` (on bottom, centered)
  35309. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35310. *
  35311. * @static
  35312. * @type {Array}
  35313. * @enum {String}
  35314. * @readonly
  35315. * @method placements
  35316. * @memberof Popper
  35317. */
  35318. 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'];
  35319. // Get rid of `auto` `auto-start` and `auto-end`
  35320. var validPlacements = placements.slice(3);
  35321. /**
  35322. * Given an initial placement, returns all the subsequent placements
  35323. * clockwise (or counter-clockwise).
  35324. *
  35325. * @method
  35326. * @memberof Popper.Utils
  35327. * @argument {String} placement - A valid placement (it accepts variations)
  35328. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35329. * @returns {Array} placements including their variations
  35330. */
  35331. function clockwise(placement) {
  35332. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35333. var index = validPlacements.indexOf(placement);
  35334. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35335. return counter ? arr.reverse() : arr;
  35336. }
  35337. var BEHAVIORS = {
  35338. FLIP: 'flip',
  35339. CLOCKWISE: 'clockwise',
  35340. COUNTERCLOCKWISE: 'counterclockwise'
  35341. };
  35342. /**
  35343. * @function
  35344. * @memberof Modifiers
  35345. * @argument {Object} data - The data object generated by update method
  35346. * @argument {Object} options - Modifiers configuration and options
  35347. * @returns {Object} The data object, properly modified
  35348. */
  35349. function flip(data, options) {
  35350. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35351. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35352. return data;
  35353. }
  35354. if (data.flipped && data.placement === data.originalPlacement) {
  35355. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35356. return data;
  35357. }
  35358. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35359. var placement = data.placement.split('-')[0];
  35360. var placementOpposite = getOppositePlacement(placement);
  35361. var variation = data.placement.split('-')[1] || '';
  35362. var flipOrder = [];
  35363. switch (options.behavior) {
  35364. case BEHAVIORS.FLIP:
  35365. flipOrder = [placement, placementOpposite];
  35366. break;
  35367. case BEHAVIORS.CLOCKWISE:
  35368. flipOrder = clockwise(placement);
  35369. break;
  35370. case BEHAVIORS.COUNTERCLOCKWISE:
  35371. flipOrder = clockwise(placement, true);
  35372. break;
  35373. default:
  35374. flipOrder = options.behavior;
  35375. }
  35376. flipOrder.forEach(function (step, index) {
  35377. if (placement !== step || flipOrder.length === index + 1) {
  35378. return data;
  35379. }
  35380. placement = data.placement.split('-')[0];
  35381. placementOpposite = getOppositePlacement(placement);
  35382. var popperOffsets = data.offsets.popper;
  35383. var refOffsets = data.offsets.reference;
  35384. // using floor because the reference offsets may contain decimals we are not going to consider here
  35385. var floor = Math.floor;
  35386. 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);
  35387. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35388. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35389. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35390. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35391. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35392. // flip the variation if required
  35393. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35394. // flips variation if reference element overflows boundaries
  35395. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35396. // flips variation if popper content overflows boundaries
  35397. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35398. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35399. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35400. // this boolean to detect any flip loop
  35401. data.flipped = true;
  35402. if (overlapsRef || overflowsBoundaries) {
  35403. placement = flipOrder[index + 1];
  35404. }
  35405. if (flippedVariation) {
  35406. variation = getOppositeVariation(variation);
  35407. }
  35408. data.placement = placement + (variation ? '-' + variation : '');
  35409. // this object contains `position`, we want to preserve it along with
  35410. // any additional property we may add in the future
  35411. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35412. data = runModifiers(data.instance.modifiers, data, 'flip');
  35413. }
  35414. });
  35415. return data;
  35416. }
  35417. /**
  35418. * @function
  35419. * @memberof Modifiers
  35420. * @argument {Object} data - The data object generated by update method
  35421. * @argument {Object} options - Modifiers configuration and options
  35422. * @returns {Object} The data object, properly modified
  35423. */
  35424. function keepTogether(data) {
  35425. var _data$offsets = data.offsets,
  35426. popper = _data$offsets.popper,
  35427. reference = _data$offsets.reference;
  35428. var placement = data.placement.split('-')[0];
  35429. var floor = Math.floor;
  35430. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35431. var side = isVertical ? 'right' : 'bottom';
  35432. var opSide = isVertical ? 'left' : 'top';
  35433. var measurement = isVertical ? 'width' : 'height';
  35434. if (popper[side] < floor(reference[opSide])) {
  35435. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35436. }
  35437. if (popper[opSide] > floor(reference[side])) {
  35438. data.offsets.popper[opSide] = floor(reference[side]);
  35439. }
  35440. return data;
  35441. }
  35442. /**
  35443. * Converts a string containing value + unit into a px value number
  35444. * @function
  35445. * @memberof {modifiers~offset}
  35446. * @private
  35447. * @argument {String} str - Value + unit string
  35448. * @argument {String} measurement - `height` or `width`
  35449. * @argument {Object} popperOffsets
  35450. * @argument {Object} referenceOffsets
  35451. * @returns {Number|String}
  35452. * Value in pixels, or original string if no values were extracted
  35453. */
  35454. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35455. // separate value from unit
  35456. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35457. var value = +split[1];
  35458. var unit = split[2];
  35459. // If it's not a number it's an operator, I guess
  35460. if (!value) {
  35461. return str;
  35462. }
  35463. if (unit.indexOf('%') === 0) {
  35464. var element = void 0;
  35465. switch (unit) {
  35466. case '%p':
  35467. element = popperOffsets;
  35468. break;
  35469. case '%':
  35470. case '%r':
  35471. default:
  35472. element = referenceOffsets;
  35473. }
  35474. var rect = getClientRect(element);
  35475. return rect[measurement] / 100 * value;
  35476. } else if (unit === 'vh' || unit === 'vw') {
  35477. // if is a vh or vw, we calculate the size based on the viewport
  35478. var size = void 0;
  35479. if (unit === 'vh') {
  35480. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35481. } else {
  35482. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35483. }
  35484. return size / 100 * value;
  35485. } else {
  35486. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35487. // if is an implicit unit, it's px, and we return just the value
  35488. return value;
  35489. }
  35490. }
  35491. /**
  35492. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35493. * @function
  35494. * @memberof {modifiers~offset}
  35495. * @private
  35496. * @argument {String} offset
  35497. * @argument {Object} popperOffsets
  35498. * @argument {Object} referenceOffsets
  35499. * @argument {String} basePlacement
  35500. * @returns {Array} a two cells array with x and y offsets in numbers
  35501. */
  35502. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35503. var offsets = [0, 0];
  35504. // Use height if placement is left or right and index is 0 otherwise use width
  35505. // in this way the first offset will use an axis and the second one
  35506. // will use the other one
  35507. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35508. // Split the offset string to obtain a list of values and operands
  35509. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35510. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35511. return frag.trim();
  35512. });
  35513. // Detect if the offset string contains a pair of values or a single one
  35514. // they could be separated by comma or space
  35515. var divider = fragments.indexOf(find(fragments, function (frag) {
  35516. return frag.search(/,|\s/) !== -1;
  35517. }));
  35518. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35519. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35520. }
  35521. // If divider is found, we divide the list of values and operands to divide
  35522. // them by ofset X and Y.
  35523. var splitRegex = /\s*,\s*|\s+/;
  35524. 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];
  35525. // Convert the values with units to absolute pixels to allow our computations
  35526. ops = ops.map(function (op, index) {
  35527. // Most of the units rely on the orientation of the popper
  35528. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35529. var mergeWithPrevious = false;
  35530. return op
  35531. // This aggregates any `+` or `-` sign that aren't considered operators
  35532. // e.g.: 10 + +5 => [10, +, +5]
  35533. .reduce(function (a, b) {
  35534. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35535. a[a.length - 1] = b;
  35536. mergeWithPrevious = true;
  35537. return a;
  35538. } else if (mergeWithPrevious) {
  35539. a[a.length - 1] += b;
  35540. mergeWithPrevious = false;
  35541. return a;
  35542. } else {
  35543. return a.concat(b);
  35544. }
  35545. }, [])
  35546. // Here we convert the string values into number values (in px)
  35547. .map(function (str) {
  35548. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35549. });
  35550. });
  35551. // Loop trough the offsets arrays and execute the operations
  35552. ops.forEach(function (op, index) {
  35553. op.forEach(function (frag, index2) {
  35554. if (isNumeric(frag)) {
  35555. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35556. }
  35557. });
  35558. });
  35559. return offsets;
  35560. }
  35561. /**
  35562. * @function
  35563. * @memberof Modifiers
  35564. * @argument {Object} data - The data object generated by update method
  35565. * @argument {Object} options - Modifiers configuration and options
  35566. * @argument {Number|String} options.offset=0
  35567. * The offset value as described in the modifier description
  35568. * @returns {Object} The data object, properly modified
  35569. */
  35570. function offset(data, _ref) {
  35571. var offset = _ref.offset;
  35572. var placement = data.placement,
  35573. _data$offsets = data.offsets,
  35574. popper = _data$offsets.popper,
  35575. reference = _data$offsets.reference;
  35576. var basePlacement = placement.split('-')[0];
  35577. var offsets = void 0;
  35578. if (isNumeric(+offset)) {
  35579. offsets = [+offset, 0];
  35580. } else {
  35581. offsets = parseOffset(offset, popper, reference, basePlacement);
  35582. }
  35583. if (basePlacement === 'left') {
  35584. popper.top += offsets[0];
  35585. popper.left -= offsets[1];
  35586. } else if (basePlacement === 'right') {
  35587. popper.top += offsets[0];
  35588. popper.left += offsets[1];
  35589. } else if (basePlacement === 'top') {
  35590. popper.left += offsets[0];
  35591. popper.top -= offsets[1];
  35592. } else if (basePlacement === 'bottom') {
  35593. popper.left += offsets[0];
  35594. popper.top += offsets[1];
  35595. }
  35596. data.popper = popper;
  35597. return data;
  35598. }
  35599. /**
  35600. * @function
  35601. * @memberof Modifiers
  35602. * @argument {Object} data - The data object generated by `update` method
  35603. * @argument {Object} options - Modifiers configuration and options
  35604. * @returns {Object} The data object, properly modified
  35605. */
  35606. function preventOverflow(data, options) {
  35607. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35608. // If offsetParent is the reference element, we really want to
  35609. // go one step up and use the next offsetParent as reference to
  35610. // avoid to make this modifier completely useless and look like broken
  35611. if (data.instance.reference === boundariesElement) {
  35612. boundariesElement = getOffsetParent(boundariesElement);
  35613. }
  35614. // NOTE: DOM access here
  35615. // resets the popper's position so that the document size can be calculated excluding
  35616. // the size of the popper element itself
  35617. var transformProp = getSupportedPropertyName('transform');
  35618. var popperStyles = data.instance.popper.style; // assignment to help minification
  35619. var top = popperStyles.top,
  35620. left = popperStyles.left,
  35621. transform = popperStyles[transformProp];
  35622. popperStyles.top = '';
  35623. popperStyles.left = '';
  35624. popperStyles[transformProp] = '';
  35625. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35626. // NOTE: DOM access here
  35627. // restores the original style properties after the offsets have been computed
  35628. popperStyles.top = top;
  35629. popperStyles.left = left;
  35630. popperStyles[transformProp] = transform;
  35631. options.boundaries = boundaries;
  35632. var order = options.priority;
  35633. var popper = data.offsets.popper;
  35634. var check = {
  35635. primary: function primary(placement) {
  35636. var value = popper[placement];
  35637. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35638. value = Math.max(popper[placement], boundaries[placement]);
  35639. }
  35640. return defineProperty({}, placement, value);
  35641. },
  35642. secondary: function secondary(placement) {
  35643. var mainSide = placement === 'right' ? 'left' : 'top';
  35644. var value = popper[mainSide];
  35645. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35646. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35647. }
  35648. return defineProperty({}, mainSide, value);
  35649. }
  35650. };
  35651. order.forEach(function (placement) {
  35652. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35653. popper = _extends({}, popper, check[side](placement));
  35654. });
  35655. data.offsets.popper = popper;
  35656. return data;
  35657. }
  35658. /**
  35659. * @function
  35660. * @memberof Modifiers
  35661. * @argument {Object} data - The data object generated by `update` method
  35662. * @argument {Object} options - Modifiers configuration and options
  35663. * @returns {Object} The data object, properly modified
  35664. */
  35665. function shift(data) {
  35666. var placement = data.placement;
  35667. var basePlacement = placement.split('-')[0];
  35668. var shiftvariation = placement.split('-')[1];
  35669. // if shift shiftvariation is specified, run the modifier
  35670. if (shiftvariation) {
  35671. var _data$offsets = data.offsets,
  35672. reference = _data$offsets.reference,
  35673. popper = _data$offsets.popper;
  35674. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35675. var side = isVertical ? 'left' : 'top';
  35676. var measurement = isVertical ? 'width' : 'height';
  35677. var shiftOffsets = {
  35678. start: defineProperty({}, side, reference[side]),
  35679. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35680. };
  35681. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35682. }
  35683. return data;
  35684. }
  35685. /**
  35686. * @function
  35687. * @memberof Modifiers
  35688. * @argument {Object} data - The data object generated by update method
  35689. * @argument {Object} options - Modifiers configuration and options
  35690. * @returns {Object} The data object, properly modified
  35691. */
  35692. function hide(data) {
  35693. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35694. return data;
  35695. }
  35696. var refRect = data.offsets.reference;
  35697. var bound = find(data.instance.modifiers, function (modifier) {
  35698. return modifier.name === 'preventOverflow';
  35699. }).boundaries;
  35700. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35701. // Avoid unnecessary DOM access if visibility hasn't changed
  35702. if (data.hide === true) {
  35703. return data;
  35704. }
  35705. data.hide = true;
  35706. data.attributes['x-out-of-boundaries'] = '';
  35707. } else {
  35708. // Avoid unnecessary DOM access if visibility hasn't changed
  35709. if (data.hide === false) {
  35710. return data;
  35711. }
  35712. data.hide = false;
  35713. data.attributes['x-out-of-boundaries'] = false;
  35714. }
  35715. return data;
  35716. }
  35717. /**
  35718. * @function
  35719. * @memberof Modifiers
  35720. * @argument {Object} data - The data object generated by `update` method
  35721. * @argument {Object} options - Modifiers configuration and options
  35722. * @returns {Object} The data object, properly modified
  35723. */
  35724. function inner(data) {
  35725. var placement = data.placement;
  35726. var basePlacement = placement.split('-')[0];
  35727. var _data$offsets = data.offsets,
  35728. popper = _data$offsets.popper,
  35729. reference = _data$offsets.reference;
  35730. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35731. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35732. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35733. data.placement = getOppositePlacement(placement);
  35734. data.offsets.popper = getClientRect(popper);
  35735. return data;
  35736. }
  35737. /**
  35738. * Modifier function, each modifier can have a function of this type assigned
  35739. * to its `fn` property.<br />
  35740. * These functions will be called on each update, this means that you must
  35741. * make sure they are performant enough to avoid performance bottlenecks.
  35742. *
  35743. * @function ModifierFn
  35744. * @argument {dataObject} data - The data object generated by `update` method
  35745. * @argument {Object} options - Modifiers configuration and options
  35746. * @returns {dataObject} The data object, properly modified
  35747. */
  35748. /**
  35749. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35750. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35751. * needed by the library.
  35752. *
  35753. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35754. * All the other properties are configurations that could be tweaked.
  35755. * @namespace modifiers
  35756. */
  35757. var modifiers = {
  35758. /**
  35759. * Modifier used to shift the popper on the start or end of its reference
  35760. * element.<br />
  35761. * It will read the variation of the `placement` property.<br />
  35762. * It can be one either `-end` or `-start`.
  35763. * @memberof modifiers
  35764. * @inner
  35765. */
  35766. shift: {
  35767. /** @prop {number} order=100 - Index used to define the order of execution */
  35768. order: 100,
  35769. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35770. enabled: true,
  35771. /** @prop {ModifierFn} */
  35772. fn: shift
  35773. },
  35774. /**
  35775. * The `offset` modifier can shift your popper on both its axis.
  35776. *
  35777. * It accepts the following units:
  35778. * - `px` or unit-less, interpreted as pixels
  35779. * - `%` or `%r`, percentage relative to the length of the reference element
  35780. * - `%p`, percentage relative to the length of the popper element
  35781. * - `vw`, CSS viewport width unit
  35782. * - `vh`, CSS viewport height unit
  35783. *
  35784. * For length is intended the main axis relative to the placement of the popper.<br />
  35785. * This means that if the placement is `top` or `bottom`, the length will be the
  35786. * `width`. In case of `left` or `right`, it will be the `height`.
  35787. *
  35788. * You can provide a single value (as `Number` or `String`), or a pair of values
  35789. * as `String` divided by a comma or one (or more) white spaces.<br />
  35790. * The latter is a deprecated method because it leads to confusion and will be
  35791. * removed in v2.<br />
  35792. * Additionally, it accepts additions and subtractions between different units.
  35793. * Note that multiplications and divisions aren't supported.
  35794. *
  35795. * Valid examples are:
  35796. * ```
  35797. * 10
  35798. * '10%'
  35799. * '10, 10'
  35800. * '10%, 10'
  35801. * '10 + 10%'
  35802. * '10 - 5vh + 3%'
  35803. * '-10px + 5vh, 5px - 6%'
  35804. * ```
  35805. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35806. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35807. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35808. *
  35809. * @memberof modifiers
  35810. * @inner
  35811. */
  35812. offset: {
  35813. /** @prop {number} order=200 - Index used to define the order of execution */
  35814. order: 200,
  35815. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35816. enabled: true,
  35817. /** @prop {ModifierFn} */
  35818. fn: offset,
  35819. /** @prop {Number|String} offset=0
  35820. * The offset value as described in the modifier description
  35821. */
  35822. offset: 0
  35823. },
  35824. /**
  35825. * Modifier used to prevent the popper from being positioned outside the boundary.
  35826. *
  35827. * A scenario exists where the reference itself is not within the boundaries.<br />
  35828. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35829. * In this case we need to decide whether the popper should either:
  35830. *
  35831. * - detach from the reference and remain "trapped" in the boundaries, or
  35832. * - if it should ignore the boundary and "escape with its reference"
  35833. *
  35834. * When `escapeWithReference` is set to`true` and reference is completely
  35835. * outside its boundaries, the popper will overflow (or completely leave)
  35836. * the boundaries in order to remain attached to the edge of the reference.
  35837. *
  35838. * @memberof modifiers
  35839. * @inner
  35840. */
  35841. preventOverflow: {
  35842. /** @prop {number} order=300 - Index used to define the order of execution */
  35843. order: 300,
  35844. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35845. enabled: true,
  35846. /** @prop {ModifierFn} */
  35847. fn: preventOverflow,
  35848. /**
  35849. * @prop {Array} [priority=['left','right','top','bottom']]
  35850. * Popper will try to prevent overflow following these priorities by default,
  35851. * then, it could overflow on the left and on top of the `boundariesElement`
  35852. */
  35853. priority: ['left', 'right', 'top', 'bottom'],
  35854. /**
  35855. * @prop {number} padding=5
  35856. * Amount of pixel used to define a minimum distance between the boundaries
  35857. * and the popper. This makes sure the popper always has a little padding
  35858. * between the edges of its container
  35859. */
  35860. padding: 5,
  35861. /**
  35862. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35863. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35864. * `viewport` or any DOM element.
  35865. */
  35866. boundariesElement: 'scrollParent'
  35867. },
  35868. /**
  35869. * Modifier used to make sure the reference and its popper stay near each other
  35870. * without leaving any gap between the two. Especially useful when the arrow is
  35871. * enabled and you want to ensure that it points to its reference element.
  35872. * It cares only about the first axis. You can still have poppers with margin
  35873. * between the popper and its reference element.
  35874. * @memberof modifiers
  35875. * @inner
  35876. */
  35877. keepTogether: {
  35878. /** @prop {number} order=400 - Index used to define the order of execution */
  35879. order: 400,
  35880. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35881. enabled: true,
  35882. /** @prop {ModifierFn} */
  35883. fn: keepTogether
  35884. },
  35885. /**
  35886. * This modifier is used to move the `arrowElement` of the popper to make
  35887. * sure it is positioned between the reference element and its popper element.
  35888. * It will read the outer size of the `arrowElement` node to detect how many
  35889. * pixels of conjunction are needed.
  35890. *
  35891. * It has no effect if no `arrowElement` is provided.
  35892. * @memberof modifiers
  35893. * @inner
  35894. */
  35895. arrow: {
  35896. /** @prop {number} order=500 - Index used to define the order of execution */
  35897. order: 500,
  35898. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35899. enabled: true,
  35900. /** @prop {ModifierFn} */
  35901. fn: arrow,
  35902. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35903. element: '[x-arrow]'
  35904. },
  35905. /**
  35906. * Modifier used to flip the popper's placement when it starts to overlap its
  35907. * reference element.
  35908. *
  35909. * Requires the `preventOverflow` modifier before it in order to work.
  35910. *
  35911. * **NOTE:** this modifier will interrupt the current update cycle and will
  35912. * restart it if it detects the need to flip the placement.
  35913. * @memberof modifiers
  35914. * @inner
  35915. */
  35916. flip: {
  35917. /** @prop {number} order=600 - Index used to define the order of execution */
  35918. order: 600,
  35919. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35920. enabled: true,
  35921. /** @prop {ModifierFn} */
  35922. fn: flip,
  35923. /**
  35924. * @prop {String|Array} behavior='flip'
  35925. * The behavior used to change the popper's placement. It can be one of
  35926. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35927. * placements (with optional variations)
  35928. */
  35929. behavior: 'flip',
  35930. /**
  35931. * @prop {number} padding=5
  35932. * The popper will flip if it hits the edges of the `boundariesElement`
  35933. */
  35934. padding: 5,
  35935. /**
  35936. * @prop {String|HTMLElement} boundariesElement='viewport'
  35937. * The element which will define the boundaries of the popper position.
  35938. * The popper will never be placed outside of the defined boundaries
  35939. * (except if `keepTogether` is enabled)
  35940. */
  35941. boundariesElement: 'viewport',
  35942. /**
  35943. * @prop {Boolean} flipVariations=false
  35944. * The popper will switch placement variation between `-start` and `-end` when
  35945. * the reference element overlaps its boundaries.
  35946. *
  35947. * The original placement should have a set variation.
  35948. */
  35949. flipVariations: false,
  35950. /**
  35951. * @prop {Boolean} flipVariationsByContent=false
  35952. * The popper will switch placement variation between `-start` and `-end` when
  35953. * the popper element overlaps its reference boundaries.
  35954. *
  35955. * The original placement should have a set variation.
  35956. */
  35957. flipVariationsByContent: false
  35958. },
  35959. /**
  35960. * Modifier used to make the popper flow toward the inner of the reference element.
  35961. * By default, when this modifier is disabled, the popper will be placed outside
  35962. * the reference element.
  35963. * @memberof modifiers
  35964. * @inner
  35965. */
  35966. inner: {
  35967. /** @prop {number} order=700 - Index used to define the order of execution */
  35968. order: 700,
  35969. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  35970. enabled: false,
  35971. /** @prop {ModifierFn} */
  35972. fn: inner
  35973. },
  35974. /**
  35975. * Modifier used to hide the popper when its reference element is outside of the
  35976. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  35977. * be used to hide with a CSS selector the popper when its reference is
  35978. * out of boundaries.
  35979. *
  35980. * Requires the `preventOverflow` modifier before it in order to work.
  35981. * @memberof modifiers
  35982. * @inner
  35983. */
  35984. hide: {
  35985. /** @prop {number} order=800 - Index used to define the order of execution */
  35986. order: 800,
  35987. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35988. enabled: true,
  35989. /** @prop {ModifierFn} */
  35990. fn: hide
  35991. },
  35992. /**
  35993. * Computes the style that will be applied to the popper element to gets
  35994. * properly positioned.
  35995. *
  35996. * Note that this modifier will not touch the DOM, it just prepares the styles
  35997. * so that `applyStyle` modifier can apply it. This separation is useful
  35998. * in case you need to replace `applyStyle` with a custom implementation.
  35999. *
  36000. * This modifier has `850` as `order` value to maintain backward compatibility
  36001. * with previous versions of Popper.js. Expect the modifiers ordering method
  36002. * to change in future major versions of the library.
  36003. *
  36004. * @memberof modifiers
  36005. * @inner
  36006. */
  36007. computeStyle: {
  36008. /** @prop {number} order=850 - Index used to define the order of execution */
  36009. order: 850,
  36010. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36011. enabled: true,
  36012. /** @prop {ModifierFn} */
  36013. fn: computeStyle,
  36014. /**
  36015. * @prop {Boolean} gpuAcceleration=true
  36016. * If true, it uses the CSS 3D transformation to position the popper.
  36017. * Otherwise, it will use the `top` and `left` properties
  36018. */
  36019. gpuAcceleration: true,
  36020. /**
  36021. * @prop {string} [x='bottom']
  36022. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36023. * Change this if your popper should grow in a direction different from `bottom`
  36024. */
  36025. x: 'bottom',
  36026. /**
  36027. * @prop {string} [x='left']
  36028. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36029. * Change this if your popper should grow in a direction different from `right`
  36030. */
  36031. y: 'right'
  36032. },
  36033. /**
  36034. * Applies the computed styles to the popper element.
  36035. *
  36036. * All the DOM manipulations are limited to this modifier. This is useful in case
  36037. * you want to integrate Popper.js inside a framework or view library and you
  36038. * want to delegate all the DOM manipulations to it.
  36039. *
  36040. * Note that if you disable this modifier, you must make sure the popper element
  36041. * has its position set to `absolute` before Popper.js can do its work!
  36042. *
  36043. * Just disable this modifier and define your own to achieve the desired effect.
  36044. *
  36045. * @memberof modifiers
  36046. * @inner
  36047. */
  36048. applyStyle: {
  36049. /** @prop {number} order=900 - Index used to define the order of execution */
  36050. order: 900,
  36051. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36052. enabled: true,
  36053. /** @prop {ModifierFn} */
  36054. fn: applyStyle,
  36055. /** @prop {Function} */
  36056. onLoad: applyStyleOnLoad,
  36057. /**
  36058. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36059. * @prop {Boolean} gpuAcceleration=true
  36060. * If true, it uses the CSS 3D transformation to position the popper.
  36061. * Otherwise, it will use the `top` and `left` properties
  36062. */
  36063. gpuAcceleration: undefined
  36064. }
  36065. };
  36066. /**
  36067. * The `dataObject` is an object containing all the information used by Popper.js.
  36068. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36069. * @name dataObject
  36070. * @property {Object} data.instance The Popper.js instance
  36071. * @property {String} data.placement Placement applied to popper
  36072. * @property {String} data.originalPlacement Placement originally defined on init
  36073. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36074. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36075. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36076. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36077. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36078. * @property {Object} data.boundaries Offsets of the popper boundaries
  36079. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36080. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36081. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36082. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36083. */
  36084. /**
  36085. * Default options provided to Popper.js constructor.<br />
  36086. * These can be overridden using the `options` argument of Popper.js.<br />
  36087. * To override an option, simply pass an object with the same
  36088. * structure of the `options` object, as the 3rd argument. For example:
  36089. * ```
  36090. * new Popper(ref, pop, {
  36091. * modifiers: {
  36092. * preventOverflow: { enabled: false }
  36093. * }
  36094. * })
  36095. * ```
  36096. * @type {Object}
  36097. * @static
  36098. * @memberof Popper
  36099. */
  36100. var Defaults = {
  36101. /**
  36102. * Popper's placement.
  36103. * @prop {Popper.placements} placement='bottom'
  36104. */
  36105. placement: 'bottom',
  36106. /**
  36107. * Set this to true if you want popper to position it self in 'fixed' mode
  36108. * @prop {Boolean} positionFixed=false
  36109. */
  36110. positionFixed: false,
  36111. /**
  36112. * Whether events (resize, scroll) are initially enabled.
  36113. * @prop {Boolean} eventsEnabled=true
  36114. */
  36115. eventsEnabled: true,
  36116. /**
  36117. * Set to true if you want to automatically remove the popper when
  36118. * you call the `destroy` method.
  36119. * @prop {Boolean} removeOnDestroy=false
  36120. */
  36121. removeOnDestroy: false,
  36122. /**
  36123. * Callback called when the popper is created.<br />
  36124. * By default, it is set to no-op.<br />
  36125. * Access Popper.js instance with `data.instance`.
  36126. * @prop {onCreate}
  36127. */
  36128. onCreate: function onCreate() {},
  36129. /**
  36130. * Callback called when the popper is updated. This callback is not called
  36131. * on the initialization/creation of the popper, but only on subsequent
  36132. * updates.<br />
  36133. * By default, it is set to no-op.<br />
  36134. * Access Popper.js instance with `data.instance`.
  36135. * @prop {onUpdate}
  36136. */
  36137. onUpdate: function onUpdate() {},
  36138. /**
  36139. * List of modifiers used to modify the offsets before they are applied to the popper.
  36140. * They provide most of the functionalities of Popper.js.
  36141. * @prop {modifiers}
  36142. */
  36143. modifiers: modifiers
  36144. };
  36145. /**
  36146. * @callback onCreate
  36147. * @param {dataObject} data
  36148. */
  36149. /**
  36150. * @callback onUpdate
  36151. * @param {dataObject} data
  36152. */
  36153. // Utils
  36154. // Methods
  36155. var Popper = function () {
  36156. /**
  36157. * Creates a new Popper.js instance.
  36158. * @class Popper
  36159. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36160. * @param {Element} popper - The HTML / XML element used as the popper
  36161. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36162. * @return {Object} instance - The generated Popper.js instance
  36163. */
  36164. function Popper(reference, popper) {
  36165. var _this = this;
  36166. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36167. classCallCheck(this, Popper);
  36168. this.scheduleUpdate = function () {
  36169. return requestAnimationFrame(_this.update);
  36170. };
  36171. // make update() debounced, so that it only runs at most once-per-tick
  36172. this.update = debounce(this.update.bind(this));
  36173. // with {} we create a new object with the options inside it
  36174. this.options = _extends({}, Popper.Defaults, options);
  36175. // init state
  36176. this.state = {
  36177. isDestroyed: false,
  36178. isCreated: false,
  36179. scrollParents: []
  36180. };
  36181. // get reference and popper elements (allow jQuery wrappers)
  36182. this.reference = reference && reference.jquery ? reference[0] : reference;
  36183. this.popper = popper && popper.jquery ? popper[0] : popper;
  36184. // Deep merge modifiers options
  36185. this.options.modifiers = {};
  36186. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36187. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36188. });
  36189. // Refactoring modifiers' list (Object => Array)
  36190. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36191. return _extends({
  36192. name: name
  36193. }, _this.options.modifiers[name]);
  36194. })
  36195. // sort the modifiers by order
  36196. .sort(function (a, b) {
  36197. return a.order - b.order;
  36198. });
  36199. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36200. // such code is executed in the same order of its modifier
  36201. // they could add new properties to their options configuration
  36202. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36203. this.modifiers.forEach(function (modifierOptions) {
  36204. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36205. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36206. }
  36207. });
  36208. // fire the first update to position the popper in the right place
  36209. this.update();
  36210. var eventsEnabled = this.options.eventsEnabled;
  36211. if (eventsEnabled) {
  36212. // setup event listeners, they will take care of update the position in specific situations
  36213. this.enableEventListeners();
  36214. }
  36215. this.state.eventsEnabled = eventsEnabled;
  36216. }
  36217. // We can't use class properties because they don't get listed in the
  36218. // class prototype and break stuff like Sinon stubs
  36219. createClass(Popper, [{
  36220. key: 'update',
  36221. value: function update$$1() {
  36222. return update.call(this);
  36223. }
  36224. }, {
  36225. key: 'destroy',
  36226. value: function destroy$$1() {
  36227. return destroy.call(this);
  36228. }
  36229. }, {
  36230. key: 'enableEventListeners',
  36231. value: function enableEventListeners$$1() {
  36232. return enableEventListeners.call(this);
  36233. }
  36234. }, {
  36235. key: 'disableEventListeners',
  36236. value: function disableEventListeners$$1() {
  36237. return disableEventListeners.call(this);
  36238. }
  36239. /**
  36240. * Schedules an update. It will run on the next UI update available.
  36241. * @method scheduleUpdate
  36242. * @memberof Popper
  36243. */
  36244. /**
  36245. * Collection of utilities useful when writing custom modifiers.
  36246. * Starting from version 1.7, this method is available only if you
  36247. * include `popper-utils.js` before `popper.js`.
  36248. *
  36249. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36250. * and will be removed in v2! Use the PopperUtils module directly instead.
  36251. * Due to the high instability of the methods contained in Utils, we can't
  36252. * guarantee them to follow semver. Use them at your own risk!
  36253. * @static
  36254. * @private
  36255. * @type {Object}
  36256. * @deprecated since version 1.8
  36257. * @member Utils
  36258. * @memberof Popper
  36259. */
  36260. }]);
  36261. return Popper;
  36262. }();
  36263. /**
  36264. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36265. * and lets you use it as replacement of a real DOM node.<br />
  36266. * You can use this method to position a popper relatively to a set of coordinates
  36267. * in case you don't have a DOM node to use as reference.
  36268. *
  36269. * ```
  36270. * new Popper(referenceObject, popperNode);
  36271. * ```
  36272. *
  36273. * NB: This feature isn't supported in Internet Explorer 10.
  36274. * @name referenceObject
  36275. * @property {Function} data.getBoundingClientRect
  36276. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36277. * @property {number} data.clientWidth
  36278. * An ES6 getter that will return the width of the virtual reference element.
  36279. * @property {number} data.clientHeight
  36280. * An ES6 getter that will return the height of the virtual reference element.
  36281. */
  36282. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36283. Popper.placements = placements;
  36284. Popper.Defaults = Defaults;
  36285. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36286. //# sourceMappingURL=popper.js.map
  36287. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36288. /***/ }),
  36289. /***/ "./node_modules/process/browser.js":
  36290. /*!*****************************************!*\
  36291. !*** ./node_modules/process/browser.js ***!
  36292. \*****************************************/
  36293. /*! no static exports found */
  36294. /***/ (function(module, exports) {
  36295. // shim for using process in browser
  36296. var process = module.exports = {};
  36297. // cached from whatever global is present so that test runners that stub it
  36298. // don't break things. But we need to wrap it in a try catch in case it is
  36299. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36300. // function because try/catches deoptimize in certain engines.
  36301. var cachedSetTimeout;
  36302. var cachedClearTimeout;
  36303. function defaultSetTimout() {
  36304. throw new Error('setTimeout has not been defined');
  36305. }
  36306. function defaultClearTimeout () {
  36307. throw new Error('clearTimeout has not been defined');
  36308. }
  36309. (function () {
  36310. try {
  36311. if (typeof setTimeout === 'function') {
  36312. cachedSetTimeout = setTimeout;
  36313. } else {
  36314. cachedSetTimeout = defaultSetTimout;
  36315. }
  36316. } catch (e) {
  36317. cachedSetTimeout = defaultSetTimout;
  36318. }
  36319. try {
  36320. if (typeof clearTimeout === 'function') {
  36321. cachedClearTimeout = clearTimeout;
  36322. } else {
  36323. cachedClearTimeout = defaultClearTimeout;
  36324. }
  36325. } catch (e) {
  36326. cachedClearTimeout = defaultClearTimeout;
  36327. }
  36328. } ())
  36329. function runTimeout(fun) {
  36330. if (cachedSetTimeout === setTimeout) {
  36331. //normal enviroments in sane situations
  36332. return setTimeout(fun, 0);
  36333. }
  36334. // if setTimeout wasn't available but was latter defined
  36335. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36336. cachedSetTimeout = setTimeout;
  36337. return setTimeout(fun, 0);
  36338. }
  36339. try {
  36340. // when when somebody has screwed with setTimeout but no I.E. maddness
  36341. return cachedSetTimeout(fun, 0);
  36342. } catch(e){
  36343. try {
  36344. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36345. return cachedSetTimeout.call(null, fun, 0);
  36346. } catch(e){
  36347. // 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
  36348. return cachedSetTimeout.call(this, fun, 0);
  36349. }
  36350. }
  36351. }
  36352. function runClearTimeout(marker) {
  36353. if (cachedClearTimeout === clearTimeout) {
  36354. //normal enviroments in sane situations
  36355. return clearTimeout(marker);
  36356. }
  36357. // if clearTimeout wasn't available but was latter defined
  36358. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36359. cachedClearTimeout = clearTimeout;
  36360. return clearTimeout(marker);
  36361. }
  36362. try {
  36363. // when when somebody has screwed with setTimeout but no I.E. maddness
  36364. return cachedClearTimeout(marker);
  36365. } catch (e){
  36366. try {
  36367. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36368. return cachedClearTimeout.call(null, marker);
  36369. } catch (e){
  36370. // 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.
  36371. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36372. return cachedClearTimeout.call(this, marker);
  36373. }
  36374. }
  36375. }
  36376. var queue = [];
  36377. var draining = false;
  36378. var currentQueue;
  36379. var queueIndex = -1;
  36380. function cleanUpNextTick() {
  36381. if (!draining || !currentQueue) {
  36382. return;
  36383. }
  36384. draining = false;
  36385. if (currentQueue.length) {
  36386. queue = currentQueue.concat(queue);
  36387. } else {
  36388. queueIndex = -1;
  36389. }
  36390. if (queue.length) {
  36391. drainQueue();
  36392. }
  36393. }
  36394. function drainQueue() {
  36395. if (draining) {
  36396. return;
  36397. }
  36398. var timeout = runTimeout(cleanUpNextTick);
  36399. draining = true;
  36400. var len = queue.length;
  36401. while(len) {
  36402. currentQueue = queue;
  36403. queue = [];
  36404. while (++queueIndex < len) {
  36405. if (currentQueue) {
  36406. currentQueue[queueIndex].run();
  36407. }
  36408. }
  36409. queueIndex = -1;
  36410. len = queue.length;
  36411. }
  36412. currentQueue = null;
  36413. draining = false;
  36414. runClearTimeout(timeout);
  36415. }
  36416. process.nextTick = function (fun) {
  36417. var args = new Array(arguments.length - 1);
  36418. if (arguments.length > 1) {
  36419. for (var i = 1; i < arguments.length; i++) {
  36420. args[i - 1] = arguments[i];
  36421. }
  36422. }
  36423. queue.push(new Item(fun, args));
  36424. if (queue.length === 1 && !draining) {
  36425. runTimeout(drainQueue);
  36426. }
  36427. };
  36428. // v8 likes predictible objects
  36429. function Item(fun, array) {
  36430. this.fun = fun;
  36431. this.array = array;
  36432. }
  36433. Item.prototype.run = function () {
  36434. this.fun.apply(null, this.array);
  36435. };
  36436. process.title = 'browser';
  36437. process.browser = true;
  36438. process.env = {};
  36439. process.argv = [];
  36440. process.version = ''; // empty string to avoid regexp issues
  36441. process.versions = {};
  36442. function noop() {}
  36443. process.on = noop;
  36444. process.addListener = noop;
  36445. process.once = noop;
  36446. process.off = noop;
  36447. process.removeListener = noop;
  36448. process.removeAllListeners = noop;
  36449. process.emit = noop;
  36450. process.prependListener = noop;
  36451. process.prependOnceListener = noop;
  36452. process.listeners = function (name) { return [] }
  36453. process.binding = function (name) {
  36454. throw new Error('process.binding is not supported');
  36455. };
  36456. process.cwd = function () { return '/' };
  36457. process.chdir = function (dir) {
  36458. throw new Error('process.chdir is not supported');
  36459. };
  36460. process.umask = function() { return 0; };
  36461. /***/ }),
  36462. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36463. /*!***************************************************!*\
  36464. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36465. \***************************************************/
  36466. /*! no static exports found */
  36467. /***/ (function(module, exports, __webpack_require__) {
  36468. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36469. * Pusher JavaScript Library v5.0.3
  36470. * https://pusher.com/
  36471. *
  36472. * Copyright 2017, Pusher
  36473. * Released under the MIT licence.
  36474. */
  36475. (function webpackUniversalModuleDefinition(root, factory) {
  36476. if(true)
  36477. module.exports = factory();
  36478. else {}
  36479. })(window, function() {
  36480. return /******/ (function(modules) { // webpackBootstrap
  36481. /******/ // The module cache
  36482. /******/ var installedModules = {};
  36483. /******/
  36484. /******/ // The require function
  36485. /******/ function __webpack_require__(moduleId) {
  36486. /******/
  36487. /******/ // Check if module is in cache
  36488. /******/ if(installedModules[moduleId]) {
  36489. /******/ return installedModules[moduleId].exports;
  36490. /******/ }
  36491. /******/ // Create a new module (and put it into the cache)
  36492. /******/ var module = installedModules[moduleId] = {
  36493. /******/ i: moduleId,
  36494. /******/ l: false,
  36495. /******/ exports: {}
  36496. /******/ };
  36497. /******/
  36498. /******/ // Execute the module function
  36499. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36500. /******/
  36501. /******/ // Flag the module as loaded
  36502. /******/ module.l = true;
  36503. /******/
  36504. /******/ // Return the exports of the module
  36505. /******/ return module.exports;
  36506. /******/ }
  36507. /******/
  36508. /******/
  36509. /******/ // expose the modules object (__webpack_modules__)
  36510. /******/ __webpack_require__.m = modules;
  36511. /******/
  36512. /******/ // expose the module cache
  36513. /******/ __webpack_require__.c = installedModules;
  36514. /******/
  36515. /******/ // define getter function for harmony exports
  36516. /******/ __webpack_require__.d = function(exports, name, getter) {
  36517. /******/ if(!__webpack_require__.o(exports, name)) {
  36518. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36519. /******/ }
  36520. /******/ };
  36521. /******/
  36522. /******/ // define __esModule on exports
  36523. /******/ __webpack_require__.r = function(exports) {
  36524. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36525. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36526. /******/ }
  36527. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36528. /******/ };
  36529. /******/
  36530. /******/ // create a fake namespace object
  36531. /******/ // mode & 1: value is a module id, require it
  36532. /******/ // mode & 2: merge all properties of value into the ns
  36533. /******/ // mode & 4: return value when already ns object
  36534. /******/ // mode & 8|1: behave like require
  36535. /******/ __webpack_require__.t = function(value, mode) {
  36536. /******/ if(mode & 1) value = __webpack_require__(value);
  36537. /******/ if(mode & 8) return value;
  36538. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36539. /******/ var ns = Object.create(null);
  36540. /******/ __webpack_require__.r(ns);
  36541. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36542. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36543. /******/ return ns;
  36544. /******/ };
  36545. /******/
  36546. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36547. /******/ __webpack_require__.n = function(module) {
  36548. /******/ var getter = module && module.__esModule ?
  36549. /******/ function getDefault() { return module['default']; } :
  36550. /******/ function getModuleExports() { return module; };
  36551. /******/ __webpack_require__.d(getter, 'a', getter);
  36552. /******/ return getter;
  36553. /******/ };
  36554. /******/
  36555. /******/ // Object.prototype.hasOwnProperty.call
  36556. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36557. /******/
  36558. /******/ // __webpack_public_path__
  36559. /******/ __webpack_require__.p = "";
  36560. /******/
  36561. /******/
  36562. /******/ // Load entry module and return exports
  36563. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36564. /******/ })
  36565. /************************************************************************/
  36566. /******/ ([
  36567. /* 0 */
  36568. /***/ (function(module, exports, __webpack_require__) {
  36569. (function(nacl) {
  36570. 'use strict';
  36571. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36572. // Public domain.
  36573. //
  36574. // Implementation derived from TweetNaCl version 20140427.
  36575. // See for details: http://tweetnacl.cr.yp.to/
  36576. var gf = function(init) {
  36577. var i, r = new Float64Array(16);
  36578. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36579. return r;
  36580. };
  36581. // Pluggable, initialized in high-level API below.
  36582. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36583. var _0 = new Uint8Array(16);
  36584. var _9 = new Uint8Array(32); _9[0] = 9;
  36585. var gf0 = gf(),
  36586. gf1 = gf([1]),
  36587. _121665 = gf([0xdb41, 1]),
  36588. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36589. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36590. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36591. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36592. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36593. function ts64(x, i, h, l) {
  36594. x[i] = (h >> 24) & 0xff;
  36595. x[i+1] = (h >> 16) & 0xff;
  36596. x[i+2] = (h >> 8) & 0xff;
  36597. x[i+3] = h & 0xff;
  36598. x[i+4] = (l >> 24) & 0xff;
  36599. x[i+5] = (l >> 16) & 0xff;
  36600. x[i+6] = (l >> 8) & 0xff;
  36601. x[i+7] = l & 0xff;
  36602. }
  36603. function vn(x, xi, y, yi, n) {
  36604. var i,d = 0;
  36605. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36606. return (1 & ((d - 1) >>> 8)) - 1;
  36607. }
  36608. function crypto_verify_16(x, xi, y, yi) {
  36609. return vn(x,xi,y,yi,16);
  36610. }
  36611. function crypto_verify_32(x, xi, y, yi) {
  36612. return vn(x,xi,y,yi,32);
  36613. }
  36614. function core_salsa20(o, p, k, c) {
  36615. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36616. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36617. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36618. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36619. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36620. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36621. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36622. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36623. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36624. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36625. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36626. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36627. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36628. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36629. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36630. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36631. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36632. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36633. x15 = j15, u;
  36634. for (var i = 0; i < 20; i += 2) {
  36635. u = x0 + x12 | 0;
  36636. x4 ^= u<<7 | u>>>(32-7);
  36637. u = x4 + x0 | 0;
  36638. x8 ^= u<<9 | u>>>(32-9);
  36639. u = x8 + x4 | 0;
  36640. x12 ^= u<<13 | u>>>(32-13);
  36641. u = x12 + x8 | 0;
  36642. x0 ^= u<<18 | u>>>(32-18);
  36643. u = x5 + x1 | 0;
  36644. x9 ^= u<<7 | u>>>(32-7);
  36645. u = x9 + x5 | 0;
  36646. x13 ^= u<<9 | u>>>(32-9);
  36647. u = x13 + x9 | 0;
  36648. x1 ^= u<<13 | u>>>(32-13);
  36649. u = x1 + x13 | 0;
  36650. x5 ^= u<<18 | u>>>(32-18);
  36651. u = x10 + x6 | 0;
  36652. x14 ^= u<<7 | u>>>(32-7);
  36653. u = x14 + x10 | 0;
  36654. x2 ^= u<<9 | u>>>(32-9);
  36655. u = x2 + x14 | 0;
  36656. x6 ^= u<<13 | u>>>(32-13);
  36657. u = x6 + x2 | 0;
  36658. x10 ^= u<<18 | u>>>(32-18);
  36659. u = x15 + x11 | 0;
  36660. x3 ^= u<<7 | u>>>(32-7);
  36661. u = x3 + x15 | 0;
  36662. x7 ^= u<<9 | u>>>(32-9);
  36663. u = x7 + x3 | 0;
  36664. x11 ^= u<<13 | u>>>(32-13);
  36665. u = x11 + x7 | 0;
  36666. x15 ^= u<<18 | u>>>(32-18);
  36667. u = x0 + x3 | 0;
  36668. x1 ^= u<<7 | u>>>(32-7);
  36669. u = x1 + x0 | 0;
  36670. x2 ^= u<<9 | u>>>(32-9);
  36671. u = x2 + x1 | 0;
  36672. x3 ^= u<<13 | u>>>(32-13);
  36673. u = x3 + x2 | 0;
  36674. x0 ^= u<<18 | u>>>(32-18);
  36675. u = x5 + x4 | 0;
  36676. x6 ^= u<<7 | u>>>(32-7);
  36677. u = x6 + x5 | 0;
  36678. x7 ^= u<<9 | u>>>(32-9);
  36679. u = x7 + x6 | 0;
  36680. x4 ^= u<<13 | u>>>(32-13);
  36681. u = x4 + x7 | 0;
  36682. x5 ^= u<<18 | u>>>(32-18);
  36683. u = x10 + x9 | 0;
  36684. x11 ^= u<<7 | u>>>(32-7);
  36685. u = x11 + x10 | 0;
  36686. x8 ^= u<<9 | u>>>(32-9);
  36687. u = x8 + x11 | 0;
  36688. x9 ^= u<<13 | u>>>(32-13);
  36689. u = x9 + x8 | 0;
  36690. x10 ^= u<<18 | u>>>(32-18);
  36691. u = x15 + x14 | 0;
  36692. x12 ^= u<<7 | u>>>(32-7);
  36693. u = x12 + x15 | 0;
  36694. x13 ^= u<<9 | u>>>(32-9);
  36695. u = x13 + x12 | 0;
  36696. x14 ^= u<<13 | u>>>(32-13);
  36697. u = x14 + x13 | 0;
  36698. x15 ^= u<<18 | u>>>(32-18);
  36699. }
  36700. x0 = x0 + j0 | 0;
  36701. x1 = x1 + j1 | 0;
  36702. x2 = x2 + j2 | 0;
  36703. x3 = x3 + j3 | 0;
  36704. x4 = x4 + j4 | 0;
  36705. x5 = x5 + j5 | 0;
  36706. x6 = x6 + j6 | 0;
  36707. x7 = x7 + j7 | 0;
  36708. x8 = x8 + j8 | 0;
  36709. x9 = x9 + j9 | 0;
  36710. x10 = x10 + j10 | 0;
  36711. x11 = x11 + j11 | 0;
  36712. x12 = x12 + j12 | 0;
  36713. x13 = x13 + j13 | 0;
  36714. x14 = x14 + j14 | 0;
  36715. x15 = x15 + j15 | 0;
  36716. o[ 0] = x0 >>> 0 & 0xff;
  36717. o[ 1] = x0 >>> 8 & 0xff;
  36718. o[ 2] = x0 >>> 16 & 0xff;
  36719. o[ 3] = x0 >>> 24 & 0xff;
  36720. o[ 4] = x1 >>> 0 & 0xff;
  36721. o[ 5] = x1 >>> 8 & 0xff;
  36722. o[ 6] = x1 >>> 16 & 0xff;
  36723. o[ 7] = x1 >>> 24 & 0xff;
  36724. o[ 8] = x2 >>> 0 & 0xff;
  36725. o[ 9] = x2 >>> 8 & 0xff;
  36726. o[10] = x2 >>> 16 & 0xff;
  36727. o[11] = x2 >>> 24 & 0xff;
  36728. o[12] = x3 >>> 0 & 0xff;
  36729. o[13] = x3 >>> 8 & 0xff;
  36730. o[14] = x3 >>> 16 & 0xff;
  36731. o[15] = x3 >>> 24 & 0xff;
  36732. o[16] = x4 >>> 0 & 0xff;
  36733. o[17] = x4 >>> 8 & 0xff;
  36734. o[18] = x4 >>> 16 & 0xff;
  36735. o[19] = x4 >>> 24 & 0xff;
  36736. o[20] = x5 >>> 0 & 0xff;
  36737. o[21] = x5 >>> 8 & 0xff;
  36738. o[22] = x5 >>> 16 & 0xff;
  36739. o[23] = x5 >>> 24 & 0xff;
  36740. o[24] = x6 >>> 0 & 0xff;
  36741. o[25] = x6 >>> 8 & 0xff;
  36742. o[26] = x6 >>> 16 & 0xff;
  36743. o[27] = x6 >>> 24 & 0xff;
  36744. o[28] = x7 >>> 0 & 0xff;
  36745. o[29] = x7 >>> 8 & 0xff;
  36746. o[30] = x7 >>> 16 & 0xff;
  36747. o[31] = x7 >>> 24 & 0xff;
  36748. o[32] = x8 >>> 0 & 0xff;
  36749. o[33] = x8 >>> 8 & 0xff;
  36750. o[34] = x8 >>> 16 & 0xff;
  36751. o[35] = x8 >>> 24 & 0xff;
  36752. o[36] = x9 >>> 0 & 0xff;
  36753. o[37] = x9 >>> 8 & 0xff;
  36754. o[38] = x9 >>> 16 & 0xff;
  36755. o[39] = x9 >>> 24 & 0xff;
  36756. o[40] = x10 >>> 0 & 0xff;
  36757. o[41] = x10 >>> 8 & 0xff;
  36758. o[42] = x10 >>> 16 & 0xff;
  36759. o[43] = x10 >>> 24 & 0xff;
  36760. o[44] = x11 >>> 0 & 0xff;
  36761. o[45] = x11 >>> 8 & 0xff;
  36762. o[46] = x11 >>> 16 & 0xff;
  36763. o[47] = x11 >>> 24 & 0xff;
  36764. o[48] = x12 >>> 0 & 0xff;
  36765. o[49] = x12 >>> 8 & 0xff;
  36766. o[50] = x12 >>> 16 & 0xff;
  36767. o[51] = x12 >>> 24 & 0xff;
  36768. o[52] = x13 >>> 0 & 0xff;
  36769. o[53] = x13 >>> 8 & 0xff;
  36770. o[54] = x13 >>> 16 & 0xff;
  36771. o[55] = x13 >>> 24 & 0xff;
  36772. o[56] = x14 >>> 0 & 0xff;
  36773. o[57] = x14 >>> 8 & 0xff;
  36774. o[58] = x14 >>> 16 & 0xff;
  36775. o[59] = x14 >>> 24 & 0xff;
  36776. o[60] = x15 >>> 0 & 0xff;
  36777. o[61] = x15 >>> 8 & 0xff;
  36778. o[62] = x15 >>> 16 & 0xff;
  36779. o[63] = x15 >>> 24 & 0xff;
  36780. }
  36781. function core_hsalsa20(o,p,k,c) {
  36782. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36783. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36784. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36785. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36786. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36787. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36788. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36789. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36790. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36791. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36792. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36793. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36794. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36795. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36796. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36797. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36798. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36799. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36800. x15 = j15, u;
  36801. for (var i = 0; i < 20; i += 2) {
  36802. u = x0 + x12 | 0;
  36803. x4 ^= u<<7 | u>>>(32-7);
  36804. u = x4 + x0 | 0;
  36805. x8 ^= u<<9 | u>>>(32-9);
  36806. u = x8 + x4 | 0;
  36807. x12 ^= u<<13 | u>>>(32-13);
  36808. u = x12 + x8 | 0;
  36809. x0 ^= u<<18 | u>>>(32-18);
  36810. u = x5 + x1 | 0;
  36811. x9 ^= u<<7 | u>>>(32-7);
  36812. u = x9 + x5 | 0;
  36813. x13 ^= u<<9 | u>>>(32-9);
  36814. u = x13 + x9 | 0;
  36815. x1 ^= u<<13 | u>>>(32-13);
  36816. u = x1 + x13 | 0;
  36817. x5 ^= u<<18 | u>>>(32-18);
  36818. u = x10 + x6 | 0;
  36819. x14 ^= u<<7 | u>>>(32-7);
  36820. u = x14 + x10 | 0;
  36821. x2 ^= u<<9 | u>>>(32-9);
  36822. u = x2 + x14 | 0;
  36823. x6 ^= u<<13 | u>>>(32-13);
  36824. u = x6 + x2 | 0;
  36825. x10 ^= u<<18 | u>>>(32-18);
  36826. u = x15 + x11 | 0;
  36827. x3 ^= u<<7 | u>>>(32-7);
  36828. u = x3 + x15 | 0;
  36829. x7 ^= u<<9 | u>>>(32-9);
  36830. u = x7 + x3 | 0;
  36831. x11 ^= u<<13 | u>>>(32-13);
  36832. u = x11 + x7 | 0;
  36833. x15 ^= u<<18 | u>>>(32-18);
  36834. u = x0 + x3 | 0;
  36835. x1 ^= u<<7 | u>>>(32-7);
  36836. u = x1 + x0 | 0;
  36837. x2 ^= u<<9 | u>>>(32-9);
  36838. u = x2 + x1 | 0;
  36839. x3 ^= u<<13 | u>>>(32-13);
  36840. u = x3 + x2 | 0;
  36841. x0 ^= u<<18 | u>>>(32-18);
  36842. u = x5 + x4 | 0;
  36843. x6 ^= u<<7 | u>>>(32-7);
  36844. u = x6 + x5 | 0;
  36845. x7 ^= u<<9 | u>>>(32-9);
  36846. u = x7 + x6 | 0;
  36847. x4 ^= u<<13 | u>>>(32-13);
  36848. u = x4 + x7 | 0;
  36849. x5 ^= u<<18 | u>>>(32-18);
  36850. u = x10 + x9 | 0;
  36851. x11 ^= u<<7 | u>>>(32-7);
  36852. u = x11 + x10 | 0;
  36853. x8 ^= u<<9 | u>>>(32-9);
  36854. u = x8 + x11 | 0;
  36855. x9 ^= u<<13 | u>>>(32-13);
  36856. u = x9 + x8 | 0;
  36857. x10 ^= u<<18 | u>>>(32-18);
  36858. u = x15 + x14 | 0;
  36859. x12 ^= u<<7 | u>>>(32-7);
  36860. u = x12 + x15 | 0;
  36861. x13 ^= u<<9 | u>>>(32-9);
  36862. u = x13 + x12 | 0;
  36863. x14 ^= u<<13 | u>>>(32-13);
  36864. u = x14 + x13 | 0;
  36865. x15 ^= u<<18 | u>>>(32-18);
  36866. }
  36867. o[ 0] = x0 >>> 0 & 0xff;
  36868. o[ 1] = x0 >>> 8 & 0xff;
  36869. o[ 2] = x0 >>> 16 & 0xff;
  36870. o[ 3] = x0 >>> 24 & 0xff;
  36871. o[ 4] = x5 >>> 0 & 0xff;
  36872. o[ 5] = x5 >>> 8 & 0xff;
  36873. o[ 6] = x5 >>> 16 & 0xff;
  36874. o[ 7] = x5 >>> 24 & 0xff;
  36875. o[ 8] = x10 >>> 0 & 0xff;
  36876. o[ 9] = x10 >>> 8 & 0xff;
  36877. o[10] = x10 >>> 16 & 0xff;
  36878. o[11] = x10 >>> 24 & 0xff;
  36879. o[12] = x15 >>> 0 & 0xff;
  36880. o[13] = x15 >>> 8 & 0xff;
  36881. o[14] = x15 >>> 16 & 0xff;
  36882. o[15] = x15 >>> 24 & 0xff;
  36883. o[16] = x6 >>> 0 & 0xff;
  36884. o[17] = x6 >>> 8 & 0xff;
  36885. o[18] = x6 >>> 16 & 0xff;
  36886. o[19] = x6 >>> 24 & 0xff;
  36887. o[20] = x7 >>> 0 & 0xff;
  36888. o[21] = x7 >>> 8 & 0xff;
  36889. o[22] = x7 >>> 16 & 0xff;
  36890. o[23] = x7 >>> 24 & 0xff;
  36891. o[24] = x8 >>> 0 & 0xff;
  36892. o[25] = x8 >>> 8 & 0xff;
  36893. o[26] = x8 >>> 16 & 0xff;
  36894. o[27] = x8 >>> 24 & 0xff;
  36895. o[28] = x9 >>> 0 & 0xff;
  36896. o[29] = x9 >>> 8 & 0xff;
  36897. o[30] = x9 >>> 16 & 0xff;
  36898. o[31] = x9 >>> 24 & 0xff;
  36899. }
  36900. function crypto_core_salsa20(out,inp,k,c) {
  36901. core_salsa20(out,inp,k,c);
  36902. }
  36903. function crypto_core_hsalsa20(out,inp,k,c) {
  36904. core_hsalsa20(out,inp,k,c);
  36905. }
  36906. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36907. // "expand 32-byte k"
  36908. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36909. var z = new Uint8Array(16), x = new Uint8Array(64);
  36910. var u, i;
  36911. for (i = 0; i < 16; i++) z[i] = 0;
  36912. for (i = 0; i < 8; i++) z[i] = n[i];
  36913. while (b >= 64) {
  36914. crypto_core_salsa20(x,z,k,sigma);
  36915. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36916. u = 1;
  36917. for (i = 8; i < 16; i++) {
  36918. u = u + (z[i] & 0xff) | 0;
  36919. z[i] = u & 0xff;
  36920. u >>>= 8;
  36921. }
  36922. b -= 64;
  36923. cpos += 64;
  36924. mpos += 64;
  36925. }
  36926. if (b > 0) {
  36927. crypto_core_salsa20(x,z,k,sigma);
  36928. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36929. }
  36930. return 0;
  36931. }
  36932. function crypto_stream_salsa20(c,cpos,b,n,k) {
  36933. var z = new Uint8Array(16), x = new Uint8Array(64);
  36934. var u, i;
  36935. for (i = 0; i < 16; i++) z[i] = 0;
  36936. for (i = 0; i < 8; i++) z[i] = n[i];
  36937. while (b >= 64) {
  36938. crypto_core_salsa20(x,z,k,sigma);
  36939. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  36940. u = 1;
  36941. for (i = 8; i < 16; i++) {
  36942. u = u + (z[i] & 0xff) | 0;
  36943. z[i] = u & 0xff;
  36944. u >>>= 8;
  36945. }
  36946. b -= 64;
  36947. cpos += 64;
  36948. }
  36949. if (b > 0) {
  36950. crypto_core_salsa20(x,z,k,sigma);
  36951. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  36952. }
  36953. return 0;
  36954. }
  36955. function crypto_stream(c,cpos,d,n,k) {
  36956. var s = new Uint8Array(32);
  36957. crypto_core_hsalsa20(s,n,k,sigma);
  36958. var sn = new Uint8Array(8);
  36959. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36960. return crypto_stream_salsa20(c,cpos,d,sn,s);
  36961. }
  36962. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  36963. var s = new Uint8Array(32);
  36964. crypto_core_hsalsa20(s,n,k,sigma);
  36965. var sn = new Uint8Array(8);
  36966. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36967. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  36968. }
  36969. /*
  36970. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  36971. * https://github.com/floodyberry/poly1305-donna
  36972. */
  36973. var poly1305 = function(key) {
  36974. this.buffer = new Uint8Array(16);
  36975. this.r = new Uint16Array(10);
  36976. this.h = new Uint16Array(10);
  36977. this.pad = new Uint16Array(8);
  36978. this.leftover = 0;
  36979. this.fin = 0;
  36980. var t0, t1, t2, t3, t4, t5, t6, t7;
  36981. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  36982. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36983. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  36984. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36985. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  36986. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  36987. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36988. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  36989. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36990. this.r[9] = ((t7 >>> 5)) & 0x007f;
  36991. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  36992. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  36993. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  36994. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  36995. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  36996. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  36997. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  36998. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  36999. };
  37000. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37001. var hibit = this.fin ? 0 : (1 << 11);
  37002. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37003. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37004. var h0 = this.h[0],
  37005. h1 = this.h[1],
  37006. h2 = this.h[2],
  37007. h3 = this.h[3],
  37008. h4 = this.h[4],
  37009. h5 = this.h[5],
  37010. h6 = this.h[6],
  37011. h7 = this.h[7],
  37012. h8 = this.h[8],
  37013. h9 = this.h[9];
  37014. var r0 = this.r[0],
  37015. r1 = this.r[1],
  37016. r2 = this.r[2],
  37017. r3 = this.r[3],
  37018. r4 = this.r[4],
  37019. r5 = this.r[5],
  37020. r6 = this.r[6],
  37021. r7 = this.r[7],
  37022. r8 = this.r[8],
  37023. r9 = this.r[9];
  37024. while (bytes >= 16) {
  37025. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37026. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37027. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37028. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37029. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37030. h5 += ((t4 >>> 1)) & 0x1fff;
  37031. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37032. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37033. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37034. h9 += ((t7 >>> 5)) | hibit;
  37035. c = 0;
  37036. d0 = c;
  37037. d0 += h0 * r0;
  37038. d0 += h1 * (5 * r9);
  37039. d0 += h2 * (5 * r8);
  37040. d0 += h3 * (5 * r7);
  37041. d0 += h4 * (5 * r6);
  37042. c = (d0 >>> 13); d0 &= 0x1fff;
  37043. d0 += h5 * (5 * r5);
  37044. d0 += h6 * (5 * r4);
  37045. d0 += h7 * (5 * r3);
  37046. d0 += h8 * (5 * r2);
  37047. d0 += h9 * (5 * r1);
  37048. c += (d0 >>> 13); d0 &= 0x1fff;
  37049. d1 = c;
  37050. d1 += h0 * r1;
  37051. d1 += h1 * r0;
  37052. d1 += h2 * (5 * r9);
  37053. d1 += h3 * (5 * r8);
  37054. d1 += h4 * (5 * r7);
  37055. c = (d1 >>> 13); d1 &= 0x1fff;
  37056. d1 += h5 * (5 * r6);
  37057. d1 += h6 * (5 * r5);
  37058. d1 += h7 * (5 * r4);
  37059. d1 += h8 * (5 * r3);
  37060. d1 += h9 * (5 * r2);
  37061. c += (d1 >>> 13); d1 &= 0x1fff;
  37062. d2 = c;
  37063. d2 += h0 * r2;
  37064. d2 += h1 * r1;
  37065. d2 += h2 * r0;
  37066. d2 += h3 * (5 * r9);
  37067. d2 += h4 * (5 * r8);
  37068. c = (d2 >>> 13); d2 &= 0x1fff;
  37069. d2 += h5 * (5 * r7);
  37070. d2 += h6 * (5 * r6);
  37071. d2 += h7 * (5 * r5);
  37072. d2 += h8 * (5 * r4);
  37073. d2 += h9 * (5 * r3);
  37074. c += (d2 >>> 13); d2 &= 0x1fff;
  37075. d3 = c;
  37076. d3 += h0 * r3;
  37077. d3 += h1 * r2;
  37078. d3 += h2 * r1;
  37079. d3 += h3 * r0;
  37080. d3 += h4 * (5 * r9);
  37081. c = (d3 >>> 13); d3 &= 0x1fff;
  37082. d3 += h5 * (5 * r8);
  37083. d3 += h6 * (5 * r7);
  37084. d3 += h7 * (5 * r6);
  37085. d3 += h8 * (5 * r5);
  37086. d3 += h9 * (5 * r4);
  37087. c += (d3 >>> 13); d3 &= 0x1fff;
  37088. d4 = c;
  37089. d4 += h0 * r4;
  37090. d4 += h1 * r3;
  37091. d4 += h2 * r2;
  37092. d4 += h3 * r1;
  37093. d4 += h4 * r0;
  37094. c = (d4 >>> 13); d4 &= 0x1fff;
  37095. d4 += h5 * (5 * r9);
  37096. d4 += h6 * (5 * r8);
  37097. d4 += h7 * (5 * r7);
  37098. d4 += h8 * (5 * r6);
  37099. d4 += h9 * (5 * r5);
  37100. c += (d4 >>> 13); d4 &= 0x1fff;
  37101. d5 = c;
  37102. d5 += h0 * r5;
  37103. d5 += h1 * r4;
  37104. d5 += h2 * r3;
  37105. d5 += h3 * r2;
  37106. d5 += h4 * r1;
  37107. c = (d5 >>> 13); d5 &= 0x1fff;
  37108. d5 += h5 * r0;
  37109. d5 += h6 * (5 * r9);
  37110. d5 += h7 * (5 * r8);
  37111. d5 += h8 * (5 * r7);
  37112. d5 += h9 * (5 * r6);
  37113. c += (d5 >>> 13); d5 &= 0x1fff;
  37114. d6 = c;
  37115. d6 += h0 * r6;
  37116. d6 += h1 * r5;
  37117. d6 += h2 * r4;
  37118. d6 += h3 * r3;
  37119. d6 += h4 * r2;
  37120. c = (d6 >>> 13); d6 &= 0x1fff;
  37121. d6 += h5 * r1;
  37122. d6 += h6 * r0;
  37123. d6 += h7 * (5 * r9);
  37124. d6 += h8 * (5 * r8);
  37125. d6 += h9 * (5 * r7);
  37126. c += (d6 >>> 13); d6 &= 0x1fff;
  37127. d7 = c;
  37128. d7 += h0 * r7;
  37129. d7 += h1 * r6;
  37130. d7 += h2 * r5;
  37131. d7 += h3 * r4;
  37132. d7 += h4 * r3;
  37133. c = (d7 >>> 13); d7 &= 0x1fff;
  37134. d7 += h5 * r2;
  37135. d7 += h6 * r1;
  37136. d7 += h7 * r0;
  37137. d7 += h8 * (5 * r9);
  37138. d7 += h9 * (5 * r8);
  37139. c += (d7 >>> 13); d7 &= 0x1fff;
  37140. d8 = c;
  37141. d8 += h0 * r8;
  37142. d8 += h1 * r7;
  37143. d8 += h2 * r6;
  37144. d8 += h3 * r5;
  37145. d8 += h4 * r4;
  37146. c = (d8 >>> 13); d8 &= 0x1fff;
  37147. d8 += h5 * r3;
  37148. d8 += h6 * r2;
  37149. d8 += h7 * r1;
  37150. d8 += h8 * r0;
  37151. d8 += h9 * (5 * r9);
  37152. c += (d8 >>> 13); d8 &= 0x1fff;
  37153. d9 = c;
  37154. d9 += h0 * r9;
  37155. d9 += h1 * r8;
  37156. d9 += h2 * r7;
  37157. d9 += h3 * r6;
  37158. d9 += h4 * r5;
  37159. c = (d9 >>> 13); d9 &= 0x1fff;
  37160. d9 += h5 * r4;
  37161. d9 += h6 * r3;
  37162. d9 += h7 * r2;
  37163. d9 += h8 * r1;
  37164. d9 += h9 * r0;
  37165. c += (d9 >>> 13); d9 &= 0x1fff;
  37166. c = (((c << 2) + c)) | 0;
  37167. c = (c + d0) | 0;
  37168. d0 = c & 0x1fff;
  37169. c = (c >>> 13);
  37170. d1 += c;
  37171. h0 = d0;
  37172. h1 = d1;
  37173. h2 = d2;
  37174. h3 = d3;
  37175. h4 = d4;
  37176. h5 = d5;
  37177. h6 = d6;
  37178. h7 = d7;
  37179. h8 = d8;
  37180. h9 = d9;
  37181. mpos += 16;
  37182. bytes -= 16;
  37183. }
  37184. this.h[0] = h0;
  37185. this.h[1] = h1;
  37186. this.h[2] = h2;
  37187. this.h[3] = h3;
  37188. this.h[4] = h4;
  37189. this.h[5] = h5;
  37190. this.h[6] = h6;
  37191. this.h[7] = h7;
  37192. this.h[8] = h8;
  37193. this.h[9] = h9;
  37194. };
  37195. poly1305.prototype.finish = function(mac, macpos) {
  37196. var g = new Uint16Array(10);
  37197. var c, mask, f, i;
  37198. if (this.leftover) {
  37199. i = this.leftover;
  37200. this.buffer[i++] = 1;
  37201. for (; i < 16; i++) this.buffer[i] = 0;
  37202. this.fin = 1;
  37203. this.blocks(this.buffer, 0, 16);
  37204. }
  37205. c = this.h[1] >>> 13;
  37206. this.h[1] &= 0x1fff;
  37207. for (i = 2; i < 10; i++) {
  37208. this.h[i] += c;
  37209. c = this.h[i] >>> 13;
  37210. this.h[i] &= 0x1fff;
  37211. }
  37212. this.h[0] += (c * 5);
  37213. c = this.h[0] >>> 13;
  37214. this.h[0] &= 0x1fff;
  37215. this.h[1] += c;
  37216. c = this.h[1] >>> 13;
  37217. this.h[1] &= 0x1fff;
  37218. this.h[2] += c;
  37219. g[0] = this.h[0] + 5;
  37220. c = g[0] >>> 13;
  37221. g[0] &= 0x1fff;
  37222. for (i = 1; i < 10; i++) {
  37223. g[i] = this.h[i] + c;
  37224. c = g[i] >>> 13;
  37225. g[i] &= 0x1fff;
  37226. }
  37227. g[9] -= (1 << 13);
  37228. mask = (c ^ 1) - 1;
  37229. for (i = 0; i < 10; i++) g[i] &= mask;
  37230. mask = ~mask;
  37231. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37232. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37233. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37234. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37235. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37236. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37237. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37238. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37239. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37240. f = this.h[0] + this.pad[0];
  37241. this.h[0] = f & 0xffff;
  37242. for (i = 1; i < 8; i++) {
  37243. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37244. this.h[i] = f & 0xffff;
  37245. }
  37246. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37247. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37248. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37249. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37250. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37251. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37252. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37253. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37254. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37255. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37256. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37257. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37258. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37259. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37260. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37261. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37262. };
  37263. poly1305.prototype.update = function(m, mpos, bytes) {
  37264. var i, want;
  37265. if (this.leftover) {
  37266. want = (16 - this.leftover);
  37267. if (want > bytes)
  37268. want = bytes;
  37269. for (i = 0; i < want; i++)
  37270. this.buffer[this.leftover + i] = m[mpos+i];
  37271. bytes -= want;
  37272. mpos += want;
  37273. this.leftover += want;
  37274. if (this.leftover < 16)
  37275. return;
  37276. this.blocks(this.buffer, 0, 16);
  37277. this.leftover = 0;
  37278. }
  37279. if (bytes >= 16) {
  37280. want = bytes - (bytes % 16);
  37281. this.blocks(m, mpos, want);
  37282. mpos += want;
  37283. bytes -= want;
  37284. }
  37285. if (bytes) {
  37286. for (i = 0; i < bytes; i++)
  37287. this.buffer[this.leftover + i] = m[mpos+i];
  37288. this.leftover += bytes;
  37289. }
  37290. };
  37291. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37292. var s = new poly1305(k);
  37293. s.update(m, mpos, n);
  37294. s.finish(out, outpos);
  37295. return 0;
  37296. }
  37297. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37298. var x = new Uint8Array(16);
  37299. crypto_onetimeauth(x,0,m,mpos,n,k);
  37300. return crypto_verify_16(h,hpos,x,0);
  37301. }
  37302. function crypto_secretbox(c,m,d,n,k) {
  37303. var i;
  37304. if (d < 32) return -1;
  37305. crypto_stream_xor(c,0,m,0,d,n,k);
  37306. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37307. for (i = 0; i < 16; i++) c[i] = 0;
  37308. return 0;
  37309. }
  37310. function crypto_secretbox_open(m,c,d,n,k) {
  37311. var i;
  37312. var x = new Uint8Array(32);
  37313. if (d < 32) return -1;
  37314. crypto_stream(x,0,32,n,k);
  37315. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37316. crypto_stream_xor(m,0,c,0,d,n,k);
  37317. for (i = 0; i < 32; i++) m[i] = 0;
  37318. return 0;
  37319. }
  37320. function set25519(r, a) {
  37321. var i;
  37322. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37323. }
  37324. function car25519(o) {
  37325. var i, v, c = 1;
  37326. for (i = 0; i < 16; i++) {
  37327. v = o[i] + c + 65535;
  37328. c = Math.floor(v / 65536);
  37329. o[i] = v - c * 65536;
  37330. }
  37331. o[0] += c-1 + 37 * (c-1);
  37332. }
  37333. function sel25519(p, q, b) {
  37334. var t, c = ~(b-1);
  37335. for (var i = 0; i < 16; i++) {
  37336. t = c & (p[i] ^ q[i]);
  37337. p[i] ^= t;
  37338. q[i] ^= t;
  37339. }
  37340. }
  37341. function pack25519(o, n) {
  37342. var i, j, b;
  37343. var m = gf(), t = gf();
  37344. for (i = 0; i < 16; i++) t[i] = n[i];
  37345. car25519(t);
  37346. car25519(t);
  37347. car25519(t);
  37348. for (j = 0; j < 2; j++) {
  37349. m[0] = t[0] - 0xffed;
  37350. for (i = 1; i < 15; i++) {
  37351. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37352. m[i-1] &= 0xffff;
  37353. }
  37354. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37355. b = (m[15]>>16) & 1;
  37356. m[14] &= 0xffff;
  37357. sel25519(t, m, 1-b);
  37358. }
  37359. for (i = 0; i < 16; i++) {
  37360. o[2*i] = t[i] & 0xff;
  37361. o[2*i+1] = t[i]>>8;
  37362. }
  37363. }
  37364. function neq25519(a, b) {
  37365. var c = new Uint8Array(32), d = new Uint8Array(32);
  37366. pack25519(c, a);
  37367. pack25519(d, b);
  37368. return crypto_verify_32(c, 0, d, 0);
  37369. }
  37370. function par25519(a) {
  37371. var d = new Uint8Array(32);
  37372. pack25519(d, a);
  37373. return d[0] & 1;
  37374. }
  37375. function unpack25519(o, n) {
  37376. var i;
  37377. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37378. o[15] &= 0x7fff;
  37379. }
  37380. function A(o, a, b) {
  37381. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37382. }
  37383. function Z(o, a, b) {
  37384. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37385. }
  37386. function M(o, a, b) {
  37387. var v, c,
  37388. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37389. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37390. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37391. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37392. b0 = b[0],
  37393. b1 = b[1],
  37394. b2 = b[2],
  37395. b3 = b[3],
  37396. b4 = b[4],
  37397. b5 = b[5],
  37398. b6 = b[6],
  37399. b7 = b[7],
  37400. b8 = b[8],
  37401. b9 = b[9],
  37402. b10 = b[10],
  37403. b11 = b[11],
  37404. b12 = b[12],
  37405. b13 = b[13],
  37406. b14 = b[14],
  37407. b15 = b[15];
  37408. v = a[0];
  37409. t0 += v * b0;
  37410. t1 += v * b1;
  37411. t2 += v * b2;
  37412. t3 += v * b3;
  37413. t4 += v * b4;
  37414. t5 += v * b5;
  37415. t6 += v * b6;
  37416. t7 += v * b7;
  37417. t8 += v * b8;
  37418. t9 += v * b9;
  37419. t10 += v * b10;
  37420. t11 += v * b11;
  37421. t12 += v * b12;
  37422. t13 += v * b13;
  37423. t14 += v * b14;
  37424. t15 += v * b15;
  37425. v = a[1];
  37426. t1 += v * b0;
  37427. t2 += v * b1;
  37428. t3 += v * b2;
  37429. t4 += v * b3;
  37430. t5 += v * b4;
  37431. t6 += v * b5;
  37432. t7 += v * b6;
  37433. t8 += v * b7;
  37434. t9 += v * b8;
  37435. t10 += v * b9;
  37436. t11 += v * b10;
  37437. t12 += v * b11;
  37438. t13 += v * b12;
  37439. t14 += v * b13;
  37440. t15 += v * b14;
  37441. t16 += v * b15;
  37442. v = a[2];
  37443. t2 += v * b0;
  37444. t3 += v * b1;
  37445. t4 += v * b2;
  37446. t5 += v * b3;
  37447. t6 += v * b4;
  37448. t7 += v * b5;
  37449. t8 += v * b6;
  37450. t9 += v * b7;
  37451. t10 += v * b8;
  37452. t11 += v * b9;
  37453. t12 += v * b10;
  37454. t13 += v * b11;
  37455. t14 += v * b12;
  37456. t15 += v * b13;
  37457. t16 += v * b14;
  37458. t17 += v * b15;
  37459. v = a[3];
  37460. t3 += v * b0;
  37461. t4 += v * b1;
  37462. t5 += v * b2;
  37463. t6 += v * b3;
  37464. t7 += v * b4;
  37465. t8 += v * b5;
  37466. t9 += v * b6;
  37467. t10 += v * b7;
  37468. t11 += v * b8;
  37469. t12 += v * b9;
  37470. t13 += v * b10;
  37471. t14 += v * b11;
  37472. t15 += v * b12;
  37473. t16 += v * b13;
  37474. t17 += v * b14;
  37475. t18 += v * b15;
  37476. v = a[4];
  37477. t4 += v * b0;
  37478. t5 += v * b1;
  37479. t6 += v * b2;
  37480. t7 += v * b3;
  37481. t8 += v * b4;
  37482. t9 += v * b5;
  37483. t10 += v * b6;
  37484. t11 += v * b7;
  37485. t12 += v * b8;
  37486. t13 += v * b9;
  37487. t14 += v * b10;
  37488. t15 += v * b11;
  37489. t16 += v * b12;
  37490. t17 += v * b13;
  37491. t18 += v * b14;
  37492. t19 += v * b15;
  37493. v = a[5];
  37494. t5 += v * b0;
  37495. t6 += v * b1;
  37496. t7 += v * b2;
  37497. t8 += v * b3;
  37498. t9 += v * b4;
  37499. t10 += v * b5;
  37500. t11 += v * b6;
  37501. t12 += v * b7;
  37502. t13 += v * b8;
  37503. t14 += v * b9;
  37504. t15 += v * b10;
  37505. t16 += v * b11;
  37506. t17 += v * b12;
  37507. t18 += v * b13;
  37508. t19 += v * b14;
  37509. t20 += v * b15;
  37510. v = a[6];
  37511. t6 += v * b0;
  37512. t7 += v * b1;
  37513. t8 += v * b2;
  37514. t9 += v * b3;
  37515. t10 += v * b4;
  37516. t11 += v * b5;
  37517. t12 += v * b6;
  37518. t13 += v * b7;
  37519. t14 += v * b8;
  37520. t15 += v * b9;
  37521. t16 += v * b10;
  37522. t17 += v * b11;
  37523. t18 += v * b12;
  37524. t19 += v * b13;
  37525. t20 += v * b14;
  37526. t21 += v * b15;
  37527. v = a[7];
  37528. t7 += v * b0;
  37529. t8 += v * b1;
  37530. t9 += v * b2;
  37531. t10 += v * b3;
  37532. t11 += v * b4;
  37533. t12 += v * b5;
  37534. t13 += v * b6;
  37535. t14 += v * b7;
  37536. t15 += v * b8;
  37537. t16 += v * b9;
  37538. t17 += v * b10;
  37539. t18 += v * b11;
  37540. t19 += v * b12;
  37541. t20 += v * b13;
  37542. t21 += v * b14;
  37543. t22 += v * b15;
  37544. v = a[8];
  37545. t8 += v * b0;
  37546. t9 += v * b1;
  37547. t10 += v * b2;
  37548. t11 += v * b3;
  37549. t12 += v * b4;
  37550. t13 += v * b5;
  37551. t14 += v * b6;
  37552. t15 += v * b7;
  37553. t16 += v * b8;
  37554. t17 += v * b9;
  37555. t18 += v * b10;
  37556. t19 += v * b11;
  37557. t20 += v * b12;
  37558. t21 += v * b13;
  37559. t22 += v * b14;
  37560. t23 += v * b15;
  37561. v = a[9];
  37562. t9 += v * b0;
  37563. t10 += v * b1;
  37564. t11 += v * b2;
  37565. t12 += v * b3;
  37566. t13 += v * b4;
  37567. t14 += v * b5;
  37568. t15 += v * b6;
  37569. t16 += v * b7;
  37570. t17 += v * b8;
  37571. t18 += v * b9;
  37572. t19 += v * b10;
  37573. t20 += v * b11;
  37574. t21 += v * b12;
  37575. t22 += v * b13;
  37576. t23 += v * b14;
  37577. t24 += v * b15;
  37578. v = a[10];
  37579. t10 += v * b0;
  37580. t11 += v * b1;
  37581. t12 += v * b2;
  37582. t13 += v * b3;
  37583. t14 += v * b4;
  37584. t15 += v * b5;
  37585. t16 += v * b6;
  37586. t17 += v * b7;
  37587. t18 += v * b8;
  37588. t19 += v * b9;
  37589. t20 += v * b10;
  37590. t21 += v * b11;
  37591. t22 += v * b12;
  37592. t23 += v * b13;
  37593. t24 += v * b14;
  37594. t25 += v * b15;
  37595. v = a[11];
  37596. t11 += v * b0;
  37597. t12 += v * b1;
  37598. t13 += v * b2;
  37599. t14 += v * b3;
  37600. t15 += v * b4;
  37601. t16 += v * b5;
  37602. t17 += v * b6;
  37603. t18 += v * b7;
  37604. t19 += v * b8;
  37605. t20 += v * b9;
  37606. t21 += v * b10;
  37607. t22 += v * b11;
  37608. t23 += v * b12;
  37609. t24 += v * b13;
  37610. t25 += v * b14;
  37611. t26 += v * b15;
  37612. v = a[12];
  37613. t12 += v * b0;
  37614. t13 += v * b1;
  37615. t14 += v * b2;
  37616. t15 += v * b3;
  37617. t16 += v * b4;
  37618. t17 += v * b5;
  37619. t18 += v * b6;
  37620. t19 += v * b7;
  37621. t20 += v * b8;
  37622. t21 += v * b9;
  37623. t22 += v * b10;
  37624. t23 += v * b11;
  37625. t24 += v * b12;
  37626. t25 += v * b13;
  37627. t26 += v * b14;
  37628. t27 += v * b15;
  37629. v = a[13];
  37630. t13 += v * b0;
  37631. t14 += v * b1;
  37632. t15 += v * b2;
  37633. t16 += v * b3;
  37634. t17 += v * b4;
  37635. t18 += v * b5;
  37636. t19 += v * b6;
  37637. t20 += v * b7;
  37638. t21 += v * b8;
  37639. t22 += v * b9;
  37640. t23 += v * b10;
  37641. t24 += v * b11;
  37642. t25 += v * b12;
  37643. t26 += v * b13;
  37644. t27 += v * b14;
  37645. t28 += v * b15;
  37646. v = a[14];
  37647. t14 += v * b0;
  37648. t15 += v * b1;
  37649. t16 += v * b2;
  37650. t17 += v * b3;
  37651. t18 += v * b4;
  37652. t19 += v * b5;
  37653. t20 += v * b6;
  37654. t21 += v * b7;
  37655. t22 += v * b8;
  37656. t23 += v * b9;
  37657. t24 += v * b10;
  37658. t25 += v * b11;
  37659. t26 += v * b12;
  37660. t27 += v * b13;
  37661. t28 += v * b14;
  37662. t29 += v * b15;
  37663. v = a[15];
  37664. t15 += v * b0;
  37665. t16 += v * b1;
  37666. t17 += v * b2;
  37667. t18 += v * b3;
  37668. t19 += v * b4;
  37669. t20 += v * b5;
  37670. t21 += v * b6;
  37671. t22 += v * b7;
  37672. t23 += v * b8;
  37673. t24 += v * b9;
  37674. t25 += v * b10;
  37675. t26 += v * b11;
  37676. t27 += v * b12;
  37677. t28 += v * b13;
  37678. t29 += v * b14;
  37679. t30 += v * b15;
  37680. t0 += 38 * t16;
  37681. t1 += 38 * t17;
  37682. t2 += 38 * t18;
  37683. t3 += 38 * t19;
  37684. t4 += 38 * t20;
  37685. t5 += 38 * t21;
  37686. t6 += 38 * t22;
  37687. t7 += 38 * t23;
  37688. t8 += 38 * t24;
  37689. t9 += 38 * t25;
  37690. t10 += 38 * t26;
  37691. t11 += 38 * t27;
  37692. t12 += 38 * t28;
  37693. t13 += 38 * t29;
  37694. t14 += 38 * t30;
  37695. // t15 left as is
  37696. // first car
  37697. c = 1;
  37698. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37699. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37700. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37701. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37702. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37703. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37704. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37705. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37706. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37707. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37708. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37709. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37710. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37711. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37712. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37713. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37714. t0 += c-1 + 37 * (c-1);
  37715. // second car
  37716. c = 1;
  37717. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37718. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37719. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37720. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37721. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37722. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37723. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37724. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37725. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37726. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37727. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37728. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37729. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37730. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37731. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37732. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37733. t0 += c-1 + 37 * (c-1);
  37734. o[ 0] = t0;
  37735. o[ 1] = t1;
  37736. o[ 2] = t2;
  37737. o[ 3] = t3;
  37738. o[ 4] = t4;
  37739. o[ 5] = t5;
  37740. o[ 6] = t6;
  37741. o[ 7] = t7;
  37742. o[ 8] = t8;
  37743. o[ 9] = t9;
  37744. o[10] = t10;
  37745. o[11] = t11;
  37746. o[12] = t12;
  37747. o[13] = t13;
  37748. o[14] = t14;
  37749. o[15] = t15;
  37750. }
  37751. function S(o, a) {
  37752. M(o, a, a);
  37753. }
  37754. function inv25519(o, i) {
  37755. var c = gf();
  37756. var a;
  37757. for (a = 0; a < 16; a++) c[a] = i[a];
  37758. for (a = 253; a >= 0; a--) {
  37759. S(c, c);
  37760. if(a !== 2 && a !== 4) M(c, c, i);
  37761. }
  37762. for (a = 0; a < 16; a++) o[a] = c[a];
  37763. }
  37764. function pow2523(o, i) {
  37765. var c = gf();
  37766. var a;
  37767. for (a = 0; a < 16; a++) c[a] = i[a];
  37768. for (a = 250; a >= 0; a--) {
  37769. S(c, c);
  37770. if(a !== 1) M(c, c, i);
  37771. }
  37772. for (a = 0; a < 16; a++) o[a] = c[a];
  37773. }
  37774. function crypto_scalarmult(q, n, p) {
  37775. var z = new Uint8Array(32);
  37776. var x = new Float64Array(80), r, i;
  37777. var a = gf(), b = gf(), c = gf(),
  37778. d = gf(), e = gf(), f = gf();
  37779. for (i = 0; i < 31; i++) z[i] = n[i];
  37780. z[31]=(n[31]&127)|64;
  37781. z[0]&=248;
  37782. unpack25519(x,p);
  37783. for (i = 0; i < 16; i++) {
  37784. b[i]=x[i];
  37785. d[i]=a[i]=c[i]=0;
  37786. }
  37787. a[0]=d[0]=1;
  37788. for (i=254; i>=0; --i) {
  37789. r=(z[i>>>3]>>>(i&7))&1;
  37790. sel25519(a,b,r);
  37791. sel25519(c,d,r);
  37792. A(e,a,c);
  37793. Z(a,a,c);
  37794. A(c,b,d);
  37795. Z(b,b,d);
  37796. S(d,e);
  37797. S(f,a);
  37798. M(a,c,a);
  37799. M(c,b,e);
  37800. A(e,a,c);
  37801. Z(a,a,c);
  37802. S(b,a);
  37803. Z(c,d,f);
  37804. M(a,c,_121665);
  37805. A(a,a,d);
  37806. M(c,c,a);
  37807. M(a,d,f);
  37808. M(d,b,x);
  37809. S(b,e);
  37810. sel25519(a,b,r);
  37811. sel25519(c,d,r);
  37812. }
  37813. for (i = 0; i < 16; i++) {
  37814. x[i+16]=a[i];
  37815. x[i+32]=c[i];
  37816. x[i+48]=b[i];
  37817. x[i+64]=d[i];
  37818. }
  37819. var x32 = x.subarray(32);
  37820. var x16 = x.subarray(16);
  37821. inv25519(x32,x32);
  37822. M(x16,x16,x32);
  37823. pack25519(q,x16);
  37824. return 0;
  37825. }
  37826. function crypto_scalarmult_base(q, n) {
  37827. return crypto_scalarmult(q, n, _9);
  37828. }
  37829. function crypto_box_keypair(y, x) {
  37830. randombytes(x, 32);
  37831. return crypto_scalarmult_base(y, x);
  37832. }
  37833. function crypto_box_beforenm(k, y, x) {
  37834. var s = new Uint8Array(32);
  37835. crypto_scalarmult(s, x, y);
  37836. return crypto_core_hsalsa20(k, _0, s, sigma);
  37837. }
  37838. var crypto_box_afternm = crypto_secretbox;
  37839. var crypto_box_open_afternm = crypto_secretbox_open;
  37840. function crypto_box(c, m, d, n, y, x) {
  37841. var k = new Uint8Array(32);
  37842. crypto_box_beforenm(k, y, x);
  37843. return crypto_box_afternm(c, m, d, n, k);
  37844. }
  37845. function crypto_box_open(m, c, d, n, y, x) {
  37846. var k = new Uint8Array(32);
  37847. crypto_box_beforenm(k, y, x);
  37848. return crypto_box_open_afternm(m, c, d, n, k);
  37849. }
  37850. var K = [
  37851. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37852. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37853. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37854. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37855. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37856. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37857. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37858. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37859. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37860. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37861. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37862. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37863. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37864. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37865. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37866. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37867. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37868. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37869. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37870. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37871. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37872. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37873. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37874. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37875. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37876. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37877. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37878. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37879. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37880. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37881. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37882. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37883. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37884. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37885. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37886. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37887. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37888. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37889. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37890. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37891. ];
  37892. function crypto_hashblocks_hl(hh, hl, m, n) {
  37893. var wh = new Int32Array(16), wl = new Int32Array(16),
  37894. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37895. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37896. th, tl, i, j, h, l, a, b, c, d;
  37897. var ah0 = hh[0],
  37898. ah1 = hh[1],
  37899. ah2 = hh[2],
  37900. ah3 = hh[3],
  37901. ah4 = hh[4],
  37902. ah5 = hh[5],
  37903. ah6 = hh[6],
  37904. ah7 = hh[7],
  37905. al0 = hl[0],
  37906. al1 = hl[1],
  37907. al2 = hl[2],
  37908. al3 = hl[3],
  37909. al4 = hl[4],
  37910. al5 = hl[5],
  37911. al6 = hl[6],
  37912. al7 = hl[7];
  37913. var pos = 0;
  37914. while (n >= 128) {
  37915. for (i = 0; i < 16; i++) {
  37916. j = 8 * i + pos;
  37917. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37918. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37919. }
  37920. for (i = 0; i < 80; i++) {
  37921. bh0 = ah0;
  37922. bh1 = ah1;
  37923. bh2 = ah2;
  37924. bh3 = ah3;
  37925. bh4 = ah4;
  37926. bh5 = ah5;
  37927. bh6 = ah6;
  37928. bh7 = ah7;
  37929. bl0 = al0;
  37930. bl1 = al1;
  37931. bl2 = al2;
  37932. bl3 = al3;
  37933. bl4 = al4;
  37934. bl5 = al5;
  37935. bl6 = al6;
  37936. bl7 = al7;
  37937. // add
  37938. h = ah7;
  37939. l = al7;
  37940. a = l & 0xffff; b = l >>> 16;
  37941. c = h & 0xffff; d = h >>> 16;
  37942. // Sigma1
  37943. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  37944. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  37945. a += l & 0xffff; b += l >>> 16;
  37946. c += h & 0xffff; d += h >>> 16;
  37947. // Ch
  37948. h = (ah4 & ah5) ^ (~ah4 & ah6);
  37949. l = (al4 & al5) ^ (~al4 & al6);
  37950. a += l & 0xffff; b += l >>> 16;
  37951. c += h & 0xffff; d += h >>> 16;
  37952. // K
  37953. h = K[i*2];
  37954. l = K[i*2+1];
  37955. a += l & 0xffff; b += l >>> 16;
  37956. c += h & 0xffff; d += h >>> 16;
  37957. // w
  37958. h = wh[i%16];
  37959. l = wl[i%16];
  37960. a += l & 0xffff; b += l >>> 16;
  37961. c += h & 0xffff; d += h >>> 16;
  37962. b += a >>> 16;
  37963. c += b >>> 16;
  37964. d += c >>> 16;
  37965. th = c & 0xffff | d << 16;
  37966. tl = a & 0xffff | b << 16;
  37967. // add
  37968. h = th;
  37969. l = tl;
  37970. a = l & 0xffff; b = l >>> 16;
  37971. c = h & 0xffff; d = h >>> 16;
  37972. // Sigma0
  37973. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  37974. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  37975. a += l & 0xffff; b += l >>> 16;
  37976. c += h & 0xffff; d += h >>> 16;
  37977. // Maj
  37978. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  37979. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  37980. a += l & 0xffff; b += l >>> 16;
  37981. c += h & 0xffff; d += h >>> 16;
  37982. b += a >>> 16;
  37983. c += b >>> 16;
  37984. d += c >>> 16;
  37985. bh7 = (c & 0xffff) | (d << 16);
  37986. bl7 = (a & 0xffff) | (b << 16);
  37987. // add
  37988. h = bh3;
  37989. l = bl3;
  37990. a = l & 0xffff; b = l >>> 16;
  37991. c = h & 0xffff; d = h >>> 16;
  37992. h = th;
  37993. l = tl;
  37994. a += l & 0xffff; b += l >>> 16;
  37995. c += h & 0xffff; d += h >>> 16;
  37996. b += a >>> 16;
  37997. c += b >>> 16;
  37998. d += c >>> 16;
  37999. bh3 = (c & 0xffff) | (d << 16);
  38000. bl3 = (a & 0xffff) | (b << 16);
  38001. ah1 = bh0;
  38002. ah2 = bh1;
  38003. ah3 = bh2;
  38004. ah4 = bh3;
  38005. ah5 = bh4;
  38006. ah6 = bh5;
  38007. ah7 = bh6;
  38008. ah0 = bh7;
  38009. al1 = bl0;
  38010. al2 = bl1;
  38011. al3 = bl2;
  38012. al4 = bl3;
  38013. al5 = bl4;
  38014. al6 = bl5;
  38015. al7 = bl6;
  38016. al0 = bl7;
  38017. if (i%16 === 15) {
  38018. for (j = 0; j < 16; j++) {
  38019. // add
  38020. h = wh[j];
  38021. l = wl[j];
  38022. a = l & 0xffff; b = l >>> 16;
  38023. c = h & 0xffff; d = h >>> 16;
  38024. h = wh[(j+9)%16];
  38025. l = wl[(j+9)%16];
  38026. a += l & 0xffff; b += l >>> 16;
  38027. c += h & 0xffff; d += h >>> 16;
  38028. // sigma0
  38029. th = wh[(j+1)%16];
  38030. tl = wl[(j+1)%16];
  38031. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38032. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38033. a += l & 0xffff; b += l >>> 16;
  38034. c += h & 0xffff; d += h >>> 16;
  38035. // sigma1
  38036. th = wh[(j+14)%16];
  38037. tl = wl[(j+14)%16];
  38038. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38039. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38040. a += l & 0xffff; b += l >>> 16;
  38041. c += h & 0xffff; d += h >>> 16;
  38042. b += a >>> 16;
  38043. c += b >>> 16;
  38044. d += c >>> 16;
  38045. wh[j] = (c & 0xffff) | (d << 16);
  38046. wl[j] = (a & 0xffff) | (b << 16);
  38047. }
  38048. }
  38049. }
  38050. // add
  38051. h = ah0;
  38052. l = al0;
  38053. a = l & 0xffff; b = l >>> 16;
  38054. c = h & 0xffff; d = h >>> 16;
  38055. h = hh[0];
  38056. l = hl[0];
  38057. a += l & 0xffff; b += l >>> 16;
  38058. c += h & 0xffff; d += h >>> 16;
  38059. b += a >>> 16;
  38060. c += b >>> 16;
  38061. d += c >>> 16;
  38062. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38063. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38064. h = ah1;
  38065. l = al1;
  38066. a = l & 0xffff; b = l >>> 16;
  38067. c = h & 0xffff; d = h >>> 16;
  38068. h = hh[1];
  38069. l = hl[1];
  38070. a += l & 0xffff; b += l >>> 16;
  38071. c += h & 0xffff; d += h >>> 16;
  38072. b += a >>> 16;
  38073. c += b >>> 16;
  38074. d += c >>> 16;
  38075. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38076. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38077. h = ah2;
  38078. l = al2;
  38079. a = l & 0xffff; b = l >>> 16;
  38080. c = h & 0xffff; d = h >>> 16;
  38081. h = hh[2];
  38082. l = hl[2];
  38083. a += l & 0xffff; b += l >>> 16;
  38084. c += h & 0xffff; d += h >>> 16;
  38085. b += a >>> 16;
  38086. c += b >>> 16;
  38087. d += c >>> 16;
  38088. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38089. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38090. h = ah3;
  38091. l = al3;
  38092. a = l & 0xffff; b = l >>> 16;
  38093. c = h & 0xffff; d = h >>> 16;
  38094. h = hh[3];
  38095. l = hl[3];
  38096. a += l & 0xffff; b += l >>> 16;
  38097. c += h & 0xffff; d += h >>> 16;
  38098. b += a >>> 16;
  38099. c += b >>> 16;
  38100. d += c >>> 16;
  38101. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38102. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38103. h = ah4;
  38104. l = al4;
  38105. a = l & 0xffff; b = l >>> 16;
  38106. c = h & 0xffff; d = h >>> 16;
  38107. h = hh[4];
  38108. l = hl[4];
  38109. a += l & 0xffff; b += l >>> 16;
  38110. c += h & 0xffff; d += h >>> 16;
  38111. b += a >>> 16;
  38112. c += b >>> 16;
  38113. d += c >>> 16;
  38114. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38115. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38116. h = ah5;
  38117. l = al5;
  38118. a = l & 0xffff; b = l >>> 16;
  38119. c = h & 0xffff; d = h >>> 16;
  38120. h = hh[5];
  38121. l = hl[5];
  38122. a += l & 0xffff; b += l >>> 16;
  38123. c += h & 0xffff; d += h >>> 16;
  38124. b += a >>> 16;
  38125. c += b >>> 16;
  38126. d += c >>> 16;
  38127. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38128. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38129. h = ah6;
  38130. l = al6;
  38131. a = l & 0xffff; b = l >>> 16;
  38132. c = h & 0xffff; d = h >>> 16;
  38133. h = hh[6];
  38134. l = hl[6];
  38135. a += l & 0xffff; b += l >>> 16;
  38136. c += h & 0xffff; d += h >>> 16;
  38137. b += a >>> 16;
  38138. c += b >>> 16;
  38139. d += c >>> 16;
  38140. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38141. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38142. h = ah7;
  38143. l = al7;
  38144. a = l & 0xffff; b = l >>> 16;
  38145. c = h & 0xffff; d = h >>> 16;
  38146. h = hh[7];
  38147. l = hl[7];
  38148. a += l & 0xffff; b += l >>> 16;
  38149. c += h & 0xffff; d += h >>> 16;
  38150. b += a >>> 16;
  38151. c += b >>> 16;
  38152. d += c >>> 16;
  38153. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38154. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38155. pos += 128;
  38156. n -= 128;
  38157. }
  38158. return n;
  38159. }
  38160. function crypto_hash(out, m, n) {
  38161. var hh = new Int32Array(8),
  38162. hl = new Int32Array(8),
  38163. x = new Uint8Array(256),
  38164. i, b = n;
  38165. hh[0] = 0x6a09e667;
  38166. hh[1] = 0xbb67ae85;
  38167. hh[2] = 0x3c6ef372;
  38168. hh[3] = 0xa54ff53a;
  38169. hh[4] = 0x510e527f;
  38170. hh[5] = 0x9b05688c;
  38171. hh[6] = 0x1f83d9ab;
  38172. hh[7] = 0x5be0cd19;
  38173. hl[0] = 0xf3bcc908;
  38174. hl[1] = 0x84caa73b;
  38175. hl[2] = 0xfe94f82b;
  38176. hl[3] = 0x5f1d36f1;
  38177. hl[4] = 0xade682d1;
  38178. hl[5] = 0x2b3e6c1f;
  38179. hl[6] = 0xfb41bd6b;
  38180. hl[7] = 0x137e2179;
  38181. crypto_hashblocks_hl(hh, hl, m, n);
  38182. n %= 128;
  38183. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38184. x[n] = 128;
  38185. n = 256-128*(n<112?1:0);
  38186. x[n-9] = 0;
  38187. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38188. crypto_hashblocks_hl(hh, hl, x, n);
  38189. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38190. return 0;
  38191. }
  38192. function add(p, q) {
  38193. var a = gf(), b = gf(), c = gf(),
  38194. d = gf(), e = gf(), f = gf(),
  38195. g = gf(), h = gf(), t = gf();
  38196. Z(a, p[1], p[0]);
  38197. Z(t, q[1], q[0]);
  38198. M(a, a, t);
  38199. A(b, p[0], p[1]);
  38200. A(t, q[0], q[1]);
  38201. M(b, b, t);
  38202. M(c, p[3], q[3]);
  38203. M(c, c, D2);
  38204. M(d, p[2], q[2]);
  38205. A(d, d, d);
  38206. Z(e, b, a);
  38207. Z(f, d, c);
  38208. A(g, d, c);
  38209. A(h, b, a);
  38210. M(p[0], e, f);
  38211. M(p[1], h, g);
  38212. M(p[2], g, f);
  38213. M(p[3], e, h);
  38214. }
  38215. function cswap(p, q, b) {
  38216. var i;
  38217. for (i = 0; i < 4; i++) {
  38218. sel25519(p[i], q[i], b);
  38219. }
  38220. }
  38221. function pack(r, p) {
  38222. var tx = gf(), ty = gf(), zi = gf();
  38223. inv25519(zi, p[2]);
  38224. M(tx, p[0], zi);
  38225. M(ty, p[1], zi);
  38226. pack25519(r, ty);
  38227. r[31] ^= par25519(tx) << 7;
  38228. }
  38229. function scalarmult(p, q, s) {
  38230. var b, i;
  38231. set25519(p[0], gf0);
  38232. set25519(p[1], gf1);
  38233. set25519(p[2], gf1);
  38234. set25519(p[3], gf0);
  38235. for (i = 255; i >= 0; --i) {
  38236. b = (s[(i/8)|0] >> (i&7)) & 1;
  38237. cswap(p, q, b);
  38238. add(q, p);
  38239. add(p, p);
  38240. cswap(p, q, b);
  38241. }
  38242. }
  38243. function scalarbase(p, s) {
  38244. var q = [gf(), gf(), gf(), gf()];
  38245. set25519(q[0], X);
  38246. set25519(q[1], Y);
  38247. set25519(q[2], gf1);
  38248. M(q[3], X, Y);
  38249. scalarmult(p, q, s);
  38250. }
  38251. function crypto_sign_keypair(pk, sk, seeded) {
  38252. var d = new Uint8Array(64);
  38253. var p = [gf(), gf(), gf(), gf()];
  38254. var i;
  38255. if (!seeded) randombytes(sk, 32);
  38256. crypto_hash(d, sk, 32);
  38257. d[0] &= 248;
  38258. d[31] &= 127;
  38259. d[31] |= 64;
  38260. scalarbase(p, d);
  38261. pack(pk, p);
  38262. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38263. return 0;
  38264. }
  38265. var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);
  38266. function modL(r, x) {
  38267. var carry, i, j, k;
  38268. for (i = 63; i >= 32; --i) {
  38269. carry = 0;
  38270. for (j = i - 32, k = i - 12; j < k; ++j) {
  38271. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38272. carry = (x[j] + 128) >> 8;
  38273. x[j] -= carry * 256;
  38274. }
  38275. x[j] += carry;
  38276. x[i] = 0;
  38277. }
  38278. carry = 0;
  38279. for (j = 0; j < 32; j++) {
  38280. x[j] += carry - (x[31] >> 4) * L[j];
  38281. carry = x[j] >> 8;
  38282. x[j] &= 255;
  38283. }
  38284. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38285. for (i = 0; i < 32; i++) {
  38286. x[i+1] += x[i] >> 8;
  38287. r[i] = x[i] & 255;
  38288. }
  38289. }
  38290. function reduce(r) {
  38291. var x = new Float64Array(64), i;
  38292. for (i = 0; i < 64; i++) x[i] = r[i];
  38293. for (i = 0; i < 64; i++) r[i] = 0;
  38294. modL(r, x);
  38295. }
  38296. // Note: difference from C - smlen returned, not passed as argument.
  38297. function crypto_sign(sm, m, n, sk) {
  38298. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38299. var i, j, x = new Float64Array(64);
  38300. var p = [gf(), gf(), gf(), gf()];
  38301. crypto_hash(d, sk, 32);
  38302. d[0] &= 248;
  38303. d[31] &= 127;
  38304. d[31] |= 64;
  38305. var smlen = n + 64;
  38306. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38307. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38308. crypto_hash(r, sm.subarray(32), n+32);
  38309. reduce(r);
  38310. scalarbase(p, r);
  38311. pack(sm, p);
  38312. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38313. crypto_hash(h, sm, n + 64);
  38314. reduce(h);
  38315. for (i = 0; i < 64; i++) x[i] = 0;
  38316. for (i = 0; i < 32; i++) x[i] = r[i];
  38317. for (i = 0; i < 32; i++) {
  38318. for (j = 0; j < 32; j++) {
  38319. x[i+j] += h[i] * d[j];
  38320. }
  38321. }
  38322. modL(sm.subarray(32), x);
  38323. return smlen;
  38324. }
  38325. function unpackneg(r, p) {
  38326. var t = gf(), chk = gf(), num = gf(),
  38327. den = gf(), den2 = gf(), den4 = gf(),
  38328. den6 = gf();
  38329. set25519(r[2], gf1);
  38330. unpack25519(r[1], p);
  38331. S(num, r[1]);
  38332. M(den, num, D);
  38333. Z(num, num, r[2]);
  38334. A(den, r[2], den);
  38335. S(den2, den);
  38336. S(den4, den2);
  38337. M(den6, den4, den2);
  38338. M(t, den6, num);
  38339. M(t, t, den);
  38340. pow2523(t, t);
  38341. M(t, t, num);
  38342. M(t, t, den);
  38343. M(t, t, den);
  38344. M(r[0], t, den);
  38345. S(chk, r[0]);
  38346. M(chk, chk, den);
  38347. if (neq25519(chk, num)) M(r[0], r[0], I);
  38348. S(chk, r[0]);
  38349. M(chk, chk, den);
  38350. if (neq25519(chk, num)) return -1;
  38351. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38352. M(r[3], r[0], r[1]);
  38353. return 0;
  38354. }
  38355. function crypto_sign_open(m, sm, n, pk) {
  38356. var i, mlen;
  38357. var t = new Uint8Array(32), h = new Uint8Array(64);
  38358. var p = [gf(), gf(), gf(), gf()],
  38359. q = [gf(), gf(), gf(), gf()];
  38360. mlen = -1;
  38361. if (n < 64) return -1;
  38362. if (unpackneg(q, pk)) return -1;
  38363. for (i = 0; i < n; i++) m[i] = sm[i];
  38364. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38365. crypto_hash(h, m, n);
  38366. reduce(h);
  38367. scalarmult(p, q, h);
  38368. scalarbase(q, sm.subarray(32));
  38369. add(p, q);
  38370. pack(t, p);
  38371. n -= 64;
  38372. if (crypto_verify_32(sm, 0, t, 0)) {
  38373. for (i = 0; i < n; i++) m[i] = 0;
  38374. return -1;
  38375. }
  38376. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38377. mlen = n;
  38378. return mlen;
  38379. }
  38380. var crypto_secretbox_KEYBYTES = 32,
  38381. crypto_secretbox_NONCEBYTES = 24,
  38382. crypto_secretbox_ZEROBYTES = 32,
  38383. crypto_secretbox_BOXZEROBYTES = 16,
  38384. crypto_scalarmult_BYTES = 32,
  38385. crypto_scalarmult_SCALARBYTES = 32,
  38386. crypto_box_PUBLICKEYBYTES = 32,
  38387. crypto_box_SECRETKEYBYTES = 32,
  38388. crypto_box_BEFORENMBYTES = 32,
  38389. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38390. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38391. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38392. crypto_sign_BYTES = 64,
  38393. crypto_sign_PUBLICKEYBYTES = 32,
  38394. crypto_sign_SECRETKEYBYTES = 64,
  38395. crypto_sign_SEEDBYTES = 32,
  38396. crypto_hash_BYTES = 64;
  38397. nacl.lowlevel = {
  38398. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38399. crypto_stream_xor: crypto_stream_xor,
  38400. crypto_stream: crypto_stream,
  38401. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38402. crypto_stream_salsa20: crypto_stream_salsa20,
  38403. crypto_onetimeauth: crypto_onetimeauth,
  38404. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38405. crypto_verify_16: crypto_verify_16,
  38406. crypto_verify_32: crypto_verify_32,
  38407. crypto_secretbox: crypto_secretbox,
  38408. crypto_secretbox_open: crypto_secretbox_open,
  38409. crypto_scalarmult: crypto_scalarmult,
  38410. crypto_scalarmult_base: crypto_scalarmult_base,
  38411. crypto_box_beforenm: crypto_box_beforenm,
  38412. crypto_box_afternm: crypto_box_afternm,
  38413. crypto_box: crypto_box,
  38414. crypto_box_open: crypto_box_open,
  38415. crypto_box_keypair: crypto_box_keypair,
  38416. crypto_hash: crypto_hash,
  38417. crypto_sign: crypto_sign,
  38418. crypto_sign_keypair: crypto_sign_keypair,
  38419. crypto_sign_open: crypto_sign_open,
  38420. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38421. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38422. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38423. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38424. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38425. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38426. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38427. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38428. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38429. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38430. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38431. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38432. crypto_sign_BYTES: crypto_sign_BYTES,
  38433. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38434. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38435. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38436. crypto_hash_BYTES: crypto_hash_BYTES
  38437. };
  38438. /* High-level API */
  38439. function checkLengths(k, n) {
  38440. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38441. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38442. }
  38443. function checkBoxLengths(pk, sk) {
  38444. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38445. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38446. }
  38447. function checkArrayTypes() {
  38448. for (var i = 0; i < arguments.length; i++) {
  38449. if (!(arguments[i] instanceof Uint8Array))
  38450. throw new TypeError('unexpected type, use Uint8Array');
  38451. }
  38452. }
  38453. function cleanup(arr) {
  38454. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38455. }
  38456. nacl.randomBytes = function(n) {
  38457. var b = new Uint8Array(n);
  38458. randombytes(b, n);
  38459. return b;
  38460. };
  38461. nacl.secretbox = function(msg, nonce, key) {
  38462. checkArrayTypes(msg, nonce, key);
  38463. checkLengths(key, nonce);
  38464. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38465. var c = new Uint8Array(m.length);
  38466. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38467. crypto_secretbox(c, m, m.length, nonce, key);
  38468. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38469. };
  38470. nacl.secretbox.open = function(box, nonce, key) {
  38471. checkArrayTypes(box, nonce, key);
  38472. checkLengths(key, nonce);
  38473. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38474. var m = new Uint8Array(c.length);
  38475. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38476. if (c.length < 32) return null;
  38477. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38478. return m.subarray(crypto_secretbox_ZEROBYTES);
  38479. };
  38480. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38481. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38482. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38483. nacl.scalarMult = function(n, p) {
  38484. checkArrayTypes(n, p);
  38485. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38486. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38487. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38488. crypto_scalarmult(q, n, p);
  38489. return q;
  38490. };
  38491. nacl.scalarMult.base = function(n) {
  38492. checkArrayTypes(n);
  38493. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38494. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38495. crypto_scalarmult_base(q, n);
  38496. return q;
  38497. };
  38498. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38499. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38500. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38501. var k = nacl.box.before(publicKey, secretKey);
  38502. return nacl.secretbox(msg, nonce, k);
  38503. };
  38504. nacl.box.before = function(publicKey, secretKey) {
  38505. checkArrayTypes(publicKey, secretKey);
  38506. checkBoxLengths(publicKey, secretKey);
  38507. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38508. crypto_box_beforenm(k, publicKey, secretKey);
  38509. return k;
  38510. };
  38511. nacl.box.after = nacl.secretbox;
  38512. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38513. var k = nacl.box.before(publicKey, secretKey);
  38514. return nacl.secretbox.open(msg, nonce, k);
  38515. };
  38516. nacl.box.open.after = nacl.secretbox.open;
  38517. nacl.box.keyPair = function() {
  38518. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38519. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38520. crypto_box_keypair(pk, sk);
  38521. return {publicKey: pk, secretKey: sk};
  38522. };
  38523. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38524. checkArrayTypes(secretKey);
  38525. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38526. throw new Error('bad secret key size');
  38527. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38528. crypto_scalarmult_base(pk, secretKey);
  38529. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38530. };
  38531. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38532. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38533. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38534. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38535. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38536. nacl.sign = function(msg, secretKey) {
  38537. checkArrayTypes(msg, secretKey);
  38538. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38539. throw new Error('bad secret key size');
  38540. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38541. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38542. return signedMsg;
  38543. };
  38544. nacl.sign.open = function(signedMsg, publicKey) {
  38545. checkArrayTypes(signedMsg, publicKey);
  38546. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38547. throw new Error('bad public key size');
  38548. var tmp = new Uint8Array(signedMsg.length);
  38549. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38550. if (mlen < 0) return null;
  38551. var m = new Uint8Array(mlen);
  38552. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38553. return m;
  38554. };
  38555. nacl.sign.detached = function(msg, secretKey) {
  38556. var signedMsg = nacl.sign(msg, secretKey);
  38557. var sig = new Uint8Array(crypto_sign_BYTES);
  38558. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38559. return sig;
  38560. };
  38561. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38562. checkArrayTypes(msg, sig, publicKey);
  38563. if (sig.length !== crypto_sign_BYTES)
  38564. throw new Error('bad signature size');
  38565. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38566. throw new Error('bad public key size');
  38567. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38568. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38569. var i;
  38570. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38571. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38572. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38573. };
  38574. nacl.sign.keyPair = function() {
  38575. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38576. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38577. crypto_sign_keypair(pk, sk);
  38578. return {publicKey: pk, secretKey: sk};
  38579. };
  38580. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38581. checkArrayTypes(secretKey);
  38582. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38583. throw new Error('bad secret key size');
  38584. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38585. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38586. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38587. };
  38588. nacl.sign.keyPair.fromSeed = function(seed) {
  38589. checkArrayTypes(seed);
  38590. if (seed.length !== crypto_sign_SEEDBYTES)
  38591. throw new Error('bad seed size');
  38592. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38593. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38594. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38595. crypto_sign_keypair(pk, sk, true);
  38596. return {publicKey: pk, secretKey: sk};
  38597. };
  38598. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38599. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38600. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38601. nacl.sign.signatureLength = crypto_sign_BYTES;
  38602. nacl.hash = function(msg) {
  38603. checkArrayTypes(msg);
  38604. var h = new Uint8Array(crypto_hash_BYTES);
  38605. crypto_hash(h, msg, msg.length);
  38606. return h;
  38607. };
  38608. nacl.hash.hashLength = crypto_hash_BYTES;
  38609. nacl.verify = function(x, y) {
  38610. checkArrayTypes(x, y);
  38611. // Zero length arguments are considered not equal.
  38612. if (x.length === 0 || y.length === 0) return false;
  38613. if (x.length !== y.length) return false;
  38614. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38615. };
  38616. nacl.setPRNG = function(fn) {
  38617. randombytes = fn;
  38618. };
  38619. (function() {
  38620. // Initialize PRNG if environment provides CSPRNG.
  38621. // If not, methods calling randombytes will throw.
  38622. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38623. if (crypto && crypto.getRandomValues) {
  38624. // Browsers.
  38625. var QUOTA = 65536;
  38626. nacl.setPRNG(function(x, n) {
  38627. var i, v = new Uint8Array(n);
  38628. for (i = 0; i < n; i += QUOTA) {
  38629. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38630. }
  38631. for (i = 0; i < n; i++) x[i] = v[i];
  38632. cleanup(v);
  38633. });
  38634. } else if (true) {
  38635. // Node.js.
  38636. crypto = __webpack_require__(3);
  38637. if (crypto && crypto.randomBytes) {
  38638. nacl.setPRNG(function(x, n) {
  38639. var i, v = crypto.randomBytes(n);
  38640. for (i = 0; i < n; i++) x[i] = v[i];
  38641. cleanup(v);
  38642. });
  38643. }
  38644. }
  38645. })();
  38646. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38647. /***/ }),
  38648. /* 1 */
  38649. /***/ (function(module, exports, __webpack_require__) {
  38650. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38651. // Public domain.
  38652. (function(root, f) {
  38653. 'use strict';
  38654. if ( true && module.exports) module.exports = f();
  38655. else if (root.nacl) root.nacl.util = f();
  38656. else {
  38657. root.nacl = {};
  38658. root.nacl.util = f();
  38659. }
  38660. }(this, function() {
  38661. 'use strict';
  38662. var util = {};
  38663. function validateBase64(s) {
  38664. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38665. throw new TypeError('invalid encoding');
  38666. }
  38667. }
  38668. util.decodeUTF8 = function(s) {
  38669. if (typeof s !== 'string') throw new TypeError('expected string');
  38670. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38671. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38672. return b;
  38673. };
  38674. util.encodeUTF8 = function(arr) {
  38675. var i, s = [];
  38676. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38677. return decodeURIComponent(escape(s.join('')));
  38678. };
  38679. if (typeof atob === 'undefined') {
  38680. // Node.js
  38681. if (typeof Buffer.from !== 'undefined') {
  38682. // Node v6 and later
  38683. util.encodeBase64 = function (arr) { // v6 and later
  38684. return Buffer.from(arr).toString('base64');
  38685. };
  38686. util.decodeBase64 = function (s) {
  38687. validateBase64(s);
  38688. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38689. };
  38690. } else {
  38691. // Node earlier than v6
  38692. util.encodeBase64 = function (arr) { // v6 and later
  38693. return (new Buffer(arr)).toString('base64');
  38694. };
  38695. util.decodeBase64 = function(s) {
  38696. validateBase64(s);
  38697. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38698. };
  38699. }
  38700. } else {
  38701. // Browsers
  38702. util.encodeBase64 = function(arr) {
  38703. var i, s = [], len = arr.length;
  38704. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38705. return btoa(s.join(''));
  38706. };
  38707. util.decodeBase64 = function(s) {
  38708. validateBase64(s);
  38709. var i, d = atob(s), b = new Uint8Array(d.length);
  38710. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38711. return b;
  38712. };
  38713. }
  38714. return util;
  38715. }));
  38716. /***/ }),
  38717. /* 2 */
  38718. /***/ (function(module, exports, __webpack_require__) {
  38719. // required so we don't have to do require('pusher').default etc.
  38720. module.exports = __webpack_require__(4).default;
  38721. /***/ }),
  38722. /* 3 */
  38723. /***/ (function(module, exports) {
  38724. /* (ignored) */
  38725. /***/ }),
  38726. /* 4 */
  38727. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38728. "use strict";
  38729. __webpack_require__.r(__webpack_exports__);
  38730. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38731. var ScriptReceiverFactory = (function () {
  38732. function ScriptReceiverFactory(prefix, name) {
  38733. this.lastId = 0;
  38734. this.prefix = prefix;
  38735. this.name = name;
  38736. }
  38737. ScriptReceiverFactory.prototype.create = function (callback) {
  38738. this.lastId++;
  38739. var number = this.lastId;
  38740. var id = this.prefix + number;
  38741. var name = this.name + "[" + number + "]";
  38742. var called = false;
  38743. var callbackWrapper = function () {
  38744. if (!called) {
  38745. callback.apply(null, arguments);
  38746. called = true;
  38747. }
  38748. };
  38749. this[number] = callbackWrapper;
  38750. return { number: number, id: id, name: name, callback: callbackWrapper };
  38751. };
  38752. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38753. delete this[receiver.number];
  38754. };
  38755. return ScriptReceiverFactory;
  38756. }());
  38757. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38758. // CONCATENATED MODULE: ./src/core/defaults.ts
  38759. var Defaults = {
  38760. VERSION: "5.0.3",
  38761. PROTOCOL: 7,
  38762. host: 'ws.pusherapp.com',
  38763. ws_port: 80,
  38764. wss_port: 443,
  38765. ws_path: '',
  38766. sockjs_host: 'sockjs.pusher.com',
  38767. sockjs_http_port: 80,
  38768. sockjs_https_port: 443,
  38769. sockjs_path: '/pusher',
  38770. stats_host: 'stats.pusher.com',
  38771. channel_auth_endpoint: '/pusher/auth',
  38772. channel_auth_transport: 'ajax',
  38773. activity_timeout: 120000,
  38774. pong_timeout: 30000,
  38775. unavailable_timeout: 10000,
  38776. cdn_http: "http://js.pusher.com",
  38777. cdn_https: "https://js.pusher.com",
  38778. dependency_suffix: ""
  38779. };
  38780. /* harmony default export */ var defaults = (Defaults);
  38781. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38782. var dependency_loader_DependencyLoader = (function () {
  38783. function DependencyLoader(options) {
  38784. this.options = options;
  38785. this.receivers = options.receivers || ScriptReceivers;
  38786. this.loading = {};
  38787. }
  38788. DependencyLoader.prototype.load = function (name, options, callback) {
  38789. var self = this;
  38790. if (self.loading[name] && self.loading[name].length > 0) {
  38791. self.loading[name].push(callback);
  38792. }
  38793. else {
  38794. self.loading[name] = [callback];
  38795. var request = runtime.createScriptRequest(self.getPath(name, options));
  38796. var receiver = self.receivers.create(function (error) {
  38797. self.receivers.remove(receiver);
  38798. if (self.loading[name]) {
  38799. var callbacks = self.loading[name];
  38800. delete self.loading[name];
  38801. var successCallback = function (wasSuccessful) {
  38802. if (!wasSuccessful) {
  38803. request.cleanup();
  38804. }
  38805. };
  38806. for (var i = 0; i < callbacks.length; i++) {
  38807. callbacks[i](error, successCallback);
  38808. }
  38809. }
  38810. });
  38811. request.send(receiver);
  38812. }
  38813. };
  38814. DependencyLoader.prototype.getRoot = function (options) {
  38815. var cdn;
  38816. var protocol = runtime.getDocument().location.protocol;
  38817. if ((options && options.useTLS) || protocol === "https:") {
  38818. cdn = this.options.cdn_https;
  38819. }
  38820. else {
  38821. cdn = this.options.cdn_http;
  38822. }
  38823. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38824. };
  38825. DependencyLoader.prototype.getPath = function (name, options) {
  38826. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38827. };
  38828. ;
  38829. return DependencyLoader;
  38830. }());
  38831. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38832. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38833. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38834. var Dependencies = new dependency_loader({
  38835. cdn_http: defaults.cdn_http,
  38836. cdn_https: defaults.cdn_https,
  38837. version: defaults.VERSION,
  38838. suffix: defaults.dependency_suffix,
  38839. receivers: DependenciesReceivers
  38840. });
  38841. // CONCATENATED MODULE: ./src/core/base64.ts
  38842. function encode(s) {
  38843. return btoa(utob(s));
  38844. }
  38845. var fromCharCode = String.fromCharCode;
  38846. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38847. var b64tab = {};
  38848. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38849. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38850. }
  38851. var cb_utob = function (c) {
  38852. var cc = c.charCodeAt(0);
  38853. return cc < 0x80
  38854. ? c
  38855. : cc < 0x800
  38856. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38857. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38858. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38859. fromCharCode(0x80 | (cc & 0x3f));
  38860. };
  38861. var utob = function (u) {
  38862. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38863. };
  38864. var cb_encode = function (ccc) {
  38865. var padlen = [0, 2, 1][ccc.length % 3];
  38866. var ord = (ccc.charCodeAt(0) << 16) |
  38867. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38868. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38869. var chars = [
  38870. b64chars.charAt(ord >>> 18),
  38871. b64chars.charAt((ord >>> 12) & 63),
  38872. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38873. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38874. ];
  38875. return chars.join('');
  38876. };
  38877. var btoa = window.btoa ||
  38878. function (b) {
  38879. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38880. };
  38881. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38882. var Timer = (function () {
  38883. function Timer(set, clear, delay, callback) {
  38884. var _this = this;
  38885. this.clear = clear;
  38886. this.timer = set(function () {
  38887. if (_this.timer) {
  38888. _this.timer = callback(_this.timer);
  38889. }
  38890. }, delay);
  38891. }
  38892. Timer.prototype.isRunning = function () {
  38893. return this.timer !== null;
  38894. };
  38895. Timer.prototype.ensureAborted = function () {
  38896. if (this.timer) {
  38897. this.clear(this.timer);
  38898. this.timer = null;
  38899. }
  38900. };
  38901. return Timer;
  38902. }());
  38903. /* harmony default export */ var abstract_timer = (Timer);
  38904. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38905. var __extends = (undefined && undefined.__extends) || (function () {
  38906. var extendStatics = function (d, b) {
  38907. extendStatics = Object.setPrototypeOf ||
  38908. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38909. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38910. return extendStatics(d, b);
  38911. };
  38912. return function (d, b) {
  38913. extendStatics(d, b);
  38914. function __() { this.constructor = d; }
  38915. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38916. };
  38917. })();
  38918. function timers_clearTimeout(timer) {
  38919. window.clearTimeout(timer);
  38920. }
  38921. function timers_clearInterval(timer) {
  38922. window.clearInterval(timer);
  38923. }
  38924. var OneOffTimer = (function (_super) {
  38925. __extends(OneOffTimer, _super);
  38926. function OneOffTimer(delay, callback) {
  38927. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  38928. callback();
  38929. return null;
  38930. }) || this;
  38931. }
  38932. return OneOffTimer;
  38933. }(abstract_timer));
  38934. var PeriodicTimer = (function (_super) {
  38935. __extends(PeriodicTimer, _super);
  38936. function PeriodicTimer(delay, callback) {
  38937. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  38938. callback();
  38939. return timer;
  38940. }) || this;
  38941. }
  38942. return PeriodicTimer;
  38943. }(abstract_timer));
  38944. // CONCATENATED MODULE: ./src/core/util.ts
  38945. var Util = {
  38946. now: function () {
  38947. if (Date.now) {
  38948. return Date.now();
  38949. }
  38950. else {
  38951. return new Date().valueOf();
  38952. }
  38953. },
  38954. defer: function (callback) {
  38955. return new OneOffTimer(0, callback);
  38956. },
  38957. method: function (name) {
  38958. var args = [];
  38959. for (var _i = 1; _i < arguments.length; _i++) {
  38960. args[_i - 1] = arguments[_i];
  38961. }
  38962. var boundArguments = Array.prototype.slice.call(arguments, 1);
  38963. return function (object) {
  38964. return object[name].apply(object, boundArguments.concat(arguments));
  38965. };
  38966. }
  38967. };
  38968. /* harmony default export */ var util = (Util);
  38969. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  38970. function extend(target) {
  38971. var sources = [];
  38972. for (var _i = 1; _i < arguments.length; _i++) {
  38973. sources[_i - 1] = arguments[_i];
  38974. }
  38975. for (var i = 0; i < sources.length; i++) {
  38976. var extensions = sources[i];
  38977. for (var property in extensions) {
  38978. if (extensions[property] && extensions[property].constructor &&
  38979. extensions[property].constructor === Object) {
  38980. target[property] = extend(target[property] || {}, extensions[property]);
  38981. }
  38982. else {
  38983. target[property] = extensions[property];
  38984. }
  38985. }
  38986. }
  38987. return target;
  38988. }
  38989. function stringify() {
  38990. var m = ["Pusher"];
  38991. for (var i = 0; i < arguments.length; i++) {
  38992. if (typeof arguments[i] === "string") {
  38993. m.push(arguments[i]);
  38994. }
  38995. else {
  38996. m.push(safeJSONStringify(arguments[i]));
  38997. }
  38998. }
  38999. return m.join(" : ");
  39000. }
  39001. function arrayIndexOf(array, item) {
  39002. var nativeIndexOf = Array.prototype.indexOf;
  39003. if (array === null) {
  39004. return -1;
  39005. }
  39006. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39007. return array.indexOf(item);
  39008. }
  39009. for (var i = 0, l = array.length; i < l; i++) {
  39010. if (array[i] === item) {
  39011. return i;
  39012. }
  39013. }
  39014. return -1;
  39015. }
  39016. function objectApply(object, f) {
  39017. for (var key in object) {
  39018. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39019. f(object[key], key, object);
  39020. }
  39021. }
  39022. }
  39023. function keys(object) {
  39024. var keys = [];
  39025. objectApply(object, function (_, key) {
  39026. keys.push(key);
  39027. });
  39028. return keys;
  39029. }
  39030. function values(object) {
  39031. var values = [];
  39032. objectApply(object, function (value) {
  39033. values.push(value);
  39034. });
  39035. return values;
  39036. }
  39037. function apply(array, f, context) {
  39038. for (var i = 0; i < array.length; i++) {
  39039. f.call(context || window, array[i], i, array);
  39040. }
  39041. }
  39042. function map(array, f) {
  39043. var result = [];
  39044. for (var i = 0; i < array.length; i++) {
  39045. result.push(f(array[i], i, array, result));
  39046. }
  39047. return result;
  39048. }
  39049. function mapObject(object, f) {
  39050. var result = {};
  39051. objectApply(object, function (value, key) {
  39052. result[key] = f(value);
  39053. });
  39054. return result;
  39055. }
  39056. function filter(array, test) {
  39057. test = test || function (value) { return !!value; };
  39058. var result = [];
  39059. for (var i = 0; i < array.length; i++) {
  39060. if (test(array[i], i, array, result)) {
  39061. result.push(array[i]);
  39062. }
  39063. }
  39064. return result;
  39065. }
  39066. function filterObject(object, test) {
  39067. var result = {};
  39068. objectApply(object, function (value, key) {
  39069. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39070. result[key] = value;
  39071. }
  39072. });
  39073. return result;
  39074. }
  39075. function flatten(object) {
  39076. var result = [];
  39077. objectApply(object, function (value, key) {
  39078. result.push([key, value]);
  39079. });
  39080. return result;
  39081. }
  39082. function any(array, test) {
  39083. for (var i = 0; i < array.length; i++) {
  39084. if (test(array[i], i, array)) {
  39085. return true;
  39086. }
  39087. }
  39088. return false;
  39089. }
  39090. function collections_all(array, test) {
  39091. for (var i = 0; i < array.length; i++) {
  39092. if (!test(array[i], i, array)) {
  39093. return false;
  39094. }
  39095. }
  39096. return true;
  39097. }
  39098. function encodeParamsObject(data) {
  39099. return mapObject(data, function (value) {
  39100. if (typeof value === "object") {
  39101. value = safeJSONStringify(value);
  39102. }
  39103. return encodeURIComponent(encode(value.toString()));
  39104. });
  39105. }
  39106. function buildQueryString(data) {
  39107. var params = filterObject(data, function (value) {
  39108. return value !== undefined;
  39109. });
  39110. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39111. return query;
  39112. }
  39113. function decycleObject(object) {
  39114. var objects = [], paths = [];
  39115. return (function derez(value, path) {
  39116. var i, name, nu;
  39117. switch (typeof value) {
  39118. case 'object':
  39119. if (!value) {
  39120. return null;
  39121. }
  39122. for (i = 0; i < objects.length; i += 1) {
  39123. if (objects[i] === value) {
  39124. return { $ref: paths[i] };
  39125. }
  39126. }
  39127. objects.push(value);
  39128. paths.push(path);
  39129. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39130. nu = [];
  39131. for (i = 0; i < value.length; i += 1) {
  39132. nu[i] = derez(value[i], path + '[' + i + ']');
  39133. }
  39134. }
  39135. else {
  39136. nu = {};
  39137. for (name in value) {
  39138. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39139. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39140. }
  39141. }
  39142. }
  39143. return nu;
  39144. case 'number':
  39145. case 'string':
  39146. case 'boolean':
  39147. return value;
  39148. }
  39149. }(object, '$'));
  39150. }
  39151. function safeJSONStringify(source) {
  39152. try {
  39153. return JSON.stringify(source);
  39154. }
  39155. catch (e) {
  39156. return JSON.stringify(decycleObject(source));
  39157. }
  39158. }
  39159. // CONCATENATED MODULE: ./src/core/logger.ts
  39160. var logger_Logger = (function () {
  39161. function Logger() {
  39162. this.globalLog = function (message) {
  39163. if (window.console && window.console.log) {
  39164. window.console.log(message);
  39165. }
  39166. };
  39167. }
  39168. Logger.prototype.debug = function () {
  39169. var args = [];
  39170. for (var _i = 0; _i < arguments.length; _i++) {
  39171. args[_i] = arguments[_i];
  39172. }
  39173. this.log(this.globalLog, args);
  39174. };
  39175. Logger.prototype.warn = function () {
  39176. var args = [];
  39177. for (var _i = 0; _i < arguments.length; _i++) {
  39178. args[_i] = arguments[_i];
  39179. }
  39180. this.log(this.globalLogWarn, args);
  39181. };
  39182. Logger.prototype.error = function () {
  39183. var args = [];
  39184. for (var _i = 0; _i < arguments.length; _i++) {
  39185. args[_i] = arguments[_i];
  39186. }
  39187. this.log(this.globalLogError, args);
  39188. };
  39189. Logger.prototype.globalLogWarn = function (message) {
  39190. if (window.console && window.console.warn) {
  39191. window.console.warn(message);
  39192. }
  39193. else {
  39194. this.globalLog(message);
  39195. }
  39196. };
  39197. Logger.prototype.globalLogError = function (message) {
  39198. if (window.console && window.console.error) {
  39199. window.console.error(message);
  39200. }
  39201. else {
  39202. this.globalLogWarn(message);
  39203. }
  39204. };
  39205. Logger.prototype.log = function (defaultLoggingFunction) {
  39206. var args = [];
  39207. for (var _i = 1; _i < arguments.length; _i++) {
  39208. args[_i - 1] = arguments[_i];
  39209. }
  39210. var message = stringify.apply(this, arguments);
  39211. if (core_pusher.log) {
  39212. core_pusher.log(message);
  39213. }
  39214. else if (core_pusher.logToConsole) {
  39215. var log = defaultLoggingFunction.bind(this);
  39216. log(message);
  39217. }
  39218. };
  39219. return Logger;
  39220. }());
  39221. /* harmony default export */ var logger = (new logger_Logger());
  39222. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39223. var urlStore = {
  39224. baseUrl: "https://pusher.com",
  39225. urls: {
  39226. authenticationEndpoint: {
  39227. path: "/docs/authenticating_users",
  39228. },
  39229. javascriptQuickStart: {
  39230. path: "/docs/javascript_quick_start"
  39231. },
  39232. triggeringClientEvents: {
  39233. path: "/docs/client_api_guide/client_events#trigger-events"
  39234. }
  39235. }
  39236. };
  39237. var buildLogSuffix = function (key) {
  39238. var urlPrefix = "See:";
  39239. var urlObj = urlStore.urls[key];
  39240. if (!urlObj)
  39241. return "";
  39242. var url;
  39243. if (urlObj.fullUrl) {
  39244. url = urlObj.fullUrl;
  39245. }
  39246. else if (urlObj.path) {
  39247. url = urlStore.baseUrl + urlObj.path;
  39248. }
  39249. if (!url)
  39250. return "";
  39251. return urlPrefix + " " + url;
  39252. };
  39253. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39254. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39255. var ajax = function (context, socketId, callback) {
  39256. var self = this, xhr;
  39257. xhr = runtime.createXHR();
  39258. xhr.open("POST", self.options.authEndpoint, true);
  39259. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39260. for (var headerName in this.authOptions.headers) {
  39261. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39262. }
  39263. xhr.onreadystatechange = function () {
  39264. if (xhr.readyState === 4) {
  39265. if (xhr.status === 200) {
  39266. var data, parsed = false;
  39267. try {
  39268. data = JSON.parse(xhr.responseText);
  39269. parsed = true;
  39270. }
  39271. catch (e) {
  39272. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39273. }
  39274. if (parsed) {
  39275. callback(false, data);
  39276. }
  39277. }
  39278. else {
  39279. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39280. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39281. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39282. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39283. callback(true, xhr.status);
  39284. }
  39285. }
  39286. };
  39287. xhr.send(this.composeQuery(socketId));
  39288. return xhr;
  39289. };
  39290. /* harmony default export */ var xhr_auth = (ajax);
  39291. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39292. var jsonp = function (context, socketId, callback) {
  39293. if (this.authOptions.headers !== undefined) {
  39294. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39295. }
  39296. var callbackName = context.nextAuthCallbackID.toString();
  39297. context.nextAuthCallbackID++;
  39298. var document = context.getDocument();
  39299. var script = document.createElement("script");
  39300. context.auth_callbacks[callbackName] = function (data) {
  39301. callback(false, data);
  39302. };
  39303. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39304. script.src = this.options.authEndpoint +
  39305. '?callback=' +
  39306. encodeURIComponent(callback_name) +
  39307. '&' +
  39308. this.composeQuery(socketId);
  39309. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39310. head.insertBefore(script, head.firstChild);
  39311. };
  39312. /* harmony default export */ var jsonp_auth = (jsonp);
  39313. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39314. var ScriptRequest = (function () {
  39315. function ScriptRequest(src) {
  39316. this.src = src;
  39317. }
  39318. ScriptRequest.prototype.send = function (receiver) {
  39319. var self = this;
  39320. var errorString = "Error loading " + self.src;
  39321. self.script = document.createElement("script");
  39322. self.script.id = receiver.id;
  39323. self.script.src = self.src;
  39324. self.script.type = "text/javascript";
  39325. self.script.charset = "UTF-8";
  39326. if (self.script.addEventListener) {
  39327. self.script.onerror = function () {
  39328. receiver.callback(errorString);
  39329. };
  39330. self.script.onload = function () {
  39331. receiver.callback(null);
  39332. };
  39333. }
  39334. else {
  39335. self.script.onreadystatechange = function () {
  39336. if (self.script.readyState === 'loaded' ||
  39337. self.script.readyState === 'complete') {
  39338. receiver.callback(null);
  39339. }
  39340. };
  39341. }
  39342. if (self.script.async === undefined && document.attachEvent &&
  39343. /opera/i.test(navigator.userAgent)) {
  39344. self.errorScript = document.createElement("script");
  39345. self.errorScript.id = receiver.id + "_error";
  39346. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39347. self.script.async = self.errorScript.async = false;
  39348. }
  39349. else {
  39350. self.script.async = true;
  39351. }
  39352. var head = document.getElementsByTagName('head')[0];
  39353. head.insertBefore(self.script, head.firstChild);
  39354. if (self.errorScript) {
  39355. head.insertBefore(self.errorScript, self.script.nextSibling);
  39356. }
  39357. };
  39358. ScriptRequest.prototype.cleanup = function () {
  39359. if (this.script) {
  39360. this.script.onload = this.script.onerror = null;
  39361. this.script.onreadystatechange = null;
  39362. }
  39363. if (this.script && this.script.parentNode) {
  39364. this.script.parentNode.removeChild(this.script);
  39365. }
  39366. if (this.errorScript && this.errorScript.parentNode) {
  39367. this.errorScript.parentNode.removeChild(this.errorScript);
  39368. }
  39369. this.script = null;
  39370. this.errorScript = null;
  39371. };
  39372. return ScriptRequest;
  39373. }());
  39374. /* harmony default export */ var script_request = (ScriptRequest);
  39375. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39376. var jsonp_request_JSONPRequest = (function () {
  39377. function JSONPRequest(url, data) {
  39378. this.url = url;
  39379. this.data = data;
  39380. }
  39381. JSONPRequest.prototype.send = function (receiver) {
  39382. if (this.request) {
  39383. return;
  39384. }
  39385. var query = buildQueryString(this.data);
  39386. var url = this.url + "/" + receiver.number + "?" + query;
  39387. this.request = runtime.createScriptRequest(url);
  39388. this.request.send(receiver);
  39389. };
  39390. JSONPRequest.prototype.cleanup = function () {
  39391. if (this.request) {
  39392. this.request.cleanup();
  39393. }
  39394. };
  39395. return JSONPRequest;
  39396. }());
  39397. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39398. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39399. var getAgent = function (sender, useTLS) {
  39400. return function (data, callback) {
  39401. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39402. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39403. var request = runtime.createJSONPRequest(url, data);
  39404. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39405. ScriptReceivers.remove(receiver);
  39406. request.cleanup();
  39407. if (result && result.host) {
  39408. sender.host = result.host;
  39409. }
  39410. if (callback) {
  39411. callback(error, result);
  39412. }
  39413. });
  39414. request.send(receiver);
  39415. };
  39416. };
  39417. var jsonp_timeline_jsonp = {
  39418. name: 'jsonp',
  39419. getAgent: getAgent
  39420. };
  39421. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39422. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39423. function getGenericURL(baseScheme, params, path) {
  39424. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39425. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39426. return scheme + "://" + host + path;
  39427. }
  39428. function getGenericPath(key, queryString) {
  39429. var path = "/app/" + key;
  39430. var query = "?protocol=" + defaults.PROTOCOL +
  39431. "&client=js" +
  39432. "&version=" + defaults.VERSION +
  39433. (queryString ? ("&" + queryString) : "");
  39434. return path + query;
  39435. }
  39436. var ws = {
  39437. getInitial: function (key, params) {
  39438. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39439. return getGenericURL("ws", params, path);
  39440. }
  39441. };
  39442. var http = {
  39443. getInitial: function (key, params) {
  39444. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39445. return getGenericURL("http", params, path);
  39446. }
  39447. };
  39448. var sockjs = {
  39449. getInitial: function (key, params) {
  39450. return getGenericURL("http", params, params.httpPath || "/pusher");
  39451. },
  39452. getPath: function (key, params) {
  39453. return getGenericPath(key);
  39454. }
  39455. };
  39456. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39457. var callback_registry_CallbackRegistry = (function () {
  39458. function CallbackRegistry() {
  39459. this._callbacks = {};
  39460. }
  39461. CallbackRegistry.prototype.get = function (name) {
  39462. return this._callbacks[prefix(name)];
  39463. };
  39464. CallbackRegistry.prototype.add = function (name, callback, context) {
  39465. var prefixedEventName = prefix(name);
  39466. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39467. this._callbacks[prefixedEventName].push({
  39468. fn: callback,
  39469. context: context
  39470. });
  39471. };
  39472. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39473. if (!name && !callback && !context) {
  39474. this._callbacks = {};
  39475. return;
  39476. }
  39477. var names = name ? [prefix(name)] : keys(this._callbacks);
  39478. if (callback || context) {
  39479. this.removeCallback(names, callback, context);
  39480. }
  39481. else {
  39482. this.removeAllCallbacks(names);
  39483. }
  39484. };
  39485. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39486. apply(names, function (name) {
  39487. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39488. return (callback && callback !== binding.fn) ||
  39489. (context && context !== binding.context);
  39490. });
  39491. if (this._callbacks[name].length === 0) {
  39492. delete this._callbacks[name];
  39493. }
  39494. }, this);
  39495. };
  39496. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39497. apply(names, function (name) {
  39498. delete this._callbacks[name];
  39499. }, this);
  39500. };
  39501. return CallbackRegistry;
  39502. }());
  39503. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39504. function prefix(name) {
  39505. return "_" + name;
  39506. }
  39507. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39508. var dispatcher_Dispatcher = (function () {
  39509. function Dispatcher(failThrough) {
  39510. this.callbacks = new callback_registry();
  39511. this.global_callbacks = [];
  39512. this.failThrough = failThrough;
  39513. }
  39514. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39515. this.callbacks.add(eventName, callback, context);
  39516. return this;
  39517. };
  39518. Dispatcher.prototype.bind_global = function (callback) {
  39519. this.global_callbacks.push(callback);
  39520. return this;
  39521. };
  39522. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39523. this.callbacks.remove(eventName, callback, context);
  39524. return this;
  39525. };
  39526. Dispatcher.prototype.unbind_global = function (callback) {
  39527. if (!callback) {
  39528. this.global_callbacks = [];
  39529. return this;
  39530. }
  39531. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39532. return this;
  39533. };
  39534. Dispatcher.prototype.unbind_all = function () {
  39535. this.unbind();
  39536. this.unbind_global();
  39537. return this;
  39538. };
  39539. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39540. for (var i = 0; i < this.global_callbacks.length; i++) {
  39541. this.global_callbacks[i](eventName, data);
  39542. }
  39543. var callbacks = this.callbacks.get(eventName);
  39544. var args = [];
  39545. if (metadata) {
  39546. args.push(data, metadata);
  39547. }
  39548. else if (data) {
  39549. args.push(data);
  39550. }
  39551. if (callbacks && callbacks.length > 0) {
  39552. for (var i = 0; i < callbacks.length; i++) {
  39553. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39554. }
  39555. }
  39556. else if (this.failThrough) {
  39557. this.failThrough(eventName, data);
  39558. }
  39559. return this;
  39560. };
  39561. return Dispatcher;
  39562. }());
  39563. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39564. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39565. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39566. var extendStatics = function (d, b) {
  39567. extendStatics = Object.setPrototypeOf ||
  39568. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39569. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39570. return extendStatics(d, b);
  39571. };
  39572. return function (d, b) {
  39573. extendStatics(d, b);
  39574. function __() { this.constructor = d; }
  39575. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39576. };
  39577. })();
  39578. var transport_connection_TransportConnection = (function (_super) {
  39579. transport_connection_extends(TransportConnection, _super);
  39580. function TransportConnection(hooks, name, priority, key, options) {
  39581. var _this = _super.call(this) || this;
  39582. _this.initialize = runtime.transportConnectionInitializer;
  39583. _this.hooks = hooks;
  39584. _this.name = name;
  39585. _this.priority = priority;
  39586. _this.key = key;
  39587. _this.options = options;
  39588. _this.state = "new";
  39589. _this.timeline = options.timeline;
  39590. _this.activityTimeout = options.activityTimeout;
  39591. _this.id = _this.timeline.generateUniqueID();
  39592. return _this;
  39593. }
  39594. TransportConnection.prototype.handlesActivityChecks = function () {
  39595. return Boolean(this.hooks.handlesActivityChecks);
  39596. };
  39597. TransportConnection.prototype.supportsPing = function () {
  39598. return Boolean(this.hooks.supportsPing);
  39599. };
  39600. TransportConnection.prototype.connect = function () {
  39601. var _this = this;
  39602. if (this.socket || this.state !== "initialized") {
  39603. return false;
  39604. }
  39605. var url = this.hooks.urls.getInitial(this.key, this.options);
  39606. try {
  39607. this.socket = this.hooks.getSocket(url, this.options);
  39608. }
  39609. catch (e) {
  39610. util.defer(function () {
  39611. _this.onError(e);
  39612. _this.changeState("closed");
  39613. });
  39614. return false;
  39615. }
  39616. this.bindListeners();
  39617. logger.debug("Connecting", { transport: this.name, url: url });
  39618. this.changeState("connecting");
  39619. return true;
  39620. };
  39621. TransportConnection.prototype.close = function () {
  39622. if (this.socket) {
  39623. this.socket.close();
  39624. return true;
  39625. }
  39626. else {
  39627. return false;
  39628. }
  39629. };
  39630. TransportConnection.prototype.send = function (data) {
  39631. var _this = this;
  39632. if (this.state === "open") {
  39633. util.defer(function () {
  39634. if (_this.socket) {
  39635. _this.socket.send(data);
  39636. }
  39637. });
  39638. return true;
  39639. }
  39640. else {
  39641. return false;
  39642. }
  39643. };
  39644. TransportConnection.prototype.ping = function () {
  39645. if (this.state === "open" && this.supportsPing()) {
  39646. this.socket.ping();
  39647. }
  39648. };
  39649. TransportConnection.prototype.onOpen = function () {
  39650. if (this.hooks.beforeOpen) {
  39651. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39652. }
  39653. this.changeState("open");
  39654. this.socket.onopen = undefined;
  39655. };
  39656. TransportConnection.prototype.onError = function (error) {
  39657. this.emit("error", { type: 'WebSocketError', error: error });
  39658. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39659. };
  39660. TransportConnection.prototype.onClose = function (closeEvent) {
  39661. if (closeEvent) {
  39662. this.changeState("closed", {
  39663. code: closeEvent.code,
  39664. reason: closeEvent.reason,
  39665. wasClean: closeEvent.wasClean
  39666. });
  39667. }
  39668. else {
  39669. this.changeState("closed");
  39670. }
  39671. this.unbindListeners();
  39672. this.socket = undefined;
  39673. };
  39674. TransportConnection.prototype.onMessage = function (message) {
  39675. this.emit("message", message);
  39676. };
  39677. TransportConnection.prototype.onActivity = function () {
  39678. this.emit("activity");
  39679. };
  39680. TransportConnection.prototype.bindListeners = function () {
  39681. var _this = this;
  39682. this.socket.onopen = function () {
  39683. _this.onOpen();
  39684. };
  39685. this.socket.onerror = function (error) {
  39686. _this.onError(error);
  39687. };
  39688. this.socket.onclose = function (closeEvent) {
  39689. _this.onClose(closeEvent);
  39690. };
  39691. this.socket.onmessage = function (message) {
  39692. _this.onMessage(message);
  39693. };
  39694. if (this.supportsPing()) {
  39695. this.socket.onactivity = function () { _this.onActivity(); };
  39696. }
  39697. };
  39698. TransportConnection.prototype.unbindListeners = function () {
  39699. if (this.socket) {
  39700. this.socket.onopen = undefined;
  39701. this.socket.onerror = undefined;
  39702. this.socket.onclose = undefined;
  39703. this.socket.onmessage = undefined;
  39704. if (this.supportsPing()) {
  39705. this.socket.onactivity = undefined;
  39706. }
  39707. }
  39708. };
  39709. TransportConnection.prototype.changeState = function (state, params) {
  39710. this.state = state;
  39711. this.timeline.info(this.buildTimelineMessage({
  39712. state: state,
  39713. params: params
  39714. }));
  39715. this.emit(state, params);
  39716. };
  39717. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39718. return extend({ cid: this.id }, message);
  39719. };
  39720. return TransportConnection;
  39721. }(dispatcher));
  39722. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39723. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39724. var transport_Transport = (function () {
  39725. function Transport(hooks) {
  39726. this.hooks = hooks;
  39727. }
  39728. Transport.prototype.isSupported = function (environment) {
  39729. return this.hooks.isSupported(environment);
  39730. };
  39731. Transport.prototype.createConnection = function (name, priority, key, options) {
  39732. return new transport_connection(this.hooks, name, priority, key, options);
  39733. };
  39734. return Transport;
  39735. }());
  39736. /* harmony default export */ var transports_transport = (transport_Transport);
  39737. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39738. var WSTransport = new transports_transport({
  39739. urls: ws,
  39740. handlesActivityChecks: false,
  39741. supportsPing: false,
  39742. isInitialized: function () {
  39743. return Boolean(runtime.getWebSocketAPI());
  39744. },
  39745. isSupported: function () {
  39746. return Boolean(runtime.getWebSocketAPI());
  39747. },
  39748. getSocket: function (url) {
  39749. return runtime.createWebSocket(url);
  39750. }
  39751. });
  39752. var httpConfiguration = {
  39753. urls: http,
  39754. handlesActivityChecks: false,
  39755. supportsPing: true,
  39756. isInitialized: function () {
  39757. return true;
  39758. }
  39759. };
  39760. var streamingConfiguration = extend({ getSocket: function (url) {
  39761. return runtime.HTTPFactory.createStreamingSocket(url);
  39762. }
  39763. }, httpConfiguration);
  39764. var pollingConfiguration = extend({ getSocket: function (url) {
  39765. return runtime.HTTPFactory.createPollingSocket(url);
  39766. }
  39767. }, httpConfiguration);
  39768. var xhrConfiguration = {
  39769. isSupported: function () {
  39770. return runtime.isXHRSupported();
  39771. }
  39772. };
  39773. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39774. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39775. var Transports = {
  39776. ws: WSTransport,
  39777. xhr_streaming: XHRStreamingTransport,
  39778. xhr_polling: XHRPollingTransport
  39779. };
  39780. /* harmony default export */ var transports = (Transports);
  39781. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39782. var SockJSTransport = new transports_transport({
  39783. file: "sockjs",
  39784. urls: sockjs,
  39785. handlesActivityChecks: true,
  39786. supportsPing: false,
  39787. isSupported: function () {
  39788. return true;
  39789. },
  39790. isInitialized: function () {
  39791. return window.SockJS !== undefined;
  39792. },
  39793. getSocket: function (url, options) {
  39794. return new window.SockJS(url, null, {
  39795. js_path: Dependencies.getPath("sockjs", {
  39796. useTLS: options.useTLS
  39797. }),
  39798. ignore_null_origin: options.ignoreNullOrigin
  39799. });
  39800. },
  39801. beforeOpen: function (socket, path) {
  39802. socket.send(JSON.stringify({
  39803. path: path
  39804. }));
  39805. }
  39806. });
  39807. var xdrConfiguration = {
  39808. isSupported: function (environment) {
  39809. var yes = runtime.isXDRSupported(environment.useTLS);
  39810. return yes;
  39811. }
  39812. };
  39813. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39814. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39815. transports.xdr_streaming = XDRStreamingTransport;
  39816. transports.xdr_polling = XDRPollingTransport;
  39817. transports.sockjs = SockJSTransport;
  39818. /* harmony default export */ var transports_transports = (transports);
  39819. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39820. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39821. var extendStatics = function (d, b) {
  39822. extendStatics = Object.setPrototypeOf ||
  39823. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39824. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39825. return extendStatics(d, b);
  39826. };
  39827. return function (d, b) {
  39828. extendStatics(d, b);
  39829. function __() { this.constructor = d; }
  39830. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39831. };
  39832. })();
  39833. var NetInfo = (function (_super) {
  39834. net_info_extends(NetInfo, _super);
  39835. function NetInfo() {
  39836. var _this = _super.call(this) || this;
  39837. var self = _this;
  39838. if (window.addEventListener !== undefined) {
  39839. window.addEventListener("online", function () {
  39840. self.emit('online');
  39841. }, false);
  39842. window.addEventListener("offline", function () {
  39843. self.emit('offline');
  39844. }, false);
  39845. }
  39846. return _this;
  39847. }
  39848. NetInfo.prototype.isOnline = function () {
  39849. if (window.navigator.onLine === undefined) {
  39850. return true;
  39851. }
  39852. else {
  39853. return window.navigator.onLine;
  39854. }
  39855. };
  39856. return NetInfo;
  39857. }(dispatcher));
  39858. var net_info_Network = new NetInfo();
  39859. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39860. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39861. function AssistantToTheTransportManager(manager, transport, options) {
  39862. this.manager = manager;
  39863. this.transport = transport;
  39864. this.minPingDelay = options.minPingDelay;
  39865. this.maxPingDelay = options.maxPingDelay;
  39866. this.pingDelay = undefined;
  39867. }
  39868. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39869. var _this = this;
  39870. options = extend({}, options, {
  39871. activityTimeout: this.pingDelay
  39872. });
  39873. var connection = this.transport.createConnection(name, priority, key, options);
  39874. var openTimestamp = null;
  39875. var onOpen = function () {
  39876. connection.unbind("open", onOpen);
  39877. connection.bind("closed", onClosed);
  39878. openTimestamp = util.now();
  39879. };
  39880. var onClosed = function (closeEvent) {
  39881. connection.unbind("closed", onClosed);
  39882. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39883. _this.manager.reportDeath();
  39884. }
  39885. else if (!closeEvent.wasClean && openTimestamp) {
  39886. var lifespan = util.now() - openTimestamp;
  39887. if (lifespan < 2 * _this.maxPingDelay) {
  39888. _this.manager.reportDeath();
  39889. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39890. }
  39891. }
  39892. };
  39893. connection.bind("open", onOpen);
  39894. return connection;
  39895. };
  39896. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39897. return this.manager.isAlive() && this.transport.isSupported(environment);
  39898. };
  39899. return AssistantToTheTransportManager;
  39900. }());
  39901. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39902. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39903. var Protocol = {
  39904. decodeMessage: function (messageEvent) {
  39905. try {
  39906. var messageData = JSON.parse(messageEvent.data);
  39907. var pusherEventData = messageData.data;
  39908. if (typeof pusherEventData === 'string') {
  39909. try {
  39910. pusherEventData = JSON.parse(messageData.data);
  39911. }
  39912. catch (e) { }
  39913. }
  39914. var pusherEvent = {
  39915. event: messageData.event,
  39916. channel: messageData.channel,
  39917. data: pusherEventData,
  39918. };
  39919. if (messageData.user_id) {
  39920. pusherEvent.user_id = messageData.user_id;
  39921. }
  39922. return pusherEvent;
  39923. }
  39924. catch (e) {
  39925. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39926. }
  39927. },
  39928. encodeMessage: function (event) {
  39929. return JSON.stringify(event);
  39930. },
  39931. processHandshake: function (messageEvent) {
  39932. var message = Protocol.decodeMessage(messageEvent);
  39933. if (message.event === "pusher:connection_established") {
  39934. if (!message.data.activity_timeout) {
  39935. throw "No activity timeout specified in handshake";
  39936. }
  39937. return {
  39938. action: "connected",
  39939. id: message.data.socket_id,
  39940. activityTimeout: message.data.activity_timeout * 1000
  39941. };
  39942. }
  39943. else if (message.event === "pusher:error") {
  39944. return {
  39945. action: this.getCloseAction(message.data),
  39946. error: this.getCloseError(message.data)
  39947. };
  39948. }
  39949. else {
  39950. throw "Invalid handshake";
  39951. }
  39952. },
  39953. getCloseAction: function (closeEvent) {
  39954. if (closeEvent.code < 4000) {
  39955. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  39956. return "backoff";
  39957. }
  39958. else {
  39959. return null;
  39960. }
  39961. }
  39962. else if (closeEvent.code === 4000) {
  39963. return "tls_only";
  39964. }
  39965. else if (closeEvent.code < 4100) {
  39966. return "refused";
  39967. }
  39968. else if (closeEvent.code < 4200) {
  39969. return "backoff";
  39970. }
  39971. else if (closeEvent.code < 4300) {
  39972. return "retry";
  39973. }
  39974. else {
  39975. return "refused";
  39976. }
  39977. },
  39978. getCloseError: function (closeEvent) {
  39979. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  39980. return {
  39981. type: 'PusherError',
  39982. data: {
  39983. code: closeEvent.code,
  39984. message: closeEvent.reason || closeEvent.message
  39985. }
  39986. };
  39987. }
  39988. else {
  39989. return null;
  39990. }
  39991. }
  39992. };
  39993. /* harmony default export */ var protocol_protocol = (Protocol);
  39994. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  39995. var connection_extends = (undefined && undefined.__extends) || (function () {
  39996. var extendStatics = function (d, b) {
  39997. extendStatics = Object.setPrototypeOf ||
  39998. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39999. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40000. return extendStatics(d, b);
  40001. };
  40002. return function (d, b) {
  40003. extendStatics(d, b);
  40004. function __() { this.constructor = d; }
  40005. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40006. };
  40007. })();
  40008. var connection_Connection = (function (_super) {
  40009. connection_extends(Connection, _super);
  40010. function Connection(id, transport) {
  40011. var _this = _super.call(this) || this;
  40012. _this.id = id;
  40013. _this.transport = transport;
  40014. _this.activityTimeout = transport.activityTimeout;
  40015. _this.bindListeners();
  40016. return _this;
  40017. }
  40018. Connection.prototype.handlesActivityChecks = function () {
  40019. return this.transport.handlesActivityChecks();
  40020. };
  40021. Connection.prototype.send = function (data) {
  40022. return this.transport.send(data);
  40023. };
  40024. Connection.prototype.send_event = function (name, data, channel) {
  40025. var event = { event: name, data: data };
  40026. if (channel) {
  40027. event.channel = channel;
  40028. }
  40029. logger.debug('Event sent', event);
  40030. return this.send(protocol_protocol.encodeMessage(event));
  40031. };
  40032. Connection.prototype.ping = function () {
  40033. if (this.transport.supportsPing()) {
  40034. this.transport.ping();
  40035. }
  40036. else {
  40037. this.send_event('pusher:ping', {});
  40038. }
  40039. };
  40040. Connection.prototype.close = function () {
  40041. this.transport.close();
  40042. };
  40043. Connection.prototype.bindListeners = function () {
  40044. var _this = this;
  40045. var listeners = {
  40046. message: function (messageEvent) {
  40047. var pusherEvent;
  40048. try {
  40049. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40050. }
  40051. catch (e) {
  40052. _this.emit('error', {
  40053. type: 'MessageParseError',
  40054. error: e,
  40055. data: messageEvent.data
  40056. });
  40057. }
  40058. if (pusherEvent !== undefined) {
  40059. logger.debug('Event recd', pusherEvent);
  40060. switch (pusherEvent.event) {
  40061. case 'pusher:error':
  40062. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40063. break;
  40064. case 'pusher:ping':
  40065. _this.emit("ping");
  40066. break;
  40067. case 'pusher:pong':
  40068. _this.emit("pong");
  40069. break;
  40070. }
  40071. _this.emit('message', pusherEvent);
  40072. }
  40073. },
  40074. activity: function () {
  40075. _this.emit("activity");
  40076. },
  40077. error: function (error) {
  40078. _this.emit("error", { type: "WebSocketError", error: error });
  40079. },
  40080. closed: function (closeEvent) {
  40081. unbindListeners();
  40082. if (closeEvent && closeEvent.code) {
  40083. _this.handleCloseEvent(closeEvent);
  40084. }
  40085. _this.transport = null;
  40086. _this.emit("closed");
  40087. }
  40088. };
  40089. var unbindListeners = function () {
  40090. objectApply(listeners, function (listener, event) {
  40091. _this.transport.unbind(event, listener);
  40092. });
  40093. };
  40094. objectApply(listeners, function (listener, event) {
  40095. _this.transport.bind(event, listener);
  40096. });
  40097. };
  40098. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40099. var action = protocol_protocol.getCloseAction(closeEvent);
  40100. var error = protocol_protocol.getCloseError(closeEvent);
  40101. if (error) {
  40102. this.emit('error', error);
  40103. }
  40104. if (action) {
  40105. this.emit(action, { action: action, error: error });
  40106. }
  40107. };
  40108. return Connection;
  40109. }(dispatcher));
  40110. /* harmony default export */ var connection_connection = (connection_Connection);
  40111. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40112. var handshake_Handshake = (function () {
  40113. function Handshake(transport, callback) {
  40114. this.transport = transport;
  40115. this.callback = callback;
  40116. this.bindListeners();
  40117. }
  40118. Handshake.prototype.close = function () {
  40119. this.unbindListeners();
  40120. this.transport.close();
  40121. };
  40122. Handshake.prototype.bindListeners = function () {
  40123. var _this = this;
  40124. this.onMessage = function (m) {
  40125. _this.unbindListeners();
  40126. var result;
  40127. try {
  40128. result = protocol_protocol.processHandshake(m);
  40129. }
  40130. catch (e) {
  40131. _this.finish("error", { error: e });
  40132. _this.transport.close();
  40133. return;
  40134. }
  40135. if (result.action === "connected") {
  40136. _this.finish("connected", {
  40137. connection: new connection_connection(result.id, _this.transport),
  40138. activityTimeout: result.activityTimeout
  40139. });
  40140. }
  40141. else {
  40142. _this.finish(result.action, { error: result.error });
  40143. _this.transport.close();
  40144. }
  40145. };
  40146. this.onClosed = function (closeEvent) {
  40147. _this.unbindListeners();
  40148. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40149. var error = protocol_protocol.getCloseError(closeEvent);
  40150. _this.finish(action, { error: error });
  40151. };
  40152. this.transport.bind("message", this.onMessage);
  40153. this.transport.bind("closed", this.onClosed);
  40154. };
  40155. Handshake.prototype.unbindListeners = function () {
  40156. this.transport.unbind("message", this.onMessage);
  40157. this.transport.unbind("closed", this.onClosed);
  40158. };
  40159. Handshake.prototype.finish = function (action, params) {
  40160. this.callback(extend({ transport: this.transport, action: action }, params));
  40161. };
  40162. return Handshake;
  40163. }());
  40164. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40165. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40166. var pusher_authorizer_PusherAuthorizer = (function () {
  40167. function PusherAuthorizer(channel, options) {
  40168. this.channel = channel;
  40169. var authTransport = options.authTransport;
  40170. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40171. throw "'" + authTransport + "' is not a recognized auth transport";
  40172. }
  40173. this.type = authTransport;
  40174. this.options = options;
  40175. this.authOptions = (options || {}).auth || {};
  40176. }
  40177. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40178. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40179. '&channel_name=' + encodeURIComponent(this.channel.name);
  40180. for (var i in this.authOptions.params) {
  40181. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40182. }
  40183. return query;
  40184. };
  40185. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40186. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40187. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40188. };
  40189. return PusherAuthorizer;
  40190. }());
  40191. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40192. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40193. var timeline_sender_TimelineSender = (function () {
  40194. function TimelineSender(timeline, options) {
  40195. this.timeline = timeline;
  40196. this.options = options || {};
  40197. }
  40198. TimelineSender.prototype.send = function (useTLS, callback) {
  40199. if (this.timeline.isEmpty()) {
  40200. return;
  40201. }
  40202. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40203. };
  40204. return TimelineSender;
  40205. }());
  40206. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40207. // CONCATENATED MODULE: ./src/core/errors.ts
  40208. var errors_extends = (undefined && undefined.__extends) || (function () {
  40209. var extendStatics = function (d, b) {
  40210. extendStatics = Object.setPrototypeOf ||
  40211. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40212. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40213. return extendStatics(d, b);
  40214. };
  40215. return function (d, b) {
  40216. extendStatics(d, b);
  40217. function __() { this.constructor = d; }
  40218. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40219. };
  40220. })();
  40221. var BadEventName = (function (_super) {
  40222. errors_extends(BadEventName, _super);
  40223. function BadEventName(msg) {
  40224. var _newTarget = this.constructor;
  40225. var _this = _super.call(this, msg) || this;
  40226. Object.setPrototypeOf(_this, _newTarget.prototype);
  40227. return _this;
  40228. }
  40229. return BadEventName;
  40230. }(Error));
  40231. var RequestTimedOut = (function (_super) {
  40232. errors_extends(RequestTimedOut, _super);
  40233. function RequestTimedOut(msg) {
  40234. var _newTarget = this.constructor;
  40235. var _this = _super.call(this, msg) || this;
  40236. Object.setPrototypeOf(_this, _newTarget.prototype);
  40237. return _this;
  40238. }
  40239. return RequestTimedOut;
  40240. }(Error));
  40241. var TransportPriorityTooLow = (function (_super) {
  40242. errors_extends(TransportPriorityTooLow, _super);
  40243. function TransportPriorityTooLow(msg) {
  40244. var _newTarget = this.constructor;
  40245. var _this = _super.call(this, msg) || this;
  40246. Object.setPrototypeOf(_this, _newTarget.prototype);
  40247. return _this;
  40248. }
  40249. return TransportPriorityTooLow;
  40250. }(Error));
  40251. var TransportClosed = (function (_super) {
  40252. errors_extends(TransportClosed, _super);
  40253. function TransportClosed(msg) {
  40254. var _newTarget = this.constructor;
  40255. var _this = _super.call(this, msg) || this;
  40256. Object.setPrototypeOf(_this, _newTarget.prototype);
  40257. return _this;
  40258. }
  40259. return TransportClosed;
  40260. }(Error));
  40261. var UnsupportedFeature = (function (_super) {
  40262. errors_extends(UnsupportedFeature, _super);
  40263. function UnsupportedFeature(msg) {
  40264. var _newTarget = this.constructor;
  40265. var _this = _super.call(this, msg) || this;
  40266. Object.setPrototypeOf(_this, _newTarget.prototype);
  40267. return _this;
  40268. }
  40269. return UnsupportedFeature;
  40270. }(Error));
  40271. var UnsupportedTransport = (function (_super) {
  40272. errors_extends(UnsupportedTransport, _super);
  40273. function UnsupportedTransport(msg) {
  40274. var _newTarget = this.constructor;
  40275. var _this = _super.call(this, msg) || this;
  40276. Object.setPrototypeOf(_this, _newTarget.prototype);
  40277. return _this;
  40278. }
  40279. return UnsupportedTransport;
  40280. }(Error));
  40281. var UnsupportedStrategy = (function (_super) {
  40282. errors_extends(UnsupportedStrategy, _super);
  40283. function UnsupportedStrategy(msg) {
  40284. var _newTarget = this.constructor;
  40285. var _this = _super.call(this, msg) || this;
  40286. Object.setPrototypeOf(_this, _newTarget.prototype);
  40287. return _this;
  40288. }
  40289. return UnsupportedStrategy;
  40290. }(Error));
  40291. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40292. var channel_extends = (undefined && undefined.__extends) || (function () {
  40293. var extendStatics = function (d, b) {
  40294. extendStatics = Object.setPrototypeOf ||
  40295. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40296. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40297. return extendStatics(d, b);
  40298. };
  40299. return function (d, b) {
  40300. extendStatics(d, b);
  40301. function __() { this.constructor = d; }
  40302. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40303. };
  40304. })();
  40305. var channel_Channel = (function (_super) {
  40306. channel_extends(Channel, _super);
  40307. function Channel(name, pusher) {
  40308. var _this = _super.call(this, function (event, data) {
  40309. logger.debug('No callbacks on ' + name + ' for ' + event);
  40310. }) || this;
  40311. _this.name = name;
  40312. _this.pusher = pusher;
  40313. _this.subscribed = false;
  40314. _this.subscriptionPending = false;
  40315. _this.subscriptionCancelled = false;
  40316. return _this;
  40317. }
  40318. Channel.prototype.authorize = function (socketId, callback) {
  40319. return callback(false, {});
  40320. };
  40321. Channel.prototype.trigger = function (event, data) {
  40322. if (event.indexOf("client-") !== 0) {
  40323. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40324. }
  40325. if (!this.subscribed) {
  40326. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40327. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40328. }
  40329. return this.pusher.send_event(event, data, this.name);
  40330. };
  40331. Channel.prototype.disconnect = function () {
  40332. this.subscribed = false;
  40333. this.subscriptionPending = false;
  40334. };
  40335. Channel.prototype.handleEvent = function (event) {
  40336. var eventName = event.event;
  40337. var data = event.data;
  40338. if (eventName === "pusher_internal:subscription_succeeded") {
  40339. this.handleSubscriptionSucceededEvent(event);
  40340. }
  40341. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40342. var metadata = {};
  40343. this.emit(eventName, data, metadata);
  40344. }
  40345. };
  40346. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40347. this.subscriptionPending = false;
  40348. this.subscribed = true;
  40349. if (this.subscriptionCancelled) {
  40350. this.pusher.unsubscribe(this.name);
  40351. }
  40352. else {
  40353. this.emit("pusher:subscription_succeeded", event.data);
  40354. }
  40355. };
  40356. Channel.prototype.subscribe = function () {
  40357. var _this = this;
  40358. if (this.subscribed) {
  40359. return;
  40360. }
  40361. this.subscriptionPending = true;
  40362. this.subscriptionCancelled = false;
  40363. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40364. if (error) {
  40365. logger.error(data);
  40366. _this.emit('pusher:subscription_error', data);
  40367. }
  40368. else {
  40369. _this.pusher.send_event('pusher:subscribe', {
  40370. auth: data.auth,
  40371. channel_data: data.channel_data,
  40372. channel: _this.name
  40373. });
  40374. }
  40375. });
  40376. };
  40377. Channel.prototype.unsubscribe = function () {
  40378. this.subscribed = false;
  40379. this.pusher.send_event('pusher:unsubscribe', {
  40380. channel: this.name
  40381. });
  40382. };
  40383. Channel.prototype.cancelSubscription = function () {
  40384. this.subscriptionCancelled = true;
  40385. };
  40386. Channel.prototype.reinstateSubscription = function () {
  40387. this.subscriptionCancelled = false;
  40388. };
  40389. return Channel;
  40390. }(dispatcher));
  40391. /* harmony default export */ var channels_channel = (channel_Channel);
  40392. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40393. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40394. var extendStatics = function (d, b) {
  40395. extendStatics = Object.setPrototypeOf ||
  40396. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40397. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40398. return extendStatics(d, b);
  40399. };
  40400. return function (d, b) {
  40401. extendStatics(d, b);
  40402. function __() { this.constructor = d; }
  40403. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40404. };
  40405. })();
  40406. var private_channel_PrivateChannel = (function (_super) {
  40407. private_channel_extends(PrivateChannel, _super);
  40408. function PrivateChannel() {
  40409. return _super !== null && _super.apply(this, arguments) || this;
  40410. }
  40411. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40412. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40413. return authorizer.authorize(socketId, callback);
  40414. };
  40415. return PrivateChannel;
  40416. }(channels_channel));
  40417. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40418. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40419. var members_Members = (function () {
  40420. function Members() {
  40421. this.reset();
  40422. }
  40423. Members.prototype.get = function (id) {
  40424. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40425. return {
  40426. id: id,
  40427. info: this.members[id]
  40428. };
  40429. }
  40430. else {
  40431. return null;
  40432. }
  40433. };
  40434. Members.prototype.each = function (callback) {
  40435. var _this = this;
  40436. objectApply(this.members, function (member, id) {
  40437. callback(_this.get(id));
  40438. });
  40439. };
  40440. Members.prototype.setMyID = function (id) {
  40441. this.myID = id;
  40442. };
  40443. Members.prototype.onSubscription = function (subscriptionData) {
  40444. this.members = subscriptionData.presence.hash;
  40445. this.count = subscriptionData.presence.count;
  40446. this.me = this.get(this.myID);
  40447. };
  40448. Members.prototype.addMember = function (memberData) {
  40449. if (this.get(memberData.user_id) === null) {
  40450. this.count++;
  40451. }
  40452. this.members[memberData.user_id] = memberData.user_info;
  40453. return this.get(memberData.user_id);
  40454. };
  40455. Members.prototype.removeMember = function (memberData) {
  40456. var member = this.get(memberData.user_id);
  40457. if (member) {
  40458. delete this.members[memberData.user_id];
  40459. this.count--;
  40460. }
  40461. return member;
  40462. };
  40463. Members.prototype.reset = function () {
  40464. this.members = {};
  40465. this.count = 0;
  40466. this.myID = null;
  40467. this.me = null;
  40468. };
  40469. return Members;
  40470. }());
  40471. /* harmony default export */ var members = (members_Members);
  40472. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40473. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40474. var extendStatics = function (d, b) {
  40475. extendStatics = Object.setPrototypeOf ||
  40476. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40477. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40478. return extendStatics(d, b);
  40479. };
  40480. return function (d, b) {
  40481. extendStatics(d, b);
  40482. function __() { this.constructor = d; }
  40483. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40484. };
  40485. })();
  40486. var presence_channel_PresenceChannel = (function (_super) {
  40487. presence_channel_extends(PresenceChannel, _super);
  40488. function PresenceChannel(name, pusher) {
  40489. var _this = _super.call(this, name, pusher) || this;
  40490. _this.members = new members();
  40491. return _this;
  40492. }
  40493. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40494. var _this = this;
  40495. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40496. if (!error) {
  40497. if (authData.channel_data === undefined) {
  40498. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40499. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40500. ("expected 'channel_data' field. " + suffix));
  40501. callback("Invalid auth response");
  40502. return;
  40503. }
  40504. var channelData = JSON.parse(authData.channel_data);
  40505. _this.members.setMyID(channelData.user_id);
  40506. }
  40507. callback(error, authData);
  40508. });
  40509. };
  40510. PresenceChannel.prototype.handleEvent = function (event) {
  40511. var eventName = event.event;
  40512. if (eventName.indexOf("pusher_internal:") === 0) {
  40513. this.handleInternalEvent(event);
  40514. }
  40515. else {
  40516. var data = event.data;
  40517. var metadata = {};
  40518. if (event.user_id) {
  40519. metadata.user_id = event.user_id;
  40520. }
  40521. this.emit(eventName, data, metadata);
  40522. }
  40523. };
  40524. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40525. var eventName = event.event;
  40526. var data = event.data;
  40527. switch (eventName) {
  40528. case "pusher_internal:subscription_succeeded":
  40529. this.handleSubscriptionSucceededEvent(event);
  40530. break;
  40531. case "pusher_internal:member_added":
  40532. var addedMember = this.members.addMember(data);
  40533. this.emit('pusher:member_added', addedMember);
  40534. break;
  40535. case "pusher_internal:member_removed":
  40536. var removedMember = this.members.removeMember(data);
  40537. if (removedMember) {
  40538. this.emit('pusher:member_removed', removedMember);
  40539. }
  40540. break;
  40541. }
  40542. };
  40543. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40544. this.subscriptionPending = false;
  40545. this.subscribed = true;
  40546. if (this.subscriptionCancelled) {
  40547. this.pusher.unsubscribe(this.name);
  40548. }
  40549. else {
  40550. this.members.onSubscription(event.data);
  40551. this.emit("pusher:subscription_succeeded", this.members);
  40552. }
  40553. };
  40554. PresenceChannel.prototype.disconnect = function () {
  40555. this.members.reset();
  40556. _super.prototype.disconnect.call(this);
  40557. };
  40558. return PresenceChannel;
  40559. }(private_channel));
  40560. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40561. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40562. var nacl_fast = __webpack_require__(0);
  40563. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40564. var nacl_util = __webpack_require__(1);
  40565. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40566. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40567. var extendStatics = function (d, b) {
  40568. extendStatics = Object.setPrototypeOf ||
  40569. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40570. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40571. return extendStatics(d, b);
  40572. };
  40573. return function (d, b) {
  40574. extendStatics(d, b);
  40575. function __() { this.constructor = d; }
  40576. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40577. };
  40578. })();
  40579. var encrypted_channel_EncryptedChannel = (function (_super) {
  40580. encrypted_channel_extends(EncryptedChannel, _super);
  40581. function EncryptedChannel() {
  40582. var _this = _super !== null && _super.apply(this, arguments) || this;
  40583. _this.key = null;
  40584. return _this;
  40585. }
  40586. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40587. var _this = this;
  40588. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40589. if (error) {
  40590. callback(true, authData);
  40591. return;
  40592. }
  40593. var sharedSecret = authData["shared_secret"];
  40594. if (!sharedSecret) {
  40595. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40596. callback(true, errorMsg);
  40597. return;
  40598. }
  40599. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40600. delete authData["shared_secret"];
  40601. callback(false, authData);
  40602. });
  40603. };
  40604. EncryptedChannel.prototype.trigger = function (event, data) {
  40605. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40606. };
  40607. EncryptedChannel.prototype.handleEvent = function (event) {
  40608. var eventName = event.event;
  40609. var data = event.data;
  40610. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40611. _super.prototype.handleEvent.call(this, event);
  40612. return;
  40613. }
  40614. this.handleEncryptedEvent(eventName, data);
  40615. };
  40616. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40617. var _this = this;
  40618. if (!this.key) {
  40619. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40620. return;
  40621. }
  40622. if (!data.ciphertext || !data.nonce) {
  40623. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40624. return;
  40625. }
  40626. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40627. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40628. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40629. return;
  40630. }
  40631. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40632. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40633. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40634. return;
  40635. }
  40636. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40637. if (bytes === null) {
  40638. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40639. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40640. if (error) {
  40641. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40642. return;
  40643. }
  40644. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40645. if (bytes === null) {
  40646. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40647. return;
  40648. }
  40649. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40650. return;
  40651. });
  40652. return;
  40653. }
  40654. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40655. };
  40656. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40657. try {
  40658. this.emit(eventName, JSON.parse(data));
  40659. }
  40660. catch (e) {
  40661. this.emit(eventName, data);
  40662. }
  40663. return this;
  40664. };
  40665. return EncryptedChannel;
  40666. }(private_channel));
  40667. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40668. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40669. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40670. var extendStatics = function (d, b) {
  40671. extendStatics = Object.setPrototypeOf ||
  40672. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40673. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40674. return extendStatics(d, b);
  40675. };
  40676. return function (d, b) {
  40677. extendStatics(d, b);
  40678. function __() { this.constructor = d; }
  40679. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40680. };
  40681. })();
  40682. var connection_manager_ConnectionManager = (function (_super) {
  40683. connection_manager_extends(ConnectionManager, _super);
  40684. function ConnectionManager(key, options) {
  40685. var _this = _super.call(this) || this;
  40686. _this.key = key;
  40687. _this.options = options || {};
  40688. _this.state = "initialized";
  40689. _this.connection = null;
  40690. _this.usingTLS = !!options.useTLS;
  40691. _this.timeline = _this.options.timeline;
  40692. _this.errorCallbacks = _this.buildErrorCallbacks();
  40693. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40694. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40695. var Network = runtime.getNetwork();
  40696. Network.bind("online", function () {
  40697. _this.timeline.info({ netinfo: "online" });
  40698. if (_this.state === "connecting" || _this.state === "unavailable") {
  40699. _this.retryIn(0);
  40700. }
  40701. });
  40702. Network.bind("offline", function () {
  40703. _this.timeline.info({ netinfo: "offline" });
  40704. if (_this.connection) {
  40705. _this.sendActivityCheck();
  40706. }
  40707. });
  40708. _this.updateStrategy();
  40709. return _this;
  40710. }
  40711. ConnectionManager.prototype.connect = function () {
  40712. if (this.connection || this.runner) {
  40713. return;
  40714. }
  40715. if (!this.strategy.isSupported()) {
  40716. this.updateState("failed");
  40717. return;
  40718. }
  40719. this.updateState("connecting");
  40720. this.startConnecting();
  40721. this.setUnavailableTimer();
  40722. };
  40723. ;
  40724. ConnectionManager.prototype.send = function (data) {
  40725. if (this.connection) {
  40726. return this.connection.send(data);
  40727. }
  40728. else {
  40729. return false;
  40730. }
  40731. };
  40732. ;
  40733. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40734. if (this.connection) {
  40735. return this.connection.send_event(name, data, channel);
  40736. }
  40737. else {
  40738. return false;
  40739. }
  40740. };
  40741. ;
  40742. ConnectionManager.prototype.disconnect = function () {
  40743. this.disconnectInternally();
  40744. this.updateState("disconnected");
  40745. };
  40746. ;
  40747. ConnectionManager.prototype.isUsingTLS = function () {
  40748. return this.usingTLS;
  40749. };
  40750. ;
  40751. ConnectionManager.prototype.startConnecting = function () {
  40752. var _this = this;
  40753. var callback = function (error, handshake) {
  40754. if (error) {
  40755. _this.runner = _this.strategy.connect(0, callback);
  40756. }
  40757. else {
  40758. if (handshake.action === "error") {
  40759. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40760. _this.timeline.error({ handshakeError: handshake.error });
  40761. }
  40762. else {
  40763. _this.abortConnecting();
  40764. _this.handshakeCallbacks[handshake.action](handshake);
  40765. }
  40766. }
  40767. };
  40768. this.runner = this.strategy.connect(0, callback);
  40769. };
  40770. ;
  40771. ConnectionManager.prototype.abortConnecting = function () {
  40772. if (this.runner) {
  40773. this.runner.abort();
  40774. this.runner = null;
  40775. }
  40776. };
  40777. ;
  40778. ConnectionManager.prototype.disconnectInternally = function () {
  40779. this.abortConnecting();
  40780. this.clearRetryTimer();
  40781. this.clearUnavailableTimer();
  40782. if (this.connection) {
  40783. var connection = this.abandonConnection();
  40784. connection.close();
  40785. }
  40786. };
  40787. ;
  40788. ConnectionManager.prototype.updateStrategy = function () {
  40789. this.strategy = this.options.getStrategy({
  40790. key: this.key,
  40791. timeline: this.timeline,
  40792. useTLS: this.usingTLS
  40793. });
  40794. };
  40795. ;
  40796. ConnectionManager.prototype.retryIn = function (delay) {
  40797. var _this = this;
  40798. this.timeline.info({ action: "retry", delay: delay });
  40799. if (delay > 0) {
  40800. this.emit("connecting_in", Math.round(delay / 1000));
  40801. }
  40802. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40803. _this.disconnectInternally();
  40804. _this.connect();
  40805. });
  40806. };
  40807. ;
  40808. ConnectionManager.prototype.clearRetryTimer = function () {
  40809. if (this.retryTimer) {
  40810. this.retryTimer.ensureAborted();
  40811. this.retryTimer = null;
  40812. }
  40813. };
  40814. ;
  40815. ConnectionManager.prototype.setUnavailableTimer = function () {
  40816. var _this = this;
  40817. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40818. _this.updateState("unavailable");
  40819. });
  40820. };
  40821. ;
  40822. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40823. if (this.unavailableTimer) {
  40824. this.unavailableTimer.ensureAborted();
  40825. }
  40826. };
  40827. ;
  40828. ConnectionManager.prototype.sendActivityCheck = function () {
  40829. var _this = this;
  40830. this.stopActivityCheck();
  40831. this.connection.ping();
  40832. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40833. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40834. _this.retryIn(0);
  40835. });
  40836. };
  40837. ;
  40838. ConnectionManager.prototype.resetActivityCheck = function () {
  40839. var _this = this;
  40840. this.stopActivityCheck();
  40841. if (this.connection && !this.connection.handlesActivityChecks()) {
  40842. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40843. _this.sendActivityCheck();
  40844. });
  40845. }
  40846. };
  40847. ;
  40848. ConnectionManager.prototype.stopActivityCheck = function () {
  40849. if (this.activityTimer) {
  40850. this.activityTimer.ensureAborted();
  40851. }
  40852. };
  40853. ;
  40854. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40855. var _this = this;
  40856. return extend({}, errorCallbacks, {
  40857. message: function (message) {
  40858. _this.resetActivityCheck();
  40859. _this.emit('message', message);
  40860. },
  40861. ping: function () {
  40862. _this.send_event('pusher:pong', {});
  40863. },
  40864. activity: function () {
  40865. _this.resetActivityCheck();
  40866. },
  40867. error: function (error) {
  40868. _this.emit("error", { type: "WebSocketError", error: error });
  40869. },
  40870. closed: function () {
  40871. _this.abandonConnection();
  40872. if (_this.shouldRetry()) {
  40873. _this.retryIn(1000);
  40874. }
  40875. }
  40876. });
  40877. };
  40878. ;
  40879. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40880. var _this = this;
  40881. return extend({}, errorCallbacks, {
  40882. connected: function (handshake) {
  40883. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40884. _this.clearUnavailableTimer();
  40885. _this.setConnection(handshake.connection);
  40886. _this.socket_id = _this.connection.id;
  40887. _this.updateState("connected", { socket_id: _this.socket_id });
  40888. }
  40889. });
  40890. };
  40891. ;
  40892. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40893. var _this = this;
  40894. var withErrorEmitted = function (callback) {
  40895. return function (result) {
  40896. if (result.error) {
  40897. _this.emit("error", { type: "WebSocketError", error: result.error });
  40898. }
  40899. callback(result);
  40900. };
  40901. };
  40902. return {
  40903. tls_only: withErrorEmitted(function () {
  40904. _this.usingTLS = true;
  40905. _this.updateStrategy();
  40906. _this.retryIn(0);
  40907. }),
  40908. refused: withErrorEmitted(function () {
  40909. _this.disconnect();
  40910. }),
  40911. backoff: withErrorEmitted(function () {
  40912. _this.retryIn(1000);
  40913. }),
  40914. retry: withErrorEmitted(function () {
  40915. _this.retryIn(0);
  40916. })
  40917. };
  40918. };
  40919. ;
  40920. ConnectionManager.prototype.setConnection = function (connection) {
  40921. this.connection = connection;
  40922. for (var event in this.connectionCallbacks) {
  40923. this.connection.bind(event, this.connectionCallbacks[event]);
  40924. }
  40925. this.resetActivityCheck();
  40926. };
  40927. ;
  40928. ConnectionManager.prototype.abandonConnection = function () {
  40929. if (!this.connection) {
  40930. return;
  40931. }
  40932. this.stopActivityCheck();
  40933. for (var event in this.connectionCallbacks) {
  40934. this.connection.unbind(event, this.connectionCallbacks[event]);
  40935. }
  40936. var connection = this.connection;
  40937. this.connection = null;
  40938. return connection;
  40939. };
  40940. ConnectionManager.prototype.updateState = function (newState, data) {
  40941. var previousState = this.state;
  40942. this.state = newState;
  40943. if (previousState !== newState) {
  40944. var newStateDescription = newState;
  40945. if (newStateDescription === "connected") {
  40946. newStateDescription += " with new socket ID " + data.socket_id;
  40947. }
  40948. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  40949. this.timeline.info({ state: newState, params: data });
  40950. this.emit('state_change', { previous: previousState, current: newState });
  40951. this.emit(newState, data);
  40952. }
  40953. };
  40954. ConnectionManager.prototype.shouldRetry = function () {
  40955. return this.state === "connecting" || this.state === "connected";
  40956. };
  40957. return ConnectionManager;
  40958. }(dispatcher));
  40959. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  40960. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  40961. var channels_Channels = (function () {
  40962. function Channels() {
  40963. this.channels = {};
  40964. }
  40965. Channels.prototype.add = function (name, pusher) {
  40966. if (!this.channels[name]) {
  40967. this.channels[name] = createChannel(name, pusher);
  40968. }
  40969. return this.channels[name];
  40970. };
  40971. Channels.prototype.all = function () {
  40972. return values(this.channels);
  40973. };
  40974. Channels.prototype.find = function (name) {
  40975. return this.channels[name];
  40976. };
  40977. Channels.prototype.remove = function (name) {
  40978. var channel = this.channels[name];
  40979. delete this.channels[name];
  40980. return channel;
  40981. };
  40982. Channels.prototype.disconnect = function () {
  40983. objectApply(this.channels, function (channel) {
  40984. channel.disconnect();
  40985. });
  40986. };
  40987. return Channels;
  40988. }());
  40989. /* harmony default export */ var channels = (channels_Channels);
  40990. function createChannel(name, pusher) {
  40991. if (name.indexOf('private-encrypted-') === 0) {
  40992. if (false) { var errorMsg; }
  40993. return factory.createEncryptedChannel(name, pusher);
  40994. }
  40995. else if (name.indexOf('private-') === 0) {
  40996. return factory.createPrivateChannel(name, pusher);
  40997. }
  40998. else if (name.indexOf('presence-') === 0) {
  40999. return factory.createPresenceChannel(name, pusher);
  41000. }
  41001. else {
  41002. return factory.createChannel(name, pusher);
  41003. }
  41004. }
  41005. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41006. var Factory = {
  41007. createChannels: function () {
  41008. return new channels();
  41009. },
  41010. createConnectionManager: function (key, options) {
  41011. return new connection_manager(key, options);
  41012. },
  41013. createChannel: function (name, pusher) {
  41014. return new channels_channel(name, pusher);
  41015. },
  41016. createPrivateChannel: function (name, pusher) {
  41017. return new private_channel(name, pusher);
  41018. },
  41019. createPresenceChannel: function (name, pusher) {
  41020. return new presence_channel(name, pusher);
  41021. },
  41022. createEncryptedChannel: function (name, pusher) {
  41023. return new encrypted_channel(name, pusher);
  41024. },
  41025. createTimelineSender: function (timeline, options) {
  41026. return new timeline_sender(timeline, options);
  41027. },
  41028. createAuthorizer: function (channel, options) {
  41029. if (options.authorizer) {
  41030. return options.authorizer(channel, options);
  41031. }
  41032. return new pusher_authorizer(channel, options);
  41033. },
  41034. createHandshake: function (transport, callback) {
  41035. return new connection_handshake(transport, callback);
  41036. },
  41037. createAssistantToTheTransportManager: function (manager, transport, options) {
  41038. return new assistant_to_the_transport_manager(manager, transport, options);
  41039. }
  41040. };
  41041. /* harmony default export */ var factory = (Factory);
  41042. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41043. var transport_manager_TransportManager = (function () {
  41044. function TransportManager(options) {
  41045. this.options = options || {};
  41046. this.livesLeft = this.options.lives || Infinity;
  41047. }
  41048. TransportManager.prototype.getAssistant = function (transport) {
  41049. return factory.createAssistantToTheTransportManager(this, transport, {
  41050. minPingDelay: this.options.minPingDelay,
  41051. maxPingDelay: this.options.maxPingDelay
  41052. });
  41053. };
  41054. TransportManager.prototype.isAlive = function () {
  41055. return this.livesLeft > 0;
  41056. };
  41057. TransportManager.prototype.reportDeath = function () {
  41058. this.livesLeft -= 1;
  41059. };
  41060. return TransportManager;
  41061. }());
  41062. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41063. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41064. var sequential_strategy_SequentialStrategy = (function () {
  41065. function SequentialStrategy(strategies, options) {
  41066. this.strategies = strategies;
  41067. this.loop = Boolean(options.loop);
  41068. this.failFast = Boolean(options.failFast);
  41069. this.timeout = options.timeout;
  41070. this.timeoutLimit = options.timeoutLimit;
  41071. }
  41072. SequentialStrategy.prototype.isSupported = function () {
  41073. return any(this.strategies, util.method("isSupported"));
  41074. };
  41075. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41076. var _this = this;
  41077. var strategies = this.strategies;
  41078. var current = 0;
  41079. var timeout = this.timeout;
  41080. var runner = null;
  41081. var tryNextStrategy = function (error, handshake) {
  41082. if (handshake) {
  41083. callback(null, handshake);
  41084. }
  41085. else {
  41086. current = current + 1;
  41087. if (_this.loop) {
  41088. current = current % strategies.length;
  41089. }
  41090. if (current < strategies.length) {
  41091. if (timeout) {
  41092. timeout = timeout * 2;
  41093. if (_this.timeoutLimit) {
  41094. timeout = Math.min(timeout, _this.timeoutLimit);
  41095. }
  41096. }
  41097. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41098. }
  41099. else {
  41100. callback(true);
  41101. }
  41102. }
  41103. };
  41104. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41105. return {
  41106. abort: function () {
  41107. runner.abort();
  41108. },
  41109. forceMinPriority: function (p) {
  41110. minPriority = p;
  41111. if (runner) {
  41112. runner.forceMinPriority(p);
  41113. }
  41114. }
  41115. };
  41116. };
  41117. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41118. var timer = null;
  41119. var runner = null;
  41120. if (options.timeout > 0) {
  41121. timer = new OneOffTimer(options.timeout, function () {
  41122. runner.abort();
  41123. callback(true);
  41124. });
  41125. }
  41126. runner = strategy.connect(minPriority, function (error, handshake) {
  41127. if (error && timer && timer.isRunning() && !options.failFast) {
  41128. return;
  41129. }
  41130. if (timer) {
  41131. timer.ensureAborted();
  41132. }
  41133. callback(error, handshake);
  41134. });
  41135. return {
  41136. abort: function () {
  41137. if (timer) {
  41138. timer.ensureAborted();
  41139. }
  41140. runner.abort();
  41141. },
  41142. forceMinPriority: function (p) {
  41143. runner.forceMinPriority(p);
  41144. }
  41145. };
  41146. };
  41147. return SequentialStrategy;
  41148. }());
  41149. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41150. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41151. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41152. function BestConnectedEverStrategy(strategies) {
  41153. this.strategies = strategies;
  41154. }
  41155. BestConnectedEverStrategy.prototype.isSupported = function () {
  41156. return any(this.strategies, util.method("isSupported"));
  41157. };
  41158. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41159. return connect(this.strategies, minPriority, function (i, runners) {
  41160. return function (error, handshake) {
  41161. runners[i].error = error;
  41162. if (error) {
  41163. if (allRunnersFailed(runners)) {
  41164. callback(true);
  41165. }
  41166. return;
  41167. }
  41168. apply(runners, function (runner) {
  41169. runner.forceMinPriority(handshake.transport.priority);
  41170. });
  41171. callback(null, handshake);
  41172. };
  41173. });
  41174. };
  41175. return BestConnectedEverStrategy;
  41176. }());
  41177. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41178. function connect(strategies, minPriority, callbackBuilder) {
  41179. var runners = map(strategies, function (strategy, i, _, rs) {
  41180. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41181. });
  41182. return {
  41183. abort: function () {
  41184. apply(runners, abortRunner);
  41185. },
  41186. forceMinPriority: function (p) {
  41187. apply(runners, function (runner) {
  41188. runner.forceMinPriority(p);
  41189. });
  41190. }
  41191. };
  41192. }
  41193. function allRunnersFailed(runners) {
  41194. return collections_all(runners, function (runner) {
  41195. return Boolean(runner.error);
  41196. });
  41197. }
  41198. function abortRunner(runner) {
  41199. if (!runner.error && !runner.aborted) {
  41200. runner.abort();
  41201. runner.aborted = true;
  41202. }
  41203. }
  41204. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41205. var cached_strategy_CachedStrategy = (function () {
  41206. function CachedStrategy(strategy, transports, options) {
  41207. this.strategy = strategy;
  41208. this.transports = transports;
  41209. this.ttl = options.ttl || 1800 * 1000;
  41210. this.usingTLS = options.useTLS;
  41211. this.timeline = options.timeline;
  41212. }
  41213. CachedStrategy.prototype.isSupported = function () {
  41214. return this.strategy.isSupported();
  41215. };
  41216. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41217. var usingTLS = this.usingTLS;
  41218. var info = fetchTransportCache(usingTLS);
  41219. var strategies = [this.strategy];
  41220. if (info && info.timestamp + this.ttl >= util.now()) {
  41221. var transport = this.transports[info.transport];
  41222. if (transport) {
  41223. this.timeline.info({
  41224. cached: true,
  41225. transport: info.transport,
  41226. latency: info.latency
  41227. });
  41228. strategies.push(new sequential_strategy([transport], {
  41229. timeout: info.latency * 2 + 1000,
  41230. failFast: true
  41231. }));
  41232. }
  41233. }
  41234. var startTimestamp = util.now();
  41235. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41236. if (error) {
  41237. flushTransportCache(usingTLS);
  41238. if (strategies.length > 0) {
  41239. startTimestamp = util.now();
  41240. runner = strategies.pop().connect(minPriority, cb);
  41241. }
  41242. else {
  41243. callback(error);
  41244. }
  41245. }
  41246. else {
  41247. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41248. callback(null, handshake);
  41249. }
  41250. });
  41251. return {
  41252. abort: function () {
  41253. runner.abort();
  41254. },
  41255. forceMinPriority: function (p) {
  41256. minPriority = p;
  41257. if (runner) {
  41258. runner.forceMinPriority(p);
  41259. }
  41260. }
  41261. };
  41262. };
  41263. return CachedStrategy;
  41264. }());
  41265. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41266. function getTransportCacheKey(usingTLS) {
  41267. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41268. }
  41269. function fetchTransportCache(usingTLS) {
  41270. var storage = runtime.getLocalStorage();
  41271. if (storage) {
  41272. try {
  41273. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41274. if (serializedCache) {
  41275. return JSON.parse(serializedCache);
  41276. }
  41277. }
  41278. catch (e) {
  41279. flushTransportCache(usingTLS);
  41280. }
  41281. }
  41282. return null;
  41283. }
  41284. function storeTransportCache(usingTLS, transport, latency) {
  41285. var storage = runtime.getLocalStorage();
  41286. if (storage) {
  41287. try {
  41288. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41289. timestamp: util.now(),
  41290. transport: transport,
  41291. latency: latency
  41292. });
  41293. }
  41294. catch (e) {
  41295. }
  41296. }
  41297. }
  41298. function flushTransportCache(usingTLS) {
  41299. var storage = runtime.getLocalStorage();
  41300. if (storage) {
  41301. try {
  41302. delete storage[getTransportCacheKey(usingTLS)];
  41303. }
  41304. catch (e) {
  41305. }
  41306. }
  41307. }
  41308. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41309. var delayed_strategy_DelayedStrategy = (function () {
  41310. function DelayedStrategy(strategy, _a) {
  41311. var number = _a.delay;
  41312. this.strategy = strategy;
  41313. this.options = { delay: number };
  41314. }
  41315. DelayedStrategy.prototype.isSupported = function () {
  41316. return this.strategy.isSupported();
  41317. };
  41318. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41319. var strategy = this.strategy;
  41320. var runner;
  41321. var timer = new OneOffTimer(this.options.delay, function () {
  41322. runner = strategy.connect(minPriority, callback);
  41323. });
  41324. return {
  41325. abort: function () {
  41326. timer.ensureAborted();
  41327. if (runner) {
  41328. runner.abort();
  41329. }
  41330. },
  41331. forceMinPriority: function (p) {
  41332. minPriority = p;
  41333. if (runner) {
  41334. runner.forceMinPriority(p);
  41335. }
  41336. }
  41337. };
  41338. };
  41339. return DelayedStrategy;
  41340. }());
  41341. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41342. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41343. var IfStrategy = (function () {
  41344. function IfStrategy(test, trueBranch, falseBranch) {
  41345. this.test = test;
  41346. this.trueBranch = trueBranch;
  41347. this.falseBranch = falseBranch;
  41348. }
  41349. IfStrategy.prototype.isSupported = function () {
  41350. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41351. return branch.isSupported();
  41352. };
  41353. IfStrategy.prototype.connect = function (minPriority, callback) {
  41354. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41355. return branch.connect(minPriority, callback);
  41356. };
  41357. return IfStrategy;
  41358. }());
  41359. /* harmony default export */ var if_strategy = (IfStrategy);
  41360. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41361. var FirstConnectedStrategy = (function () {
  41362. function FirstConnectedStrategy(strategy) {
  41363. this.strategy = strategy;
  41364. }
  41365. FirstConnectedStrategy.prototype.isSupported = function () {
  41366. return this.strategy.isSupported();
  41367. };
  41368. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41369. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41370. if (handshake) {
  41371. runner.abort();
  41372. }
  41373. callback(error, handshake);
  41374. });
  41375. return runner;
  41376. };
  41377. return FirstConnectedStrategy;
  41378. }());
  41379. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41380. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41381. function testSupportsStrategy(strategy) {
  41382. return function () {
  41383. return strategy.isSupported();
  41384. };
  41385. }
  41386. var getDefaultStrategy = function (config, defineTransport) {
  41387. var definedTransports = {};
  41388. function defineTransportStrategy(name, type, priority, options, manager) {
  41389. var transport = defineTransport(config, name, type, priority, options, manager);
  41390. definedTransports[name] = transport;
  41391. return transport;
  41392. }
  41393. var ws_options = {
  41394. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41395. hostTLS: config.wsHost + ":" + config.wssPort,
  41396. httpPath: config.wsPath
  41397. };
  41398. var wss_options = extend({}, ws_options, {
  41399. useTLS: true
  41400. });
  41401. var sockjs_options = {
  41402. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41403. hostTLS: config.httpHost + ":" + config.httpsPort,
  41404. httpPath: config.httpPath
  41405. };
  41406. var timeouts = {
  41407. loop: true,
  41408. timeout: 15000,
  41409. timeoutLimit: 60000
  41410. };
  41411. var ws_manager = new transport_manager({
  41412. lives: 2,
  41413. minPingDelay: 10000,
  41414. maxPingDelay: config.activity_timeout
  41415. });
  41416. var streaming_manager = new transport_manager({
  41417. lives: 2,
  41418. minPingDelay: 10000,
  41419. maxPingDelay: config.activity_timeout
  41420. });
  41421. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41422. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41423. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41424. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41425. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41426. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41427. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41428. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41429. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41430. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41431. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41432. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41433. var http_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy([streaming_loop, new delayed_strategy(polling_loop, { delay: 4000 })]), polling_loop)], timeouts);
  41434. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41435. var wsStrategy;
  41436. if (config.useTLS) {
  41437. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41438. }
  41439. else {
  41440. wsStrategy = new best_connected_ever_strategy([
  41441. ws_loop,
  41442. new delayed_strategy(wss_loop, { delay: 2000 }),
  41443. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41444. ]);
  41445. }
  41446. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41447. ttl: 1800000,
  41448. timeline: config.timeline,
  41449. useTLS: config.useTLS
  41450. });
  41451. };
  41452. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41453. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41454. /* harmony default export */ var transport_connection_initializer = (function () {
  41455. var self = this;
  41456. self.timeline.info(self.buildTimelineMessage({
  41457. transport: self.name + (self.options.useTLS ? "s" : "")
  41458. }));
  41459. if (self.hooks.isInitialized()) {
  41460. self.changeState("initialized");
  41461. }
  41462. else if (self.hooks.file) {
  41463. self.changeState("initializing");
  41464. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41465. if (self.hooks.isInitialized()) {
  41466. self.changeState("initialized");
  41467. callback(true);
  41468. }
  41469. else {
  41470. if (error) {
  41471. self.onError(error);
  41472. }
  41473. self.onClose();
  41474. callback(false);
  41475. }
  41476. });
  41477. }
  41478. else {
  41479. self.onClose();
  41480. }
  41481. });
  41482. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41483. var http_xdomain_request_hooks = {
  41484. getRequest: function (socket) {
  41485. var xdr = new window.XDomainRequest();
  41486. xdr.ontimeout = function () {
  41487. socket.emit("error", new RequestTimedOut());
  41488. socket.close();
  41489. };
  41490. xdr.onerror = function (e) {
  41491. socket.emit("error", e);
  41492. socket.close();
  41493. };
  41494. xdr.onprogress = function () {
  41495. if (xdr.responseText && xdr.responseText.length > 0) {
  41496. socket.onChunk(200, xdr.responseText);
  41497. }
  41498. };
  41499. xdr.onload = function () {
  41500. if (xdr.responseText && xdr.responseText.length > 0) {
  41501. socket.onChunk(200, xdr.responseText);
  41502. }
  41503. socket.emit("finished", 200);
  41504. socket.close();
  41505. };
  41506. return xdr;
  41507. },
  41508. abortRequest: function (xdr) {
  41509. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41510. xdr.abort();
  41511. }
  41512. };
  41513. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41514. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41515. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41516. var extendStatics = function (d, b) {
  41517. extendStatics = Object.setPrototypeOf ||
  41518. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41519. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41520. return extendStatics(d, b);
  41521. };
  41522. return function (d, b) {
  41523. extendStatics(d, b);
  41524. function __() { this.constructor = d; }
  41525. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41526. };
  41527. })();
  41528. var MAX_BUFFER_LENGTH = 256 * 1024;
  41529. var http_request_HTTPRequest = (function (_super) {
  41530. http_request_extends(HTTPRequest, _super);
  41531. function HTTPRequest(hooks, method, url) {
  41532. var _this = _super.call(this) || this;
  41533. _this.hooks = hooks;
  41534. _this.method = method;
  41535. _this.url = url;
  41536. return _this;
  41537. }
  41538. HTTPRequest.prototype.start = function (payload) {
  41539. var _this = this;
  41540. this.position = 0;
  41541. this.xhr = this.hooks.getRequest(this);
  41542. this.unloader = function () {
  41543. _this.close();
  41544. };
  41545. runtime.addUnloadListener(this.unloader);
  41546. this.xhr.open(this.method, this.url, true);
  41547. if (this.xhr.setRequestHeader) {
  41548. this.xhr.setRequestHeader("Content-Type", "application/json");
  41549. }
  41550. this.xhr.send(payload);
  41551. };
  41552. HTTPRequest.prototype.close = function () {
  41553. if (this.unloader) {
  41554. runtime.removeUnloadListener(this.unloader);
  41555. this.unloader = null;
  41556. }
  41557. if (this.xhr) {
  41558. this.hooks.abortRequest(this.xhr);
  41559. this.xhr = null;
  41560. }
  41561. };
  41562. HTTPRequest.prototype.onChunk = function (status, data) {
  41563. while (true) {
  41564. var chunk = this.advanceBuffer(data);
  41565. if (chunk) {
  41566. this.emit("chunk", { status: status, data: chunk });
  41567. }
  41568. else {
  41569. break;
  41570. }
  41571. }
  41572. if (this.isBufferTooLong(data)) {
  41573. this.emit("buffer_too_long");
  41574. }
  41575. };
  41576. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41577. var unreadData = buffer.slice(this.position);
  41578. var endOfLinePosition = unreadData.indexOf("\n");
  41579. if (endOfLinePosition !== -1) {
  41580. this.position += endOfLinePosition + 1;
  41581. return unreadData.slice(0, endOfLinePosition);
  41582. }
  41583. else {
  41584. return null;
  41585. }
  41586. };
  41587. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41588. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41589. };
  41590. return HTTPRequest;
  41591. }(dispatcher));
  41592. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41593. // CONCATENATED MODULE: ./src/core/http/state.ts
  41594. var State;
  41595. (function (State) {
  41596. State[State["CONNECTING"] = 0] = "CONNECTING";
  41597. State[State["OPEN"] = 1] = "OPEN";
  41598. State[State["CLOSED"] = 3] = "CLOSED";
  41599. })(State || (State = {}));
  41600. /* harmony default export */ var state = (State);
  41601. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41602. var autoIncrement = 1;
  41603. var http_socket_HTTPSocket = (function () {
  41604. function HTTPSocket(hooks, url) {
  41605. this.hooks = hooks;
  41606. this.session = randomNumber(1000) + "/" + randomString(8);
  41607. this.location = getLocation(url);
  41608. this.readyState = state.CONNECTING;
  41609. this.openStream();
  41610. }
  41611. HTTPSocket.prototype.send = function (payload) {
  41612. return this.sendRaw(JSON.stringify([payload]));
  41613. };
  41614. HTTPSocket.prototype.ping = function () {
  41615. this.hooks.sendHeartbeat(this);
  41616. };
  41617. HTTPSocket.prototype.close = function (code, reason) {
  41618. this.onClose(code, reason, true);
  41619. };
  41620. HTTPSocket.prototype.sendRaw = function (payload) {
  41621. if (this.readyState === state.OPEN) {
  41622. try {
  41623. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41624. return true;
  41625. }
  41626. catch (e) {
  41627. return false;
  41628. }
  41629. }
  41630. else {
  41631. return false;
  41632. }
  41633. };
  41634. HTTPSocket.prototype.reconnect = function () {
  41635. this.closeStream();
  41636. this.openStream();
  41637. };
  41638. ;
  41639. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41640. this.closeStream();
  41641. this.readyState = state.CLOSED;
  41642. if (this.onclose) {
  41643. this.onclose({
  41644. code: code,
  41645. reason: reason,
  41646. wasClean: wasClean
  41647. });
  41648. }
  41649. };
  41650. HTTPSocket.prototype.onChunk = function (chunk) {
  41651. if (chunk.status !== 200) {
  41652. return;
  41653. }
  41654. if (this.readyState === state.OPEN) {
  41655. this.onActivity();
  41656. }
  41657. var payload;
  41658. var type = chunk.data.slice(0, 1);
  41659. switch (type) {
  41660. case 'o':
  41661. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41662. this.onOpen(payload);
  41663. break;
  41664. case 'a':
  41665. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41666. for (var i = 0; i < payload.length; i++) {
  41667. this.onEvent(payload[i]);
  41668. }
  41669. break;
  41670. case 'm':
  41671. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41672. this.onEvent(payload);
  41673. break;
  41674. case 'h':
  41675. this.hooks.onHeartbeat(this);
  41676. break;
  41677. case 'c':
  41678. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41679. this.onClose(payload[0], payload[1], true);
  41680. break;
  41681. }
  41682. };
  41683. HTTPSocket.prototype.onOpen = function (options) {
  41684. if (this.readyState === state.CONNECTING) {
  41685. if (options && options.hostname) {
  41686. this.location.base = replaceHost(this.location.base, options.hostname);
  41687. }
  41688. this.readyState = state.OPEN;
  41689. if (this.onopen) {
  41690. this.onopen();
  41691. }
  41692. }
  41693. else {
  41694. this.onClose(1006, "Server lost session", true);
  41695. }
  41696. };
  41697. HTTPSocket.prototype.onEvent = function (event) {
  41698. if (this.readyState === state.OPEN && this.onmessage) {
  41699. this.onmessage({ data: event });
  41700. }
  41701. };
  41702. HTTPSocket.prototype.onActivity = function () {
  41703. if (this.onactivity) {
  41704. this.onactivity();
  41705. }
  41706. };
  41707. HTTPSocket.prototype.onError = function (error) {
  41708. if (this.onerror) {
  41709. this.onerror(error);
  41710. }
  41711. };
  41712. HTTPSocket.prototype.openStream = function () {
  41713. var _this = this;
  41714. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41715. this.stream.bind("chunk", function (chunk) {
  41716. _this.onChunk(chunk);
  41717. });
  41718. this.stream.bind("finished", function (status) {
  41719. _this.hooks.onFinished(_this, status);
  41720. });
  41721. this.stream.bind("buffer_too_long", function () {
  41722. _this.reconnect();
  41723. });
  41724. try {
  41725. this.stream.start();
  41726. }
  41727. catch (error) {
  41728. util.defer(function () {
  41729. _this.onError(error);
  41730. _this.onClose(1006, "Could not start streaming", false);
  41731. });
  41732. }
  41733. };
  41734. HTTPSocket.prototype.closeStream = function () {
  41735. if (this.stream) {
  41736. this.stream.unbind_all();
  41737. this.stream.close();
  41738. this.stream = null;
  41739. }
  41740. };
  41741. return HTTPSocket;
  41742. }());
  41743. function getLocation(url) {
  41744. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41745. return {
  41746. base: parts[1],
  41747. queryString: parts[2]
  41748. };
  41749. }
  41750. function getSendURL(url, session) {
  41751. return url.base + "/" + session + "/xhr_send";
  41752. }
  41753. function getUniqueURL(url) {
  41754. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41755. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41756. }
  41757. function replaceHost(url, hostname) {
  41758. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41759. return urlParts[1] + hostname + urlParts[3];
  41760. }
  41761. function randomNumber(max) {
  41762. return Math.floor(Math.random() * max);
  41763. }
  41764. function randomString(length) {
  41765. var result = [];
  41766. for (var i = 0; i < length; i++) {
  41767. result.push(randomNumber(32).toString(32));
  41768. }
  41769. return result.join('');
  41770. }
  41771. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41772. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41773. var http_streaming_socket_hooks = {
  41774. getReceiveURL: function (url, session) {
  41775. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41776. },
  41777. onHeartbeat: function (socket) {
  41778. socket.sendRaw("[]");
  41779. },
  41780. sendHeartbeat: function (socket) {
  41781. socket.sendRaw("[]");
  41782. },
  41783. onFinished: function (socket, status) {
  41784. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41785. }
  41786. };
  41787. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41788. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41789. var http_polling_socket_hooks = {
  41790. getReceiveURL: function (url, session) {
  41791. return url.base + "/" + session + "/xhr" + url.queryString;
  41792. },
  41793. onHeartbeat: function () {
  41794. },
  41795. sendHeartbeat: function (socket) {
  41796. socket.sendRaw("[]");
  41797. },
  41798. onFinished: function (socket, status) {
  41799. if (status === 200) {
  41800. socket.reconnect();
  41801. }
  41802. else {
  41803. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41804. }
  41805. }
  41806. };
  41807. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41808. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41809. var http_xhr_request_hooks = {
  41810. getRequest: function (socket) {
  41811. var Constructor = runtime.getXHRAPI();
  41812. var xhr = new Constructor();
  41813. xhr.onreadystatechange = xhr.onprogress = function () {
  41814. switch (xhr.readyState) {
  41815. case 3:
  41816. if (xhr.responseText && xhr.responseText.length > 0) {
  41817. socket.onChunk(xhr.status, xhr.responseText);
  41818. }
  41819. break;
  41820. case 4:
  41821. if (xhr.responseText && xhr.responseText.length > 0) {
  41822. socket.onChunk(xhr.status, xhr.responseText);
  41823. }
  41824. socket.emit("finished", xhr.status);
  41825. socket.close();
  41826. break;
  41827. }
  41828. };
  41829. return xhr;
  41830. },
  41831. abortRequest: function (xhr) {
  41832. xhr.onreadystatechange = null;
  41833. xhr.abort();
  41834. }
  41835. };
  41836. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41837. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41838. var HTTP = {
  41839. createStreamingSocket: function (url) {
  41840. return this.createSocket(http_streaming_socket, url);
  41841. },
  41842. createPollingSocket: function (url) {
  41843. return this.createSocket(http_polling_socket, url);
  41844. },
  41845. createSocket: function (hooks, url) {
  41846. return new http_socket(hooks, url);
  41847. },
  41848. createXHR: function (method, url) {
  41849. return this.createRequest(http_xhr_request, method, url);
  41850. },
  41851. createRequest: function (hooks, method, url) {
  41852. return new http_request(hooks, method, url);
  41853. }
  41854. };
  41855. /* harmony default export */ var http_http = (HTTP);
  41856. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41857. http_http.createXDR = function (method, url) {
  41858. return this.createRequest(http_xdomain_request, method, url);
  41859. };
  41860. /* harmony default export */ var web_http_http = (http_http);
  41861. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41862. var Runtime = {
  41863. nextAuthCallbackID: 1,
  41864. auth_callbacks: {},
  41865. ScriptReceivers: ScriptReceivers,
  41866. DependenciesReceivers: DependenciesReceivers,
  41867. getDefaultStrategy: default_strategy,
  41868. Transports: transports_transports,
  41869. transportConnectionInitializer: transport_connection_initializer,
  41870. HTTPFactory: web_http_http,
  41871. TimelineTransport: jsonp_timeline,
  41872. getXHRAPI: function () {
  41873. return window.XMLHttpRequest;
  41874. },
  41875. getWebSocketAPI: function () {
  41876. return window.WebSocket || window.MozWebSocket;
  41877. },
  41878. setup: function (PusherClass) {
  41879. var _this = this;
  41880. window.Pusher = PusherClass;
  41881. var initializeOnDocumentBody = function () {
  41882. _this.onDocumentBody(PusherClass.ready);
  41883. };
  41884. if (!window.JSON) {
  41885. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41886. }
  41887. else {
  41888. initializeOnDocumentBody();
  41889. }
  41890. },
  41891. getDocument: function () {
  41892. return document;
  41893. },
  41894. getProtocol: function () {
  41895. return this.getDocument().location.protocol;
  41896. },
  41897. getAuthorizers: function () {
  41898. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41899. },
  41900. onDocumentBody: function (callback) {
  41901. var _this = this;
  41902. if (document.body) {
  41903. callback();
  41904. }
  41905. else {
  41906. setTimeout(function () {
  41907. _this.onDocumentBody(callback);
  41908. }, 0);
  41909. }
  41910. },
  41911. createJSONPRequest: function (url, data) {
  41912. return new jsonp_request(url, data);
  41913. },
  41914. createScriptRequest: function (src) {
  41915. return new script_request(src);
  41916. },
  41917. getLocalStorage: function () {
  41918. try {
  41919. return window.localStorage;
  41920. }
  41921. catch (e) {
  41922. return undefined;
  41923. }
  41924. },
  41925. createXHR: function () {
  41926. if (this.getXHRAPI()) {
  41927. return this.createXMLHttpRequest();
  41928. }
  41929. else {
  41930. return this.createMicrosoftXHR();
  41931. }
  41932. },
  41933. createXMLHttpRequest: function () {
  41934. var Constructor = this.getXHRAPI();
  41935. return new Constructor();
  41936. },
  41937. createMicrosoftXHR: function () {
  41938. return new ActiveXObject("Microsoft.XMLHTTP");
  41939. },
  41940. getNetwork: function () {
  41941. return net_info_Network;
  41942. },
  41943. createWebSocket: function (url) {
  41944. var Constructor = this.getWebSocketAPI();
  41945. return new Constructor(url);
  41946. },
  41947. createSocketRequest: function (method, url) {
  41948. if (this.isXHRSupported()) {
  41949. return this.HTTPFactory.createXHR(method, url);
  41950. }
  41951. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  41952. return this.HTTPFactory.createXDR(method, url);
  41953. }
  41954. else {
  41955. throw "Cross-origin HTTP requests are not supported";
  41956. }
  41957. },
  41958. isXHRSupported: function () {
  41959. var Constructor = this.getXHRAPI();
  41960. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  41961. },
  41962. isXDRSupported: function (useTLS) {
  41963. var protocol = useTLS ? "https:" : "http:";
  41964. var documentProtocol = this.getProtocol();
  41965. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  41966. },
  41967. addUnloadListener: function (listener) {
  41968. if (window.addEventListener !== undefined) {
  41969. window.addEventListener("unload", listener, false);
  41970. }
  41971. else if (window.attachEvent !== undefined) {
  41972. window.attachEvent("onunload", listener);
  41973. }
  41974. },
  41975. removeUnloadListener: function (listener) {
  41976. if (window.addEventListener !== undefined) {
  41977. window.removeEventListener("unload", listener, false);
  41978. }
  41979. else if (window.detachEvent !== undefined) {
  41980. window.detachEvent("onunload", listener);
  41981. }
  41982. }
  41983. };
  41984. /* harmony default export */ var runtime = (Runtime);
  41985. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  41986. var TimelineLevel;
  41987. (function (TimelineLevel) {
  41988. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  41989. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  41990. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  41991. })(TimelineLevel || (TimelineLevel = {}));
  41992. /* harmony default export */ var timeline_level = (TimelineLevel);
  41993. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  41994. var timeline_Timeline = (function () {
  41995. function Timeline(key, session, options) {
  41996. this.key = key;
  41997. this.session = session;
  41998. this.events = [];
  41999. this.options = options || {};
  42000. this.sent = 0;
  42001. this.uniqueID = 0;
  42002. }
  42003. Timeline.prototype.log = function (level, event) {
  42004. if (level <= this.options.level) {
  42005. this.events.push(extend({}, event, { timestamp: util.now() }));
  42006. if (this.options.limit && this.events.length > this.options.limit) {
  42007. this.events.shift();
  42008. }
  42009. }
  42010. };
  42011. Timeline.prototype.error = function (event) {
  42012. this.log(timeline_level.ERROR, event);
  42013. };
  42014. Timeline.prototype.info = function (event) {
  42015. this.log(timeline_level.INFO, event);
  42016. };
  42017. Timeline.prototype.debug = function (event) {
  42018. this.log(timeline_level.DEBUG, event);
  42019. };
  42020. Timeline.prototype.isEmpty = function () {
  42021. return this.events.length === 0;
  42022. };
  42023. Timeline.prototype.send = function (sendfn, callback) {
  42024. var _this = this;
  42025. var data = extend({
  42026. session: this.session,
  42027. bundle: this.sent + 1,
  42028. key: this.key,
  42029. lib: "js",
  42030. version: this.options.version,
  42031. cluster: this.options.cluster,
  42032. features: this.options.features,
  42033. timeline: this.events
  42034. }, this.options.params);
  42035. this.events = [];
  42036. sendfn(data, function (error, result) {
  42037. if (!error) {
  42038. _this.sent++;
  42039. }
  42040. if (callback) {
  42041. callback(error, result);
  42042. }
  42043. });
  42044. return true;
  42045. };
  42046. Timeline.prototype.generateUniqueID = function () {
  42047. this.uniqueID++;
  42048. return this.uniqueID;
  42049. };
  42050. return Timeline;
  42051. }());
  42052. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42053. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42054. var transport_strategy_TransportStrategy = (function () {
  42055. function TransportStrategy(name, priority, transport, options) {
  42056. this.name = name;
  42057. this.priority = priority;
  42058. this.transport = transport;
  42059. this.options = options || {};
  42060. }
  42061. TransportStrategy.prototype.isSupported = function () {
  42062. return this.transport.isSupported({
  42063. useTLS: this.options.useTLS
  42064. });
  42065. };
  42066. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42067. var _this = this;
  42068. if (!this.isSupported()) {
  42069. return failAttempt(new UnsupportedStrategy(), callback);
  42070. }
  42071. else if (this.priority < minPriority) {
  42072. return failAttempt(new TransportPriorityTooLow(), callback);
  42073. }
  42074. var connected = false;
  42075. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42076. var handshake = null;
  42077. var onInitialized = function () {
  42078. transport.unbind("initialized", onInitialized);
  42079. transport.connect();
  42080. };
  42081. var onOpen = function () {
  42082. handshake = factory.createHandshake(transport, function (result) {
  42083. connected = true;
  42084. unbindListeners();
  42085. callback(null, result);
  42086. });
  42087. };
  42088. var onError = function (error) {
  42089. unbindListeners();
  42090. callback(error);
  42091. };
  42092. var onClosed = function () {
  42093. unbindListeners();
  42094. var serializedTransport;
  42095. serializedTransport = safeJSONStringify(transport);
  42096. callback(new TransportClosed(serializedTransport));
  42097. };
  42098. var unbindListeners = function () {
  42099. transport.unbind("initialized", onInitialized);
  42100. transport.unbind("open", onOpen);
  42101. transport.unbind("error", onError);
  42102. transport.unbind("closed", onClosed);
  42103. };
  42104. transport.bind("initialized", onInitialized);
  42105. transport.bind("open", onOpen);
  42106. transport.bind("error", onError);
  42107. transport.bind("closed", onClosed);
  42108. transport.initialize();
  42109. return {
  42110. abort: function () {
  42111. if (connected) {
  42112. return;
  42113. }
  42114. unbindListeners();
  42115. if (handshake) {
  42116. handshake.close();
  42117. }
  42118. else {
  42119. transport.close();
  42120. }
  42121. },
  42122. forceMinPriority: function (p) {
  42123. if (connected) {
  42124. return;
  42125. }
  42126. if (_this.priority < p) {
  42127. if (handshake) {
  42128. handshake.close();
  42129. }
  42130. else {
  42131. transport.close();
  42132. }
  42133. }
  42134. }
  42135. };
  42136. };
  42137. return TransportStrategy;
  42138. }());
  42139. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42140. function failAttempt(error, callback) {
  42141. util.defer(function () {
  42142. callback(error);
  42143. });
  42144. return {
  42145. abort: function () { },
  42146. forceMinPriority: function () { }
  42147. };
  42148. }
  42149. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42150. var strategy_builder_Transports = runtime.Transports;
  42151. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42152. var transportClass = strategy_builder_Transports[type];
  42153. if (!transportClass) {
  42154. throw new UnsupportedTransport(type);
  42155. }
  42156. var enabled = (!config.enabledTransports ||
  42157. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42158. (!config.disabledTransports ||
  42159. arrayIndexOf(config.disabledTransports, name) === -1);
  42160. var transport;
  42161. if (enabled) {
  42162. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42163. key: config.key,
  42164. useTLS: config.useTLS,
  42165. timeline: config.timeline,
  42166. ignoreNullOrigin: config.ignoreNullOrigin
  42167. }, options));
  42168. }
  42169. else {
  42170. transport = strategy_builder_UnsupportedStrategy;
  42171. }
  42172. return transport;
  42173. };
  42174. var strategy_builder_UnsupportedStrategy = {
  42175. isSupported: function () {
  42176. return false;
  42177. },
  42178. connect: function (_, callback) {
  42179. var deferred = util.defer(function () {
  42180. callback(new UnsupportedStrategy());
  42181. });
  42182. return {
  42183. abort: function () {
  42184. deferred.ensureAborted();
  42185. },
  42186. forceMinPriority: function () { }
  42187. };
  42188. }
  42189. };
  42190. // CONCATENATED MODULE: ./src/core/config.ts
  42191. var getGlobalConfig = function () {
  42192. return {
  42193. wsHost: defaults.host,
  42194. wsPort: defaults.ws_port,
  42195. wssPort: defaults.wss_port,
  42196. wsPath: defaults.ws_path,
  42197. httpHost: defaults.sockjs_host,
  42198. httpPort: defaults.sockjs_http_port,
  42199. httpsPort: defaults.sockjs_https_port,
  42200. httpPath: defaults.sockjs_path,
  42201. statsHost: defaults.stats_host,
  42202. authEndpoint: defaults.channel_auth_endpoint,
  42203. authTransport: defaults.channel_auth_transport,
  42204. activity_timeout: defaults.activity_timeout,
  42205. pong_timeout: defaults.pong_timeout,
  42206. unavailable_timeout: defaults.unavailable_timeout
  42207. };
  42208. };
  42209. var getClusterConfig = function (clusterName) {
  42210. return {
  42211. wsHost: 'ws-' + clusterName + '.pusher.com',
  42212. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42213. };
  42214. };
  42215. // CONCATENATED MODULE: ./src/core/pusher.ts
  42216. var pusher_Pusher = (function () {
  42217. function Pusher(app_key, options) {
  42218. var _this = this;
  42219. checkAppKey(app_key);
  42220. options = options || {};
  42221. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42222. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42223. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42224. }
  42225. this.key = app_key;
  42226. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42227. this.channels = factory.createChannels();
  42228. this.global_emitter = new dispatcher();
  42229. this.sessionID = Math.floor(Math.random() * 1000000000);
  42230. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42231. cluster: this.config.cluster,
  42232. features: Pusher.getClientFeatures(),
  42233. params: this.config.timelineParams || {},
  42234. limit: 50,
  42235. level: timeline_level.INFO,
  42236. version: defaults.VERSION
  42237. });
  42238. if (!this.config.disableStats) {
  42239. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42240. host: this.config.statsHost,
  42241. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42242. });
  42243. }
  42244. var getStrategy = function (options) {
  42245. var config = extend({}, _this.config, options);
  42246. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42247. };
  42248. this.connection = factory.createConnectionManager(this.key, extend({
  42249. getStrategy: getStrategy,
  42250. timeline: this.timeline,
  42251. activityTimeout: this.config.activity_timeout,
  42252. pongTimeout: this.config.pong_timeout,
  42253. unavailableTimeout: this.config.unavailable_timeout
  42254. }, this.config, { useTLS: this.shouldUseTLS() }));
  42255. this.connection.bind('connected', function () {
  42256. _this.subscribeAll();
  42257. if (_this.timelineSender) {
  42258. _this.timelineSender.send(_this.connection.isUsingTLS());
  42259. }
  42260. });
  42261. this.connection.bind('message', function (event) {
  42262. var eventName = event.event;
  42263. var internal = eventName.indexOf('pusher_internal:') === 0;
  42264. if (event.channel) {
  42265. var channel = _this.channel(event.channel);
  42266. if (channel) {
  42267. channel.handleEvent(event);
  42268. }
  42269. }
  42270. if (!internal) {
  42271. _this.global_emitter.emit(event.event, event.data);
  42272. }
  42273. });
  42274. this.connection.bind('connecting', function () {
  42275. _this.channels.disconnect();
  42276. });
  42277. this.connection.bind('disconnected', function () {
  42278. _this.channels.disconnect();
  42279. });
  42280. this.connection.bind('error', function (err) {
  42281. logger.warn(err);
  42282. });
  42283. Pusher.instances.push(this);
  42284. this.timeline.info({ instances: Pusher.instances.length });
  42285. if (Pusher.isReady) {
  42286. this.connect();
  42287. }
  42288. }
  42289. Pusher.ready = function () {
  42290. Pusher.isReady = true;
  42291. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42292. Pusher.instances[i].connect();
  42293. }
  42294. };
  42295. Pusher.getClientFeatures = function () {
  42296. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42297. return t.isSupported({});
  42298. }));
  42299. };
  42300. Pusher.prototype.channel = function (name) {
  42301. return this.channels.find(name);
  42302. };
  42303. Pusher.prototype.allChannels = function () {
  42304. return this.channels.all();
  42305. };
  42306. Pusher.prototype.connect = function () {
  42307. this.connection.connect();
  42308. if (this.timelineSender) {
  42309. if (!this.timelineSenderTimer) {
  42310. var usingTLS = this.connection.isUsingTLS();
  42311. var timelineSender = this.timelineSender;
  42312. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42313. timelineSender.send(usingTLS);
  42314. });
  42315. }
  42316. }
  42317. };
  42318. Pusher.prototype.disconnect = function () {
  42319. this.connection.disconnect();
  42320. if (this.timelineSenderTimer) {
  42321. this.timelineSenderTimer.ensureAborted();
  42322. this.timelineSenderTimer = null;
  42323. }
  42324. };
  42325. Pusher.prototype.bind = function (event_name, callback, context) {
  42326. this.global_emitter.bind(event_name, callback, context);
  42327. return this;
  42328. };
  42329. Pusher.prototype.unbind = function (event_name, callback, context) {
  42330. this.global_emitter.unbind(event_name, callback, context);
  42331. return this;
  42332. };
  42333. Pusher.prototype.bind_global = function (callback) {
  42334. this.global_emitter.bind_global(callback);
  42335. return this;
  42336. };
  42337. Pusher.prototype.unbind_global = function (callback) {
  42338. this.global_emitter.unbind_global(callback);
  42339. return this;
  42340. };
  42341. Pusher.prototype.unbind_all = function (callback) {
  42342. this.global_emitter.unbind_all();
  42343. return this;
  42344. };
  42345. Pusher.prototype.subscribeAll = function () {
  42346. var channelName;
  42347. for (channelName in this.channels.channels) {
  42348. if (this.channels.channels.hasOwnProperty(channelName)) {
  42349. this.subscribe(channelName);
  42350. }
  42351. }
  42352. };
  42353. Pusher.prototype.subscribe = function (channel_name) {
  42354. var channel = this.channels.add(channel_name, this);
  42355. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42356. channel.reinstateSubscription();
  42357. }
  42358. else if (!channel.subscriptionPending &&
  42359. this.connection.state === 'connected') {
  42360. channel.subscribe();
  42361. }
  42362. return channel;
  42363. };
  42364. Pusher.prototype.unsubscribe = function (channel_name) {
  42365. var channel = this.channels.find(channel_name);
  42366. if (channel && channel.subscriptionPending) {
  42367. channel.cancelSubscription();
  42368. }
  42369. else {
  42370. channel = this.channels.remove(channel_name);
  42371. if (channel && this.connection.state === 'connected') {
  42372. channel.unsubscribe();
  42373. }
  42374. }
  42375. };
  42376. Pusher.prototype.send_event = function (event_name, data, channel) {
  42377. return this.connection.send_event(event_name, data, channel);
  42378. };
  42379. Pusher.prototype.shouldUseTLS = function () {
  42380. if (runtime.getProtocol() === 'https:') {
  42381. return true;
  42382. }
  42383. else if (this.config.forceTLS === true) {
  42384. return true;
  42385. }
  42386. else {
  42387. return Boolean(this.config.encrypted);
  42388. }
  42389. };
  42390. Pusher.instances = [];
  42391. Pusher.isReady = false;
  42392. Pusher.logToConsole = false;
  42393. Pusher.Runtime = runtime;
  42394. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42395. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42396. Pusher.auth_callbacks = runtime.auth_callbacks;
  42397. return Pusher;
  42398. }());
  42399. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42400. function checkAppKey(key) {
  42401. if (key === null || key === undefined) {
  42402. throw 'You must pass your app key when you instantiate Pusher.';
  42403. }
  42404. }
  42405. runtime.setup(pusher_Pusher);
  42406. /***/ })
  42407. /******/ ]);
  42408. });
  42409. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42410. /***/ }),
  42411. /***/ "./node_modules/setimmediate/setImmediate.js":
  42412. /*!***************************************************!*\
  42413. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42414. \***************************************************/
  42415. /*! no static exports found */
  42416. /***/ (function(module, exports, __webpack_require__) {
  42417. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42418. "use strict";
  42419. if (global.setImmediate) {
  42420. return;
  42421. }
  42422. var nextHandle = 1; // Spec says greater than zero
  42423. var tasksByHandle = {};
  42424. var currentlyRunningATask = false;
  42425. var doc = global.document;
  42426. var registerImmediate;
  42427. function setImmediate(callback) {
  42428. // Callback can either be a function or a string
  42429. if (typeof callback !== "function") {
  42430. callback = new Function("" + callback);
  42431. }
  42432. // Copy function arguments
  42433. var args = new Array(arguments.length - 1);
  42434. for (var i = 0; i < args.length; i++) {
  42435. args[i] = arguments[i + 1];
  42436. }
  42437. // Store and register the task
  42438. var task = { callback: callback, args: args };
  42439. tasksByHandle[nextHandle] = task;
  42440. registerImmediate(nextHandle);
  42441. return nextHandle++;
  42442. }
  42443. function clearImmediate(handle) {
  42444. delete tasksByHandle[handle];
  42445. }
  42446. function run(task) {
  42447. var callback = task.callback;
  42448. var args = task.args;
  42449. switch (args.length) {
  42450. case 0:
  42451. callback();
  42452. break;
  42453. case 1:
  42454. callback(args[0]);
  42455. break;
  42456. case 2:
  42457. callback(args[0], args[1]);
  42458. break;
  42459. case 3:
  42460. callback(args[0], args[1], args[2]);
  42461. break;
  42462. default:
  42463. callback.apply(undefined, args);
  42464. break;
  42465. }
  42466. }
  42467. function runIfPresent(handle) {
  42468. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42469. // So if we're currently running a task, we'll need to delay this invocation.
  42470. if (currentlyRunningATask) {
  42471. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42472. // "too much recursion" error.
  42473. setTimeout(runIfPresent, 0, handle);
  42474. } else {
  42475. var task = tasksByHandle[handle];
  42476. if (task) {
  42477. currentlyRunningATask = true;
  42478. try {
  42479. run(task);
  42480. } finally {
  42481. clearImmediate(handle);
  42482. currentlyRunningATask = false;
  42483. }
  42484. }
  42485. }
  42486. }
  42487. function installNextTickImplementation() {
  42488. registerImmediate = function(handle) {
  42489. process.nextTick(function () { runIfPresent(handle); });
  42490. };
  42491. }
  42492. function canUsePostMessage() {
  42493. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42494. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42495. if (global.postMessage && !global.importScripts) {
  42496. var postMessageIsAsynchronous = true;
  42497. var oldOnMessage = global.onmessage;
  42498. global.onmessage = function() {
  42499. postMessageIsAsynchronous = false;
  42500. };
  42501. global.postMessage("", "*");
  42502. global.onmessage = oldOnMessage;
  42503. return postMessageIsAsynchronous;
  42504. }
  42505. }
  42506. function installPostMessageImplementation() {
  42507. // Installs an event handler on `global` for the `message` event: see
  42508. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42509. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42510. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42511. var onGlobalMessage = function(event) {
  42512. if (event.source === global &&
  42513. typeof event.data === "string" &&
  42514. event.data.indexOf(messagePrefix) === 0) {
  42515. runIfPresent(+event.data.slice(messagePrefix.length));
  42516. }
  42517. };
  42518. if (global.addEventListener) {
  42519. global.addEventListener("message", onGlobalMessage, false);
  42520. } else {
  42521. global.attachEvent("onmessage", onGlobalMessage);
  42522. }
  42523. registerImmediate = function(handle) {
  42524. global.postMessage(messagePrefix + handle, "*");
  42525. };
  42526. }
  42527. function installMessageChannelImplementation() {
  42528. var channel = new MessageChannel();
  42529. channel.port1.onmessage = function(event) {
  42530. var handle = event.data;
  42531. runIfPresent(handle);
  42532. };
  42533. registerImmediate = function(handle) {
  42534. channel.port2.postMessage(handle);
  42535. };
  42536. }
  42537. function installReadyStateChangeImplementation() {
  42538. var html = doc.documentElement;
  42539. registerImmediate = function(handle) {
  42540. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42541. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42542. var script = doc.createElement("script");
  42543. script.onreadystatechange = function () {
  42544. runIfPresent(handle);
  42545. script.onreadystatechange = null;
  42546. html.removeChild(script);
  42547. script = null;
  42548. };
  42549. html.appendChild(script);
  42550. };
  42551. }
  42552. function installSetTimeoutImplementation() {
  42553. registerImmediate = function(handle) {
  42554. setTimeout(runIfPresent, 0, handle);
  42555. };
  42556. }
  42557. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42558. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42559. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42560. // Don't get fooled by e.g. browserify environments.
  42561. if ({}.toString.call(global.process) === "[object process]") {
  42562. // For Node.js before 0.9
  42563. installNextTickImplementation();
  42564. } else if (canUsePostMessage()) {
  42565. // For non-IE10 modern browsers
  42566. installPostMessageImplementation();
  42567. } else if (global.MessageChannel) {
  42568. // For web workers, where supported
  42569. installMessageChannelImplementation();
  42570. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42571. // For IE 6–8
  42572. installReadyStateChangeImplementation();
  42573. } else {
  42574. // For older browsers
  42575. installSetTimeoutImplementation();
  42576. }
  42577. attachTo.setImmediate = setImmediate;
  42578. attachTo.clearImmediate = clearImmediate;
  42579. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42580. /* 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")))
  42581. /***/ }),
  42582. /***/ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  42583. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  42584. !*** ./node_modules/style-loader!./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  42585. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  42586. /*! no static exports found */
  42587. /***/ (function(module, exports, __webpack_require__) {
  42588. var content = __webpack_require__(/*! !../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  42589. if(typeof content === 'string') content = [[module.i, content, '']];
  42590. var transform;
  42591. var insertInto;
  42592. var options = {"hmr":true}
  42593. options.transform = transform
  42594. options.insertInto = undefined;
  42595. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  42596. if(content.locals) module.exports = content.locals;
  42597. if(false) {}
  42598. /***/ }),
  42599. /***/ "./node_modules/style-loader/lib/addStyles.js":
  42600. /*!****************************************************!*\
  42601. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  42602. \****************************************************/
  42603. /*! no static exports found */
  42604. /***/ (function(module, exports, __webpack_require__) {
  42605. /*
  42606. MIT License http://www.opensource.org/licenses/mit-license.php
  42607. Author Tobias Koppers @sokra
  42608. */
  42609. var stylesInDom = {};
  42610. var memoize = function (fn) {
  42611. var memo;
  42612. return function () {
  42613. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  42614. return memo;
  42615. };
  42616. };
  42617. var isOldIE = memoize(function () {
  42618. // Test for IE <= 9 as proposed by Browserhacks
  42619. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  42620. // Tests for existence of standard globals is to allow style-loader
  42621. // to operate correctly into non-standard environments
  42622. // @see https://github.com/webpack-contrib/style-loader/issues/177
  42623. return window && document && document.all && !window.atob;
  42624. });
  42625. var getTarget = function (target, parent) {
  42626. if (parent){
  42627. return parent.querySelector(target);
  42628. }
  42629. return document.querySelector(target);
  42630. };
  42631. var getElement = (function (fn) {
  42632. var memo = {};
  42633. return function(target, parent) {
  42634. // If passing function in options, then use it for resolve "head" element.
  42635. // Useful for Shadow Root style i.e
  42636. // {
  42637. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  42638. // }
  42639. if (typeof target === 'function') {
  42640. return target();
  42641. }
  42642. if (typeof memo[target] === "undefined") {
  42643. var styleTarget = getTarget.call(this, target, parent);
  42644. // Special case to return head of iframe instead of iframe itself
  42645. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  42646. try {
  42647. // This will throw an exception if access to iframe is blocked
  42648. // due to cross-origin restrictions
  42649. styleTarget = styleTarget.contentDocument.head;
  42650. } catch(e) {
  42651. styleTarget = null;
  42652. }
  42653. }
  42654. memo[target] = styleTarget;
  42655. }
  42656. return memo[target]
  42657. };
  42658. })();
  42659. var singleton = null;
  42660. var singletonCounter = 0;
  42661. var stylesInsertedAtTop = [];
  42662. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  42663. module.exports = function(list, options) {
  42664. if (typeof DEBUG !== "undefined" && DEBUG) {
  42665. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  42666. }
  42667. options = options || {};
  42668. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  42669. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  42670. // tags it will allow on a page
  42671. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  42672. // By default, add <style> tags to the <head> element
  42673. if (!options.insertInto) options.insertInto = "head";
  42674. // By default, add <style> tags to the bottom of the target
  42675. if (!options.insertAt) options.insertAt = "bottom";
  42676. var styles = listToStyles(list, options);
  42677. addStylesToDom(styles, options);
  42678. return function update (newList) {
  42679. var mayRemove = [];
  42680. for (var i = 0; i < styles.length; i++) {
  42681. var item = styles[i];
  42682. var domStyle = stylesInDom[item.id];
  42683. domStyle.refs--;
  42684. mayRemove.push(domStyle);
  42685. }
  42686. if(newList) {
  42687. var newStyles = listToStyles(newList, options);
  42688. addStylesToDom(newStyles, options);
  42689. }
  42690. for (var i = 0; i < mayRemove.length; i++) {
  42691. var domStyle = mayRemove[i];
  42692. if(domStyle.refs === 0) {
  42693. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  42694. delete stylesInDom[domStyle.id];
  42695. }
  42696. }
  42697. };
  42698. };
  42699. function addStylesToDom (styles, options) {
  42700. for (var i = 0; i < styles.length; i++) {
  42701. var item = styles[i];
  42702. var domStyle = stylesInDom[item.id];
  42703. if(domStyle) {
  42704. domStyle.refs++;
  42705. for(var j = 0; j < domStyle.parts.length; j++) {
  42706. domStyle.parts[j](item.parts[j]);
  42707. }
  42708. for(; j < item.parts.length; j++) {
  42709. domStyle.parts.push(addStyle(item.parts[j], options));
  42710. }
  42711. } else {
  42712. var parts = [];
  42713. for(var j = 0; j < item.parts.length; j++) {
  42714. parts.push(addStyle(item.parts[j], options));
  42715. }
  42716. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  42717. }
  42718. }
  42719. }
  42720. function listToStyles (list, options) {
  42721. var styles = [];
  42722. var newStyles = {};
  42723. for (var i = 0; i < list.length; i++) {
  42724. var item = list[i];
  42725. var id = options.base ? item[0] + options.base : item[0];
  42726. var css = item[1];
  42727. var media = item[2];
  42728. var sourceMap = item[3];
  42729. var part = {css: css, media: media, sourceMap: sourceMap};
  42730. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  42731. else newStyles[id].parts.push(part);
  42732. }
  42733. return styles;
  42734. }
  42735. function insertStyleElement (options, style) {
  42736. var target = getElement(options.insertInto)
  42737. if (!target) {
  42738. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  42739. }
  42740. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  42741. if (options.insertAt === "top") {
  42742. if (!lastStyleElementInsertedAtTop) {
  42743. target.insertBefore(style, target.firstChild);
  42744. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  42745. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  42746. } else {
  42747. target.appendChild(style);
  42748. }
  42749. stylesInsertedAtTop.push(style);
  42750. } else if (options.insertAt === "bottom") {
  42751. target.appendChild(style);
  42752. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  42753. var nextSibling = getElement(options.insertAt.before, target);
  42754. target.insertBefore(style, nextSibling);
  42755. } else {
  42756. throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
  42757. }
  42758. }
  42759. function removeStyleElement (style) {
  42760. if (style.parentNode === null) return false;
  42761. style.parentNode.removeChild(style);
  42762. var idx = stylesInsertedAtTop.indexOf(style);
  42763. if(idx >= 0) {
  42764. stylesInsertedAtTop.splice(idx, 1);
  42765. }
  42766. }
  42767. function createStyleElement (options) {
  42768. var style = document.createElement("style");
  42769. if(options.attrs.type === undefined) {
  42770. options.attrs.type = "text/css";
  42771. }
  42772. if(options.attrs.nonce === undefined) {
  42773. var nonce = getNonce();
  42774. if (nonce) {
  42775. options.attrs.nonce = nonce;
  42776. }
  42777. }
  42778. addAttrs(style, options.attrs);
  42779. insertStyleElement(options, style);
  42780. return style;
  42781. }
  42782. function createLinkElement (options) {
  42783. var link = document.createElement("link");
  42784. if(options.attrs.type === undefined) {
  42785. options.attrs.type = "text/css";
  42786. }
  42787. options.attrs.rel = "stylesheet";
  42788. addAttrs(link, options.attrs);
  42789. insertStyleElement(options, link);
  42790. return link;
  42791. }
  42792. function addAttrs (el, attrs) {
  42793. Object.keys(attrs).forEach(function (key) {
  42794. el.setAttribute(key, attrs[key]);
  42795. });
  42796. }
  42797. function getNonce() {
  42798. if (false) {}
  42799. return __webpack_require__.nc;
  42800. }
  42801. function addStyle (obj, options) {
  42802. var style, update, remove, result;
  42803. // If a transform function was defined, run it on the css
  42804. if (options.transform && obj.css) {
  42805. result = typeof options.transform === 'function'
  42806. ? options.transform(obj.css)
  42807. : options.transform.default(obj.css);
  42808. if (result) {
  42809. // If transform returns a value, use that instead of the original css.
  42810. // This allows running runtime transformations on the css.
  42811. obj.css = result;
  42812. } else {
  42813. // If the transform function returns a falsy value, don't add this css.
  42814. // This allows conditional loading of css
  42815. return function() {
  42816. // noop
  42817. };
  42818. }
  42819. }
  42820. if (options.singleton) {
  42821. var styleIndex = singletonCounter++;
  42822. style = singleton || (singleton = createStyleElement(options));
  42823. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  42824. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  42825. } else if (
  42826. obj.sourceMap &&
  42827. typeof URL === "function" &&
  42828. typeof URL.createObjectURL === "function" &&
  42829. typeof URL.revokeObjectURL === "function" &&
  42830. typeof Blob === "function" &&
  42831. typeof btoa === "function"
  42832. ) {
  42833. style = createLinkElement(options);
  42834. update = updateLink.bind(null, style, options);
  42835. remove = function () {
  42836. removeStyleElement(style);
  42837. if(style.href) URL.revokeObjectURL(style.href);
  42838. };
  42839. } else {
  42840. style = createStyleElement(options);
  42841. update = applyToTag.bind(null, style);
  42842. remove = function () {
  42843. removeStyleElement(style);
  42844. };
  42845. }
  42846. update(obj);
  42847. return function updateStyle (newObj) {
  42848. if (newObj) {
  42849. if (
  42850. newObj.css === obj.css &&
  42851. newObj.media === obj.media &&
  42852. newObj.sourceMap === obj.sourceMap
  42853. ) {
  42854. return;
  42855. }
  42856. update(obj = newObj);
  42857. } else {
  42858. remove();
  42859. }
  42860. };
  42861. }
  42862. var replaceText = (function () {
  42863. var textStore = [];
  42864. return function (index, replacement) {
  42865. textStore[index] = replacement;
  42866. return textStore.filter(Boolean).join('\n');
  42867. };
  42868. })();
  42869. function applyToSingletonTag (style, index, remove, obj) {
  42870. var css = remove ? "" : obj.css;
  42871. if (style.styleSheet) {
  42872. style.styleSheet.cssText = replaceText(index, css);
  42873. } else {
  42874. var cssNode = document.createTextNode(css);
  42875. var childNodes = style.childNodes;
  42876. if (childNodes[index]) style.removeChild(childNodes[index]);
  42877. if (childNodes.length) {
  42878. style.insertBefore(cssNode, childNodes[index]);
  42879. } else {
  42880. style.appendChild(cssNode);
  42881. }
  42882. }
  42883. }
  42884. function applyToTag (style, obj) {
  42885. var css = obj.css;
  42886. var media = obj.media;
  42887. if(media) {
  42888. style.setAttribute("media", media)
  42889. }
  42890. if(style.styleSheet) {
  42891. style.styleSheet.cssText = css;
  42892. } else {
  42893. while(style.firstChild) {
  42894. style.removeChild(style.firstChild);
  42895. }
  42896. style.appendChild(document.createTextNode(css));
  42897. }
  42898. }
  42899. function updateLink (link, options, obj) {
  42900. var css = obj.css;
  42901. var sourceMap = obj.sourceMap;
  42902. /*
  42903. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  42904. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  42905. on by default. Otherwise default to the convertToAbsoluteUrls option
  42906. directly
  42907. */
  42908. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  42909. if (options.convertToAbsoluteUrls || autoFixUrls) {
  42910. css = fixUrls(css);
  42911. }
  42912. if (sourceMap) {
  42913. // http://stackoverflow.com/a/26603875
  42914. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  42915. }
  42916. var blob = new Blob([css], { type: "text/css" });
  42917. var oldSrc = link.href;
  42918. link.href = URL.createObjectURL(blob);
  42919. if(oldSrc) URL.revokeObjectURL(oldSrc);
  42920. }
  42921. /***/ }),
  42922. /***/ "./node_modules/style-loader/lib/urls.js":
  42923. /*!***********************************************!*\
  42924. !*** ./node_modules/style-loader/lib/urls.js ***!
  42925. \***********************************************/
  42926. /*! no static exports found */
  42927. /***/ (function(module, exports) {
  42928. /**
  42929. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  42930. * embed the css on the page. This breaks all relative urls because now they are relative to a
  42931. * bundle instead of the current page.
  42932. *
  42933. * One solution is to only use full urls, but that may be impossible.
  42934. *
  42935. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  42936. *
  42937. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  42938. *
  42939. */
  42940. module.exports = function (css) {
  42941. // get current location
  42942. var location = typeof window !== "undefined" && window.location;
  42943. if (!location) {
  42944. throw new Error("fixUrls requires window.location");
  42945. }
  42946. // blank or null?
  42947. if (!css || typeof css !== "string") {
  42948. return css;
  42949. }
  42950. var baseUrl = location.protocol + "//" + location.host;
  42951. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  42952. // convert each url(...)
  42953. /*
  42954. This regular expression is just a way to recursively match brackets within
  42955. a string.
  42956. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  42957. ( = Start a capturing group
  42958. (?: = Start a non-capturing group
  42959. [^)(] = Match anything that isn't a parentheses
  42960. | = OR
  42961. \( = Match a start parentheses
  42962. (?: = Start another non-capturing groups
  42963. [^)(]+ = Match anything that isn't a parentheses
  42964. | = OR
  42965. \( = Match a start parentheses
  42966. [^)(]* = Match anything that isn't a parentheses
  42967. \) = Match a end parentheses
  42968. ) = End Group
  42969. *\) = Match anything and then a close parens
  42970. ) = Close non-capturing group
  42971. * = Match anything
  42972. ) = Close capturing group
  42973. \) = Match a close parens
  42974. /gi = Get all matches, not the first. Be case insensitive.
  42975. */
  42976. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  42977. // strip quotes (if they exist)
  42978. var unquotedOrigUrl = origUrl
  42979. .trim()
  42980. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  42981. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  42982. // already a full url? no change
  42983. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  42984. return fullMatch;
  42985. }
  42986. // convert the url to a full url
  42987. var newUrl;
  42988. if (unquotedOrigUrl.indexOf("//") === 0) {
  42989. //TODO: should we add protocol?
  42990. newUrl = unquotedOrigUrl;
  42991. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  42992. // path should be relative to the base url
  42993. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  42994. } else {
  42995. // path should be relative to current directory
  42996. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  42997. }
  42998. // send back the fixed url(...)
  42999. return "url(" + JSON.stringify(newUrl) + ")";
  43000. });
  43001. // send back the fixed css
  43002. return fixedCss;
  43003. };
  43004. /***/ }),
  43005. /***/ "./node_modules/timers-browserify/main.js":
  43006. /*!************************************************!*\
  43007. !*** ./node_modules/timers-browserify/main.js ***!
  43008. \************************************************/
  43009. /*! no static exports found */
  43010. /***/ (function(module, exports, __webpack_require__) {
  43011. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43012. (typeof self !== "undefined" && self) ||
  43013. window;
  43014. var apply = Function.prototype.apply;
  43015. // DOM APIs, for completeness
  43016. exports.setTimeout = function() {
  43017. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43018. };
  43019. exports.setInterval = function() {
  43020. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43021. };
  43022. exports.clearTimeout =
  43023. exports.clearInterval = function(timeout) {
  43024. if (timeout) {
  43025. timeout.close();
  43026. }
  43027. };
  43028. function Timeout(id, clearFn) {
  43029. this._id = id;
  43030. this._clearFn = clearFn;
  43031. }
  43032. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43033. Timeout.prototype.close = function() {
  43034. this._clearFn.call(scope, this._id);
  43035. };
  43036. // Does not start the time, just sets up the members needed.
  43037. exports.enroll = function(item, msecs) {
  43038. clearTimeout(item._idleTimeoutId);
  43039. item._idleTimeout = msecs;
  43040. };
  43041. exports.unenroll = function(item) {
  43042. clearTimeout(item._idleTimeoutId);
  43043. item._idleTimeout = -1;
  43044. };
  43045. exports._unrefActive = exports.active = function(item) {
  43046. clearTimeout(item._idleTimeoutId);
  43047. var msecs = item._idleTimeout;
  43048. if (msecs >= 0) {
  43049. item._idleTimeoutId = setTimeout(function onTimeout() {
  43050. if (item._onTimeout)
  43051. item._onTimeout();
  43052. }, msecs);
  43053. }
  43054. };
  43055. // setimmediate attaches itself to the global object
  43056. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43057. // On some exotic environments, it's not clear which object `setimmediate` was
  43058. // able to install onto. Search each possibility in the same order as the
  43059. // `setimmediate` library.
  43060. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43061. (typeof global !== "undefined" && global.setImmediate) ||
  43062. (this && this.setImmediate);
  43063. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43064. (typeof global !== "undefined" && global.clearImmediate) ||
  43065. (this && this.clearImmediate);
  43066. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43067. /***/ }),
  43068. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  43069. /*!*************************************************************************************************************************************************************************************************!*\
  43070. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  43071. \*************************************************************************************************************************************************************************************************/
  43072. /*! exports provided: render, staticRenderFns */
  43073. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43074. "use strict";
  43075. __webpack_require__.r(__webpack_exports__);
  43076. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43077. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43078. var render = function() {
  43079. var _vm = this
  43080. var _h = _vm.$createElement
  43081. var _c = _vm._self._c || _h
  43082. return _c("div", [
  43083. _c(
  43084. "nav",
  43085. {
  43086. staticClass:
  43087. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  43088. },
  43089. [
  43090. _c(
  43091. "div",
  43092. { staticClass: "container-fluid" },
  43093. [
  43094. _c(
  43095. "router-link",
  43096. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  43097. [_vm._v("\n UPCCRT\n ")]
  43098. ),
  43099. _vm._v(" "),
  43100. _vm._m(0),
  43101. _vm._v(" "),
  43102. _c(
  43103. "div",
  43104. {
  43105. staticClass: "collapse navbar-collapse",
  43106. attrs: { id: "navbarSupportedContent" }
  43107. },
  43108. [
  43109. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  43110. _vm._m(1),
  43111. _vm._v(" "),
  43112. _vm._m(2),
  43113. _vm._v(" "),
  43114. _c(
  43115. "li",
  43116. { staticClass: "nav-item" },
  43117. [
  43118. _c(
  43119. "router-link",
  43120. {
  43121. staticClass: "nav-link",
  43122. attrs: { to: { name: "dashboard" } }
  43123. },
  43124. [
  43125. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  43126. _vm._v(" "),
  43127. _c(
  43128. "span",
  43129. { staticClass: "d-none d-sm-block d-md-inline" },
  43130. [_vm._v("Dashboard")]
  43131. )
  43132. ]
  43133. )
  43134. ],
  43135. 1
  43136. ),
  43137. _vm._v(" "),
  43138. _vm._m(3)
  43139. ]),
  43140. _vm._v(" "),
  43141. _c(
  43142. "ul",
  43143. { staticClass: "navbar-nav ml-auto" },
  43144. [
  43145. !_vm.isLoggedIn
  43146. ? _c(
  43147. "router-link",
  43148. {
  43149. staticClass: "nav-link",
  43150. attrs: { to: { name: "login" } }
  43151. },
  43152. [_vm._v("Login")]
  43153. )
  43154. : _vm._e(),
  43155. _vm._v(" "),
  43156. _vm.isLoggedIn
  43157. ? _c("li", { staticClass: "nav-link" }, [
  43158. _vm._v(_vm._s(_vm.username))
  43159. ])
  43160. : _vm._e(),
  43161. _vm._v(" "),
  43162. _vm.isLoggedIn
  43163. ? _c(
  43164. "router-link",
  43165. {
  43166. staticClass: "nav-link",
  43167. attrs: { to: { name: "home" } }
  43168. },
  43169. [_vm._v("Home")]
  43170. )
  43171. : _vm._e()
  43172. ],
  43173. 1
  43174. )
  43175. ]
  43176. )
  43177. ],
  43178. 1
  43179. )
  43180. ]
  43181. ),
  43182. _vm._v(" "),
  43183. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  43184. ])
  43185. }
  43186. var staticRenderFns = [
  43187. function() {
  43188. var _vm = this
  43189. var _h = _vm.$createElement
  43190. var _c = _vm._self._c || _h
  43191. return _c(
  43192. "button",
  43193. {
  43194. staticClass: "navbar-toggler",
  43195. attrs: {
  43196. type: "button",
  43197. "data-toggle": "collapse",
  43198. "data-target": "#navbarSupportedContent",
  43199. "aria-controls": "navbarSupportedContent",
  43200. "aria-expanded": "false"
  43201. }
  43202. },
  43203. [_c("span", { staticClass: "navbar-toggler-icon" })]
  43204. )
  43205. },
  43206. function() {
  43207. var _vm = this
  43208. var _h = _vm.$createElement
  43209. var _c = _vm._self._c || _h
  43210. return _c("li", { staticClass: "nav-item" }, [
  43211. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  43212. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  43213. _vm._v(" "),
  43214. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  43215. _vm._v("Check-In")
  43216. ])
  43217. ])
  43218. ])
  43219. },
  43220. function() {
  43221. var _vm = this
  43222. var _h = _vm.$createElement
  43223. var _c = _vm._self._c || _h
  43224. return _c("li", { staticClass: "nav-item" }, [
  43225. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  43226. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43227. _vm._v(" "),
  43228. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  43229. _vm._v("Check-Out")
  43230. ])
  43231. ])
  43232. ])
  43233. },
  43234. function() {
  43235. var _vm = this
  43236. var _h = _vm.$createElement
  43237. var _c = _vm._self._c || _h
  43238. return _c("li", { staticClass: "nav-item" }, [
  43239. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  43240. _c("i", { staticClass: "fas fa-chart-bar" }),
  43241. _vm._v(" "),
  43242. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  43243. _vm._v("Reports")
  43244. ])
  43245. ])
  43246. ])
  43247. }
  43248. ]
  43249. render._withStripped = true
  43250. /***/ }),
  43251. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  43252. /*!*******************************************************************************************************************************************************************************************************!*\
  43253. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  43254. \*******************************************************************************************************************************************************************************************************/
  43255. /*! exports provided: render, staticRenderFns */
  43256. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43257. "use strict";
  43258. __webpack_require__.r(__webpack_exports__);
  43259. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43260. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43261. var render = function() {
  43262. var _vm = this
  43263. var _h = _vm.$createElement
  43264. var _c = _vm._self._c || _h
  43265. return _c("div", { staticClass: "container" }, [
  43266. _c("div", { staticClass: "row justify-content-center" }, [
  43267. _c(
  43268. "div",
  43269. { staticClass: "col-md-12" },
  43270. _vm._l(_vm.workOrders, function(workOrder, index) {
  43271. return _c("div", { key: workOrder.woid, staticClass: "col-md-4" }, [
  43272. _c("div", { staticClass: "card" }, [
  43273. _c("div", { staticClass: "card-header" }, [
  43274. _c("h4", { staticClass: "card-title" }, [
  43275. _vm._v(_vm._s(workOrder.woid))
  43276. ])
  43277. ]),
  43278. _vm._v(" "),
  43279. _c("div", { staticClass: "card-body card-body-dark" }, [
  43280. _c("div", [
  43281. _vm._v(
  43282. "\n " +
  43283. _vm._s(workOrder.probdesc) +
  43284. "\n "
  43285. )
  43286. ]),
  43287. _vm._v(" "),
  43288. _c("div", [
  43289. _vm._v(
  43290. "\n " +
  43291. _vm._s(workOrder.suggested) +
  43292. "\n "
  43293. )
  43294. ])
  43295. ])
  43296. ])
  43297. ])
  43298. }),
  43299. 0
  43300. )
  43301. ])
  43302. ])
  43303. }
  43304. var staticRenderFns = []
  43305. render._withStripped = true
  43306. /***/ }),
  43307. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  43308. /*!***************************************************************************************************************************************************************************************************!*\
  43309. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  43310. \***************************************************************************************************************************************************************************************************/
  43311. /*! exports provided: render, staticRenderFns */
  43312. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43313. "use strict";
  43314. __webpack_require__.r(__webpack_exports__);
  43315. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43316. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43317. var render = function() {
  43318. var _vm = this
  43319. var _h = _vm.$createElement
  43320. var _c = _vm._self._c || _h
  43321. return _c("div", { staticClass: "container" }, [
  43322. _c("div", { staticClass: "row justify-content-center" }, [
  43323. _c("div", { staticClass: "col-md-8" }, [
  43324. _c("div", { staticClass: "card card-default" }, [
  43325. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  43326. _vm._v(" "),
  43327. _c("div", { staticClass: "card-body" }, [
  43328. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  43329. _c("div", { staticClass: "form-group row" }, [
  43330. _c(
  43331. "label",
  43332. {
  43333. staticClass: "col-sm-4 col-form-label text-md-right",
  43334. attrs: { for: "username" }
  43335. },
  43336. [_vm._v("Username")]
  43337. ),
  43338. _vm._v(" "),
  43339. _c("div", { staticClass: "col-md-6" }, [
  43340. _c("input", {
  43341. directives: [
  43342. {
  43343. name: "model",
  43344. rawName: "v-model",
  43345. value: _vm.username,
  43346. expression: "username"
  43347. }
  43348. ],
  43349. staticClass: "form-control",
  43350. attrs: {
  43351. id: "username",
  43352. type: "username",
  43353. required: "",
  43354. autofocus: ""
  43355. },
  43356. domProps: { value: _vm.username },
  43357. on: {
  43358. input: function($event) {
  43359. if ($event.target.composing) {
  43360. return
  43361. }
  43362. _vm.username = $event.target.value
  43363. }
  43364. }
  43365. })
  43366. ])
  43367. ]),
  43368. _vm._v(" "),
  43369. _c("div", { staticClass: "form-group row" }, [
  43370. _c(
  43371. "label",
  43372. {
  43373. staticClass: "col-md-4 col-form-label text-md-right",
  43374. attrs: { for: "password" }
  43375. },
  43376. [_vm._v("Password")]
  43377. ),
  43378. _vm._v(" "),
  43379. _c("div", { staticClass: "col-md-6" }, [
  43380. _c("input", {
  43381. directives: [
  43382. {
  43383. name: "model",
  43384. rawName: "v-model",
  43385. value: _vm.password,
  43386. expression: "password"
  43387. }
  43388. ],
  43389. staticClass: "form-control",
  43390. attrs: { id: "password", type: "password", required: "" },
  43391. domProps: { value: _vm.password },
  43392. on: {
  43393. input: function($event) {
  43394. if ($event.target.composing) {
  43395. return
  43396. }
  43397. _vm.password = $event.target.value
  43398. }
  43399. }
  43400. })
  43401. ])
  43402. ]),
  43403. _vm._v(" "),
  43404. _c("div", { staticClass: "form-group row mb-0" }, [
  43405. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  43406. _c(
  43407. "button",
  43408. {
  43409. staticClass: "btn btn-primary",
  43410. attrs: { type: "submit" },
  43411. on: { click: _vm.handleSubmit }
  43412. },
  43413. [
  43414. _vm._v(
  43415. "\n Login\n "
  43416. )
  43417. ]
  43418. )
  43419. ])
  43420. ])
  43421. ])
  43422. ])
  43423. ])
  43424. ])
  43425. ])
  43426. ])
  43427. }
  43428. var staticRenderFns = []
  43429. render._withStripped = true
  43430. /***/ }),
  43431. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  43432. /*!*****************************************************************************************************************************************************************************************************************!*\
  43433. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  43434. \*****************************************************************************************************************************************************************************************************************/
  43435. /*! exports provided: render, staticRenderFns */
  43436. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43437. "use strict";
  43438. __webpack_require__.r(__webpack_exports__);
  43439. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43440. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43441. var render = function() {
  43442. var _vm = this
  43443. var _h = _vm.$createElement
  43444. var _c = _vm._self._c || _h
  43445. return _vm._m(0)
  43446. }
  43447. var staticRenderFns = [
  43448. function() {
  43449. var _vm = this
  43450. var _h = _vm.$createElement
  43451. var _c = _vm._self._c || _h
  43452. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  43453. _c("div", { staticClass: "content" }, [
  43454. _c("div", { staticClass: "m-b-md" }, [
  43455. _c("h2", { staticClass: "title m-b-md" }, [
  43456. _vm._v("\n UPCCRT\n ")
  43457. ]),
  43458. _vm._v(" "),
  43459. _c("h3", [
  43460. _vm._v(
  43461. "\n University PC Care Repair Tracker\n "
  43462. )
  43463. ])
  43464. ])
  43465. ])
  43466. ])
  43467. }
  43468. ]
  43469. render._withStripped = true
  43470. /***/ }),
  43471. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  43472. /*!********************************************************************!*\
  43473. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  43474. \********************************************************************/
  43475. /*! exports provided: default */
  43476. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43477. "use strict";
  43478. __webpack_require__.r(__webpack_exports__);
  43479. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  43480. /* globals __VUE_SSR_CONTEXT__ */
  43481. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  43482. // This module is a runtime utility for cleaner component module output and will
  43483. // be included in the final webpack user bundle.
  43484. function normalizeComponent (
  43485. scriptExports,
  43486. render,
  43487. staticRenderFns,
  43488. functionalTemplate,
  43489. injectStyles,
  43490. scopeId,
  43491. moduleIdentifier, /* server only */
  43492. shadowMode /* vue-cli only */
  43493. ) {
  43494. // Vue.extend constructor export interop
  43495. var options = typeof scriptExports === 'function'
  43496. ? scriptExports.options
  43497. : scriptExports
  43498. // render functions
  43499. if (render) {
  43500. options.render = render
  43501. options.staticRenderFns = staticRenderFns
  43502. options._compiled = true
  43503. }
  43504. // functional template
  43505. if (functionalTemplate) {
  43506. options.functional = true
  43507. }
  43508. // scopedId
  43509. if (scopeId) {
  43510. options._scopeId = 'data-v-' + scopeId
  43511. }
  43512. var hook
  43513. if (moduleIdentifier) { // server build
  43514. hook = function (context) {
  43515. // 2.3 injection
  43516. context =
  43517. context || // cached call
  43518. (this.$vnode && this.$vnode.ssrContext) || // stateful
  43519. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  43520. // 2.2 with runInNewContext: true
  43521. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  43522. context = __VUE_SSR_CONTEXT__
  43523. }
  43524. // inject component styles
  43525. if (injectStyles) {
  43526. injectStyles.call(this, context)
  43527. }
  43528. // register component module identifier for async chunk inferrence
  43529. if (context && context._registeredComponents) {
  43530. context._registeredComponents.add(moduleIdentifier)
  43531. }
  43532. }
  43533. // used by ssr in case component is cached and beforeCreate
  43534. // never gets called
  43535. options._ssrRegister = hook
  43536. } else if (injectStyles) {
  43537. hook = shadowMode
  43538. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  43539. : injectStyles
  43540. }
  43541. if (hook) {
  43542. if (options.functional) {
  43543. // for template-only hot-reload because in that case the render fn doesn't
  43544. // go through the normalizer
  43545. options._injectStyles = hook
  43546. // register for functioal component in vue file
  43547. var originalRender = options.render
  43548. options.render = function renderWithStyleInjection (h, context) {
  43549. hook.call(context)
  43550. return originalRender(h, context)
  43551. }
  43552. } else {
  43553. // inject component registration as beforeCreate hook
  43554. var existing = options.beforeCreate
  43555. options.beforeCreate = existing
  43556. ? [].concat(existing, hook)
  43557. : [hook]
  43558. }
  43559. }
  43560. return {
  43561. exports: scriptExports,
  43562. options: options
  43563. }
  43564. }
  43565. /***/ }),
  43566. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  43567. /*!********************************************************!*\
  43568. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  43569. \********************************************************/
  43570. /*! exports provided: default */
  43571. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43572. "use strict";
  43573. __webpack_require__.r(__webpack_exports__);
  43574. /*!
  43575. * vue-router v3.1.6
  43576. * (c) 2020 Evan You
  43577. * @license MIT
  43578. */
  43579. /* */
  43580. function assert (condition, message) {
  43581. if (!condition) {
  43582. throw new Error(("[vue-router] " + message))
  43583. }
  43584. }
  43585. function warn (condition, message) {
  43586. if ( true && !condition) {
  43587. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  43588. }
  43589. }
  43590. function isError (err) {
  43591. return Object.prototype.toString.call(err).indexOf('Error') > -1
  43592. }
  43593. function isExtendedError (constructor, err) {
  43594. return (
  43595. err instanceof constructor ||
  43596. // _name is to support IE9 too
  43597. (err && (err.name === constructor.name || err._name === constructor._name))
  43598. )
  43599. }
  43600. function extend (a, b) {
  43601. for (var key in b) {
  43602. a[key] = b[key];
  43603. }
  43604. return a
  43605. }
  43606. var View = {
  43607. name: 'RouterView',
  43608. functional: true,
  43609. props: {
  43610. name: {
  43611. type: String,
  43612. default: 'default'
  43613. }
  43614. },
  43615. render: function render (_, ref) {
  43616. var props = ref.props;
  43617. var children = ref.children;
  43618. var parent = ref.parent;
  43619. var data = ref.data;
  43620. // used by devtools to display a router-view badge
  43621. data.routerView = true;
  43622. // directly use parent context's createElement() function
  43623. // so that components rendered by router-view can resolve named slots
  43624. var h = parent.$createElement;
  43625. var name = props.name;
  43626. var route = parent.$route;
  43627. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  43628. // determine current view depth, also check to see if the tree
  43629. // has been toggled inactive but kept-alive.
  43630. var depth = 0;
  43631. var inactive = false;
  43632. while (parent && parent._routerRoot !== parent) {
  43633. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  43634. if (vnodeData.routerView) {
  43635. depth++;
  43636. }
  43637. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  43638. inactive = true;
  43639. }
  43640. parent = parent.$parent;
  43641. }
  43642. data.routerViewDepth = depth;
  43643. // render previous view if the tree is inactive and kept-alive
  43644. if (inactive) {
  43645. var cachedData = cache[name];
  43646. var cachedComponent = cachedData && cachedData.component;
  43647. if (cachedComponent) {
  43648. // #2301
  43649. // pass props
  43650. if (cachedData.configProps) {
  43651. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  43652. }
  43653. return h(cachedComponent, data, children)
  43654. } else {
  43655. // render previous empty view
  43656. return h()
  43657. }
  43658. }
  43659. var matched = route.matched[depth];
  43660. var component = matched && matched.components[name];
  43661. // render empty node if no matched route or no config component
  43662. if (!matched || !component) {
  43663. cache[name] = null;
  43664. return h()
  43665. }
  43666. // cache component
  43667. cache[name] = { component: component };
  43668. // attach instance registration hook
  43669. // this will be called in the instance's injected lifecycle hooks
  43670. data.registerRouteInstance = function (vm, val) {
  43671. // val could be undefined for unregistration
  43672. var current = matched.instances[name];
  43673. if (
  43674. (val && current !== vm) ||
  43675. (!val && current === vm)
  43676. ) {
  43677. matched.instances[name] = val;
  43678. }
  43679. }
  43680. // also register instance in prepatch hook
  43681. // in case the same component instance is reused across different routes
  43682. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  43683. matched.instances[name] = vnode.componentInstance;
  43684. };
  43685. // register instance in init hook
  43686. // in case kept-alive component be actived when routes changed
  43687. data.hook.init = function (vnode) {
  43688. if (vnode.data.keepAlive &&
  43689. vnode.componentInstance &&
  43690. vnode.componentInstance !== matched.instances[name]
  43691. ) {
  43692. matched.instances[name] = vnode.componentInstance;
  43693. }
  43694. };
  43695. var configProps = matched.props && matched.props[name];
  43696. // save route and configProps in cachce
  43697. if (configProps) {
  43698. extend(cache[name], {
  43699. route: route,
  43700. configProps: configProps
  43701. });
  43702. fillPropsinData(component, data, route, configProps);
  43703. }
  43704. return h(component, data, children)
  43705. }
  43706. };
  43707. function fillPropsinData (component, data, route, configProps) {
  43708. // resolve props
  43709. var propsToPass = data.props = resolveProps(route, configProps);
  43710. if (propsToPass) {
  43711. // clone to prevent mutation
  43712. propsToPass = data.props = extend({}, propsToPass);
  43713. // pass non-declared props as attrs
  43714. var attrs = data.attrs = data.attrs || {};
  43715. for (var key in propsToPass) {
  43716. if (!component.props || !(key in component.props)) {
  43717. attrs[key] = propsToPass[key];
  43718. delete propsToPass[key];
  43719. }
  43720. }
  43721. }
  43722. }
  43723. function resolveProps (route, config) {
  43724. switch (typeof config) {
  43725. case 'undefined':
  43726. return
  43727. case 'object':
  43728. return config
  43729. case 'function':
  43730. return config(route)
  43731. case 'boolean':
  43732. return config ? route.params : undefined
  43733. default:
  43734. if (true) {
  43735. warn(
  43736. false,
  43737. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  43738. "expecting an object, function or boolean."
  43739. );
  43740. }
  43741. }
  43742. }
  43743. /* */
  43744. var encodeReserveRE = /[!'()*]/g;
  43745. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  43746. var commaRE = /%2C/g;
  43747. // fixed encodeURIComponent which is more conformant to RFC3986:
  43748. // - escapes [!'()*]
  43749. // - preserve commas
  43750. var encode = function (str) { return encodeURIComponent(str)
  43751. .replace(encodeReserveRE, encodeReserveReplacer)
  43752. .replace(commaRE, ','); };
  43753. var decode = decodeURIComponent;
  43754. function resolveQuery (
  43755. query,
  43756. extraQuery,
  43757. _parseQuery
  43758. ) {
  43759. if ( extraQuery === void 0 ) extraQuery = {};
  43760. var parse = _parseQuery || parseQuery;
  43761. var parsedQuery;
  43762. try {
  43763. parsedQuery = parse(query || '');
  43764. } catch (e) {
  43765. true && warn(false, e.message);
  43766. parsedQuery = {};
  43767. }
  43768. for (var key in extraQuery) {
  43769. parsedQuery[key] = extraQuery[key];
  43770. }
  43771. return parsedQuery
  43772. }
  43773. function parseQuery (query) {
  43774. var res = {};
  43775. query = query.trim().replace(/^(\?|#|&)/, '');
  43776. if (!query) {
  43777. return res
  43778. }
  43779. query.split('&').forEach(function (param) {
  43780. var parts = param.replace(/\+/g, ' ').split('=');
  43781. var key = decode(parts.shift());
  43782. var val = parts.length > 0
  43783. ? decode(parts.join('='))
  43784. : null;
  43785. if (res[key] === undefined) {
  43786. res[key] = val;
  43787. } else if (Array.isArray(res[key])) {
  43788. res[key].push(val);
  43789. } else {
  43790. res[key] = [res[key], val];
  43791. }
  43792. });
  43793. return res
  43794. }
  43795. function stringifyQuery (obj) {
  43796. var res = obj ? Object.keys(obj).map(function (key) {
  43797. var val = obj[key];
  43798. if (val === undefined) {
  43799. return ''
  43800. }
  43801. if (val === null) {
  43802. return encode(key)
  43803. }
  43804. if (Array.isArray(val)) {
  43805. var result = [];
  43806. val.forEach(function (val2) {
  43807. if (val2 === undefined) {
  43808. return
  43809. }
  43810. if (val2 === null) {
  43811. result.push(encode(key));
  43812. } else {
  43813. result.push(encode(key) + '=' + encode(val2));
  43814. }
  43815. });
  43816. return result.join('&')
  43817. }
  43818. return encode(key) + '=' + encode(val)
  43819. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  43820. return res ? ("?" + res) : ''
  43821. }
  43822. /* */
  43823. var trailingSlashRE = /\/?$/;
  43824. function createRoute (
  43825. record,
  43826. location,
  43827. redirectedFrom,
  43828. router
  43829. ) {
  43830. var stringifyQuery = router && router.options.stringifyQuery;
  43831. var query = location.query || {};
  43832. try {
  43833. query = clone(query);
  43834. } catch (e) {}
  43835. var route = {
  43836. name: location.name || (record && record.name),
  43837. meta: (record && record.meta) || {},
  43838. path: location.path || '/',
  43839. hash: location.hash || '',
  43840. query: query,
  43841. params: location.params || {},
  43842. fullPath: getFullPath(location, stringifyQuery),
  43843. matched: record ? formatMatch(record) : []
  43844. };
  43845. if (redirectedFrom) {
  43846. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  43847. }
  43848. return Object.freeze(route)
  43849. }
  43850. function clone (value) {
  43851. if (Array.isArray(value)) {
  43852. return value.map(clone)
  43853. } else if (value && typeof value === 'object') {
  43854. var res = {};
  43855. for (var key in value) {
  43856. res[key] = clone(value[key]);
  43857. }
  43858. return res
  43859. } else {
  43860. return value
  43861. }
  43862. }
  43863. // the starting route that represents the initial state
  43864. var START = createRoute(null, {
  43865. path: '/'
  43866. });
  43867. function formatMatch (record) {
  43868. var res = [];
  43869. while (record) {
  43870. res.unshift(record);
  43871. record = record.parent;
  43872. }
  43873. return res
  43874. }
  43875. function getFullPath (
  43876. ref,
  43877. _stringifyQuery
  43878. ) {
  43879. var path = ref.path;
  43880. var query = ref.query; if ( query === void 0 ) query = {};
  43881. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  43882. var stringify = _stringifyQuery || stringifyQuery;
  43883. return (path || '/') + stringify(query) + hash
  43884. }
  43885. function isSameRoute (a, b) {
  43886. if (b === START) {
  43887. return a === b
  43888. } else if (!b) {
  43889. return false
  43890. } else if (a.path && b.path) {
  43891. return (
  43892. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  43893. a.hash === b.hash &&
  43894. isObjectEqual(a.query, b.query)
  43895. )
  43896. } else if (a.name && b.name) {
  43897. return (
  43898. a.name === b.name &&
  43899. a.hash === b.hash &&
  43900. isObjectEqual(a.query, b.query) &&
  43901. isObjectEqual(a.params, b.params)
  43902. )
  43903. } else {
  43904. return false
  43905. }
  43906. }
  43907. function isObjectEqual (a, b) {
  43908. if ( a === void 0 ) a = {};
  43909. if ( b === void 0 ) b = {};
  43910. // handle null value #1566
  43911. if (!a || !b) { return a === b }
  43912. var aKeys = Object.keys(a);
  43913. var bKeys = Object.keys(b);
  43914. if (aKeys.length !== bKeys.length) {
  43915. return false
  43916. }
  43917. return aKeys.every(function (key) {
  43918. var aVal = a[key];
  43919. var bVal = b[key];
  43920. // check nested equality
  43921. if (typeof aVal === 'object' && typeof bVal === 'object') {
  43922. return isObjectEqual(aVal, bVal)
  43923. }
  43924. return String(aVal) === String(bVal)
  43925. })
  43926. }
  43927. function isIncludedRoute (current, target) {
  43928. return (
  43929. current.path.replace(trailingSlashRE, '/').indexOf(
  43930. target.path.replace(trailingSlashRE, '/')
  43931. ) === 0 &&
  43932. (!target.hash || current.hash === target.hash) &&
  43933. queryIncludes(current.query, target.query)
  43934. )
  43935. }
  43936. function queryIncludes (current, target) {
  43937. for (var key in target) {
  43938. if (!(key in current)) {
  43939. return false
  43940. }
  43941. }
  43942. return true
  43943. }
  43944. /* */
  43945. function resolvePath (
  43946. relative,
  43947. base,
  43948. append
  43949. ) {
  43950. var firstChar = relative.charAt(0);
  43951. if (firstChar === '/') {
  43952. return relative
  43953. }
  43954. if (firstChar === '?' || firstChar === '#') {
  43955. return base + relative
  43956. }
  43957. var stack = base.split('/');
  43958. // remove trailing segment if:
  43959. // - not appending
  43960. // - appending to trailing slash (last segment is empty)
  43961. if (!append || !stack[stack.length - 1]) {
  43962. stack.pop();
  43963. }
  43964. // resolve relative path
  43965. var segments = relative.replace(/^\//, '').split('/');
  43966. for (var i = 0; i < segments.length; i++) {
  43967. var segment = segments[i];
  43968. if (segment === '..') {
  43969. stack.pop();
  43970. } else if (segment !== '.') {
  43971. stack.push(segment);
  43972. }
  43973. }
  43974. // ensure leading slash
  43975. if (stack[0] !== '') {
  43976. stack.unshift('');
  43977. }
  43978. return stack.join('/')
  43979. }
  43980. function parsePath (path) {
  43981. var hash = '';
  43982. var query = '';
  43983. var hashIndex = path.indexOf('#');
  43984. if (hashIndex >= 0) {
  43985. hash = path.slice(hashIndex);
  43986. path = path.slice(0, hashIndex);
  43987. }
  43988. var queryIndex = path.indexOf('?');
  43989. if (queryIndex >= 0) {
  43990. query = path.slice(queryIndex + 1);
  43991. path = path.slice(0, queryIndex);
  43992. }
  43993. return {
  43994. path: path,
  43995. query: query,
  43996. hash: hash
  43997. }
  43998. }
  43999. function cleanPath (path) {
  44000. return path.replace(/\/\//g, '/')
  44001. }
  44002. var isarray = Array.isArray || function (arr) {
  44003. return Object.prototype.toString.call(arr) == '[object Array]';
  44004. };
  44005. /**
  44006. * Expose `pathToRegexp`.
  44007. */
  44008. var pathToRegexp_1 = pathToRegexp;
  44009. var parse_1 = parse;
  44010. var compile_1 = compile;
  44011. var tokensToFunction_1 = tokensToFunction;
  44012. var tokensToRegExp_1 = tokensToRegExp;
  44013. /**
  44014. * The main path matching regexp utility.
  44015. *
  44016. * @type {RegExp}
  44017. */
  44018. var PATH_REGEXP = new RegExp([
  44019. // Match escaped characters that would otherwise appear in future matches.
  44020. // This allows the user to escape special characters that won't transform.
  44021. '(\\\\.)',
  44022. // Match Express-style parameters and un-named parameters with a prefix
  44023. // and optional suffixes. Matches appear as:
  44024. //
  44025. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  44026. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  44027. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  44028. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  44029. ].join('|'), 'g');
  44030. /**
  44031. * Parse a string for the raw tokens.
  44032. *
  44033. * @param {string} str
  44034. * @param {Object=} options
  44035. * @return {!Array}
  44036. */
  44037. function parse (str, options) {
  44038. var tokens = [];
  44039. var key = 0;
  44040. var index = 0;
  44041. var path = '';
  44042. var defaultDelimiter = options && options.delimiter || '/';
  44043. var res;
  44044. while ((res = PATH_REGEXP.exec(str)) != null) {
  44045. var m = res[0];
  44046. var escaped = res[1];
  44047. var offset = res.index;
  44048. path += str.slice(index, offset);
  44049. index = offset + m.length;
  44050. // Ignore already escaped sequences.
  44051. if (escaped) {
  44052. path += escaped[1];
  44053. continue
  44054. }
  44055. var next = str[index];
  44056. var prefix = res[2];
  44057. var name = res[3];
  44058. var capture = res[4];
  44059. var group = res[5];
  44060. var modifier = res[6];
  44061. var asterisk = res[7];
  44062. // Push the current path onto the tokens.
  44063. if (path) {
  44064. tokens.push(path);
  44065. path = '';
  44066. }
  44067. var partial = prefix != null && next != null && next !== prefix;
  44068. var repeat = modifier === '+' || modifier === '*';
  44069. var optional = modifier === '?' || modifier === '*';
  44070. var delimiter = res[2] || defaultDelimiter;
  44071. var pattern = capture || group;
  44072. tokens.push({
  44073. name: name || key++,
  44074. prefix: prefix || '',
  44075. delimiter: delimiter,
  44076. optional: optional,
  44077. repeat: repeat,
  44078. partial: partial,
  44079. asterisk: !!asterisk,
  44080. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  44081. });
  44082. }
  44083. // Match any characters still remaining.
  44084. if (index < str.length) {
  44085. path += str.substr(index);
  44086. }
  44087. // If the path exists, push it onto the end.
  44088. if (path) {
  44089. tokens.push(path);
  44090. }
  44091. return tokens
  44092. }
  44093. /**
  44094. * Compile a string to a template function for the path.
  44095. *
  44096. * @param {string} str
  44097. * @param {Object=} options
  44098. * @return {!function(Object=, Object=)}
  44099. */
  44100. function compile (str, options) {
  44101. return tokensToFunction(parse(str, options))
  44102. }
  44103. /**
  44104. * Prettier encoding of URI path segments.
  44105. *
  44106. * @param {string}
  44107. * @return {string}
  44108. */
  44109. function encodeURIComponentPretty (str) {
  44110. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  44111. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  44112. })
  44113. }
  44114. /**
  44115. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  44116. *
  44117. * @param {string}
  44118. * @return {string}
  44119. */
  44120. function encodeAsterisk (str) {
  44121. return encodeURI(str).replace(/[?#]/g, function (c) {
  44122. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  44123. })
  44124. }
  44125. /**
  44126. * Expose a method for transforming tokens into the path function.
  44127. */
  44128. function tokensToFunction (tokens) {
  44129. // Compile all the tokens into regexps.
  44130. var matches = new Array(tokens.length);
  44131. // Compile all the patterns before compilation.
  44132. for (var i = 0; i < tokens.length; i++) {
  44133. if (typeof tokens[i] === 'object') {
  44134. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  44135. }
  44136. }
  44137. return function (obj, opts) {
  44138. var path = '';
  44139. var data = obj || {};
  44140. var options = opts || {};
  44141. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  44142. for (var i = 0; i < tokens.length; i++) {
  44143. var token = tokens[i];
  44144. if (typeof token === 'string') {
  44145. path += token;
  44146. continue
  44147. }
  44148. var value = data[token.name];
  44149. var segment;
  44150. if (value == null) {
  44151. if (token.optional) {
  44152. // Prepend partial segment prefixes.
  44153. if (token.partial) {
  44154. path += token.prefix;
  44155. }
  44156. continue
  44157. } else {
  44158. throw new TypeError('Expected "' + token.name + '" to be defined')
  44159. }
  44160. }
  44161. if (isarray(value)) {
  44162. if (!token.repeat) {
  44163. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  44164. }
  44165. if (value.length === 0) {
  44166. if (token.optional) {
  44167. continue
  44168. } else {
  44169. throw new TypeError('Expected "' + token.name + '" to not be empty')
  44170. }
  44171. }
  44172. for (var j = 0; j < value.length; j++) {
  44173. segment = encode(value[j]);
  44174. if (!matches[i].test(segment)) {
  44175. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  44176. }
  44177. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  44178. }
  44179. continue
  44180. }
  44181. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  44182. if (!matches[i].test(segment)) {
  44183. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  44184. }
  44185. path += token.prefix + segment;
  44186. }
  44187. return path
  44188. }
  44189. }
  44190. /**
  44191. * Escape a regular expression string.
  44192. *
  44193. * @param {string} str
  44194. * @return {string}
  44195. */
  44196. function escapeString (str) {
  44197. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  44198. }
  44199. /**
  44200. * Escape the capturing group by escaping special characters and meaning.
  44201. *
  44202. * @param {string} group
  44203. * @return {string}
  44204. */
  44205. function escapeGroup (group) {
  44206. return group.replace(/([=!:$\/()])/g, '\\$1')
  44207. }
  44208. /**
  44209. * Attach the keys as a property of the regexp.
  44210. *
  44211. * @param {!RegExp} re
  44212. * @param {Array} keys
  44213. * @return {!RegExp}
  44214. */
  44215. function attachKeys (re, keys) {
  44216. re.keys = keys;
  44217. return re
  44218. }
  44219. /**
  44220. * Get the flags for a regexp from the options.
  44221. *
  44222. * @param {Object} options
  44223. * @return {string}
  44224. */
  44225. function flags (options) {
  44226. return options.sensitive ? '' : 'i'
  44227. }
  44228. /**
  44229. * Pull out keys from a regexp.
  44230. *
  44231. * @param {!RegExp} path
  44232. * @param {!Array} keys
  44233. * @return {!RegExp}
  44234. */
  44235. function regexpToRegexp (path, keys) {
  44236. // Use a negative lookahead to match only capturing groups.
  44237. var groups = path.source.match(/\((?!\?)/g);
  44238. if (groups) {
  44239. for (var i = 0; i < groups.length; i++) {
  44240. keys.push({
  44241. name: i,
  44242. prefix: null,
  44243. delimiter: null,
  44244. optional: false,
  44245. repeat: false,
  44246. partial: false,
  44247. asterisk: false,
  44248. pattern: null
  44249. });
  44250. }
  44251. }
  44252. return attachKeys(path, keys)
  44253. }
  44254. /**
  44255. * Transform an array into a regexp.
  44256. *
  44257. * @param {!Array} path
  44258. * @param {Array} keys
  44259. * @param {!Object} options
  44260. * @return {!RegExp}
  44261. */
  44262. function arrayToRegexp (path, keys, options) {
  44263. var parts = [];
  44264. for (var i = 0; i < path.length; i++) {
  44265. parts.push(pathToRegexp(path[i], keys, options).source);
  44266. }
  44267. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  44268. return attachKeys(regexp, keys)
  44269. }
  44270. /**
  44271. * Create a path regexp from string input.
  44272. *
  44273. * @param {string} path
  44274. * @param {!Array} keys
  44275. * @param {!Object} options
  44276. * @return {!RegExp}
  44277. */
  44278. function stringToRegexp (path, keys, options) {
  44279. return tokensToRegExp(parse(path, options), keys, options)
  44280. }
  44281. /**
  44282. * Expose a function for taking tokens and returning a RegExp.
  44283. *
  44284. * @param {!Array} tokens
  44285. * @param {(Array|Object)=} keys
  44286. * @param {Object=} options
  44287. * @return {!RegExp}
  44288. */
  44289. function tokensToRegExp (tokens, keys, options) {
  44290. if (!isarray(keys)) {
  44291. options = /** @type {!Object} */ (keys || options);
  44292. keys = [];
  44293. }
  44294. options = options || {};
  44295. var strict = options.strict;
  44296. var end = options.end !== false;
  44297. var route = '';
  44298. // Iterate over the tokens and create our regexp string.
  44299. for (var i = 0; i < tokens.length; i++) {
  44300. var token = tokens[i];
  44301. if (typeof token === 'string') {
  44302. route += escapeString(token);
  44303. } else {
  44304. var prefix = escapeString(token.prefix);
  44305. var capture = '(?:' + token.pattern + ')';
  44306. keys.push(token);
  44307. if (token.repeat) {
  44308. capture += '(?:' + prefix + capture + ')*';
  44309. }
  44310. if (token.optional) {
  44311. if (!token.partial) {
  44312. capture = '(?:' + prefix + '(' + capture + '))?';
  44313. } else {
  44314. capture = prefix + '(' + capture + ')?';
  44315. }
  44316. } else {
  44317. capture = prefix + '(' + capture + ')';
  44318. }
  44319. route += capture;
  44320. }
  44321. }
  44322. var delimiter = escapeString(options.delimiter || '/');
  44323. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  44324. // In non-strict mode we allow a slash at the end of match. If the path to
  44325. // match already ends with a slash, we remove it for consistency. The slash
  44326. // is valid at the end of a path match, not in the middle. This is important
  44327. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  44328. if (!strict) {
  44329. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  44330. }
  44331. if (end) {
  44332. route += '$';
  44333. } else {
  44334. // In non-ending mode, we need the capturing groups to match as much as
  44335. // possible by using a positive lookahead to the end or next path segment.
  44336. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  44337. }
  44338. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  44339. }
  44340. /**
  44341. * Normalize the given path string, returning a regular expression.
  44342. *
  44343. * An empty array can be passed in for the keys, which will hold the
  44344. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  44345. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  44346. *
  44347. * @param {(string|RegExp|Array)} path
  44348. * @param {(Array|Object)=} keys
  44349. * @param {Object=} options
  44350. * @return {!RegExp}
  44351. */
  44352. function pathToRegexp (path, keys, options) {
  44353. if (!isarray(keys)) {
  44354. options = /** @type {!Object} */ (keys || options);
  44355. keys = [];
  44356. }
  44357. options = options || {};
  44358. if (path instanceof RegExp) {
  44359. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  44360. }
  44361. if (isarray(path)) {
  44362. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  44363. }
  44364. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  44365. }
  44366. pathToRegexp_1.parse = parse_1;
  44367. pathToRegexp_1.compile = compile_1;
  44368. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  44369. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  44370. /* */
  44371. // $flow-disable-line
  44372. var regexpCompileCache = Object.create(null);
  44373. function fillParams (
  44374. path,
  44375. params,
  44376. routeMsg
  44377. ) {
  44378. params = params || {};
  44379. try {
  44380. var filler =
  44381. regexpCompileCache[path] ||
  44382. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  44383. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  44384. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  44385. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  44386. return filler(params, { pretty: true })
  44387. } catch (e) {
  44388. if (true) {
  44389. // Fix #3072 no warn if `pathMatch` is string
  44390. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  44391. }
  44392. return ''
  44393. } finally {
  44394. // delete the 0 if it was added
  44395. delete params[0];
  44396. }
  44397. }
  44398. /* */
  44399. function normalizeLocation (
  44400. raw,
  44401. current,
  44402. append,
  44403. router
  44404. ) {
  44405. var next = typeof raw === 'string' ? { path: raw } : raw;
  44406. // named target
  44407. if (next._normalized) {
  44408. return next
  44409. } else if (next.name) {
  44410. next = extend({}, raw);
  44411. var params = next.params;
  44412. if (params && typeof params === 'object') {
  44413. next.params = extend({}, params);
  44414. }
  44415. return next
  44416. }
  44417. // relative params
  44418. if (!next.path && next.params && current) {
  44419. next = extend({}, next);
  44420. next._normalized = true;
  44421. var params$1 = extend(extend({}, current.params), next.params);
  44422. if (current.name) {
  44423. next.name = current.name;
  44424. next.params = params$1;
  44425. } else if (current.matched.length) {
  44426. var rawPath = current.matched[current.matched.length - 1].path;
  44427. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  44428. } else if (true) {
  44429. warn(false, "relative params navigation requires a current route.");
  44430. }
  44431. return next
  44432. }
  44433. var parsedPath = parsePath(next.path || '');
  44434. var basePath = (current && current.path) || '/';
  44435. var path = parsedPath.path
  44436. ? resolvePath(parsedPath.path, basePath, append || next.append)
  44437. : basePath;
  44438. var query = resolveQuery(
  44439. parsedPath.query,
  44440. next.query,
  44441. router && router.options.parseQuery
  44442. );
  44443. var hash = next.hash || parsedPath.hash;
  44444. if (hash && hash.charAt(0) !== '#') {
  44445. hash = "#" + hash;
  44446. }
  44447. return {
  44448. _normalized: true,
  44449. path: path,
  44450. query: query,
  44451. hash: hash
  44452. }
  44453. }
  44454. /* */
  44455. // work around weird flow bug
  44456. var toTypes = [String, Object];
  44457. var eventTypes = [String, Array];
  44458. var noop = function () {};
  44459. var Link = {
  44460. name: 'RouterLink',
  44461. props: {
  44462. to: {
  44463. type: toTypes,
  44464. required: true
  44465. },
  44466. tag: {
  44467. type: String,
  44468. default: 'a'
  44469. },
  44470. exact: Boolean,
  44471. append: Boolean,
  44472. replace: Boolean,
  44473. activeClass: String,
  44474. exactActiveClass: String,
  44475. event: {
  44476. type: eventTypes,
  44477. default: 'click'
  44478. }
  44479. },
  44480. render: function render (h) {
  44481. var this$1 = this;
  44482. var router = this.$router;
  44483. var current = this.$route;
  44484. var ref = router.resolve(
  44485. this.to,
  44486. current,
  44487. this.append
  44488. );
  44489. var location = ref.location;
  44490. var route = ref.route;
  44491. var href = ref.href;
  44492. var classes = {};
  44493. var globalActiveClass = router.options.linkActiveClass;
  44494. var globalExactActiveClass = router.options.linkExactActiveClass;
  44495. // Support global empty active class
  44496. var activeClassFallback =
  44497. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  44498. var exactActiveClassFallback =
  44499. globalExactActiveClass == null
  44500. ? 'router-link-exact-active'
  44501. : globalExactActiveClass;
  44502. var activeClass =
  44503. this.activeClass == null ? activeClassFallback : this.activeClass;
  44504. var exactActiveClass =
  44505. this.exactActiveClass == null
  44506. ? exactActiveClassFallback
  44507. : this.exactActiveClass;
  44508. var compareTarget = route.redirectedFrom
  44509. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  44510. : route;
  44511. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  44512. classes[activeClass] = this.exact
  44513. ? classes[exactActiveClass]
  44514. : isIncludedRoute(current, compareTarget);
  44515. var handler = function (e) {
  44516. if (guardEvent(e)) {
  44517. if (this$1.replace) {
  44518. router.replace(location, noop);
  44519. } else {
  44520. router.push(location, noop);
  44521. }
  44522. }
  44523. };
  44524. var on = { click: guardEvent };
  44525. if (Array.isArray(this.event)) {
  44526. this.event.forEach(function (e) {
  44527. on[e] = handler;
  44528. });
  44529. } else {
  44530. on[this.event] = handler;
  44531. }
  44532. var data = { class: classes };
  44533. var scopedSlot =
  44534. !this.$scopedSlots.$hasNormal &&
  44535. this.$scopedSlots.default &&
  44536. this.$scopedSlots.default({
  44537. href: href,
  44538. route: route,
  44539. navigate: handler,
  44540. isActive: classes[activeClass],
  44541. isExactActive: classes[exactActiveClass]
  44542. });
  44543. if (scopedSlot) {
  44544. if (scopedSlot.length === 1) {
  44545. return scopedSlot[0]
  44546. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  44547. if (true) {
  44548. warn(
  44549. false,
  44550. ("RouterLink with to=\"" + (this.to) + "\" is trying to use a scoped slot but it didn't provide exactly one child. Wrapping the content with a span element.")
  44551. );
  44552. }
  44553. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  44554. }
  44555. }
  44556. if (this.tag === 'a') {
  44557. data.on = on;
  44558. data.attrs = { href: href };
  44559. } else {
  44560. // find the first <a> child and apply listener and href
  44561. var a = findAnchor(this.$slots.default);
  44562. if (a) {
  44563. // in case the <a> is a static node
  44564. a.isStatic = false;
  44565. var aData = (a.data = extend({}, a.data));
  44566. aData.on = aData.on || {};
  44567. // transform existing events in both objects into arrays so we can push later
  44568. for (var event in aData.on) {
  44569. var handler$1 = aData.on[event];
  44570. if (event in on) {
  44571. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  44572. }
  44573. }
  44574. // append new listeners for router-link
  44575. for (var event$1 in on) {
  44576. if (event$1 in aData.on) {
  44577. // on[event] is always a function
  44578. aData.on[event$1].push(on[event$1]);
  44579. } else {
  44580. aData.on[event$1] = handler;
  44581. }
  44582. }
  44583. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  44584. aAttrs.href = href;
  44585. } else {
  44586. // doesn't have <a> child, apply listener to self
  44587. data.on = on;
  44588. }
  44589. }
  44590. return h(this.tag, data, this.$slots.default)
  44591. }
  44592. };
  44593. function guardEvent (e) {
  44594. // don't redirect with control keys
  44595. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  44596. // don't redirect when preventDefault called
  44597. if (e.defaultPrevented) { return }
  44598. // don't redirect on right click
  44599. if (e.button !== undefined && e.button !== 0) { return }
  44600. // don't redirect if `target="_blank"`
  44601. if (e.currentTarget && e.currentTarget.getAttribute) {
  44602. var target = e.currentTarget.getAttribute('target');
  44603. if (/\b_blank\b/i.test(target)) { return }
  44604. }
  44605. // this may be a Weex event which doesn't have this method
  44606. if (e.preventDefault) {
  44607. e.preventDefault();
  44608. }
  44609. return true
  44610. }
  44611. function findAnchor (children) {
  44612. if (children) {
  44613. var child;
  44614. for (var i = 0; i < children.length; i++) {
  44615. child = children[i];
  44616. if (child.tag === 'a') {
  44617. return child
  44618. }
  44619. if (child.children && (child = findAnchor(child.children))) {
  44620. return child
  44621. }
  44622. }
  44623. }
  44624. }
  44625. var _Vue;
  44626. function install (Vue) {
  44627. if (install.installed && _Vue === Vue) { return }
  44628. install.installed = true;
  44629. _Vue = Vue;
  44630. var isDef = function (v) { return v !== undefined; };
  44631. var registerInstance = function (vm, callVal) {
  44632. var i = vm.$options._parentVnode;
  44633. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  44634. i(vm, callVal);
  44635. }
  44636. };
  44637. Vue.mixin({
  44638. beforeCreate: function beforeCreate () {
  44639. if (isDef(this.$options.router)) {
  44640. this._routerRoot = this;
  44641. this._router = this.$options.router;
  44642. this._router.init(this);
  44643. Vue.util.defineReactive(this, '_route', this._router.history.current);
  44644. } else {
  44645. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  44646. }
  44647. registerInstance(this, this);
  44648. },
  44649. destroyed: function destroyed () {
  44650. registerInstance(this);
  44651. }
  44652. });
  44653. Object.defineProperty(Vue.prototype, '$router', {
  44654. get: function get () { return this._routerRoot._router }
  44655. });
  44656. Object.defineProperty(Vue.prototype, '$route', {
  44657. get: function get () { return this._routerRoot._route }
  44658. });
  44659. Vue.component('RouterView', View);
  44660. Vue.component('RouterLink', Link);
  44661. var strats = Vue.config.optionMergeStrategies;
  44662. // use the same hook merging strategy for route hooks
  44663. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  44664. }
  44665. /* */
  44666. var inBrowser = typeof window !== 'undefined';
  44667. /* */
  44668. function createRouteMap (
  44669. routes,
  44670. oldPathList,
  44671. oldPathMap,
  44672. oldNameMap
  44673. ) {
  44674. // the path list is used to control path matching priority
  44675. var pathList = oldPathList || [];
  44676. // $flow-disable-line
  44677. var pathMap = oldPathMap || Object.create(null);
  44678. // $flow-disable-line
  44679. var nameMap = oldNameMap || Object.create(null);
  44680. routes.forEach(function (route) {
  44681. addRouteRecord(pathList, pathMap, nameMap, route);
  44682. });
  44683. // ensure wildcard routes are always at the end
  44684. for (var i = 0, l = pathList.length; i < l; i++) {
  44685. if (pathList[i] === '*') {
  44686. pathList.push(pathList.splice(i, 1)[0]);
  44687. l--;
  44688. i--;
  44689. }
  44690. }
  44691. if (true) {
  44692. // warn if routes do not include leading slashes
  44693. var found = pathList
  44694. // check for missing leading slash
  44695. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  44696. if (found.length > 0) {
  44697. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  44698. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  44699. }
  44700. }
  44701. return {
  44702. pathList: pathList,
  44703. pathMap: pathMap,
  44704. nameMap: nameMap
  44705. }
  44706. }
  44707. function addRouteRecord (
  44708. pathList,
  44709. pathMap,
  44710. nameMap,
  44711. route,
  44712. parent,
  44713. matchAs
  44714. ) {
  44715. var path = route.path;
  44716. var name = route.name;
  44717. if (true) {
  44718. assert(path != null, "\"path\" is required in a route configuration.");
  44719. assert(
  44720. typeof route.component !== 'string',
  44721. "route config \"component\" for path: " + (String(
  44722. path || name
  44723. )) + " cannot be a " + "string id. Use an actual component instead."
  44724. );
  44725. }
  44726. var pathToRegexpOptions =
  44727. route.pathToRegexpOptions || {};
  44728. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  44729. if (typeof route.caseSensitive === 'boolean') {
  44730. pathToRegexpOptions.sensitive = route.caseSensitive;
  44731. }
  44732. var record = {
  44733. path: normalizedPath,
  44734. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  44735. components: route.components || { default: route.component },
  44736. instances: {},
  44737. name: name,
  44738. parent: parent,
  44739. matchAs: matchAs,
  44740. redirect: route.redirect,
  44741. beforeEnter: route.beforeEnter,
  44742. meta: route.meta || {},
  44743. props:
  44744. route.props == null
  44745. ? {}
  44746. : route.components
  44747. ? route.props
  44748. : { default: route.props }
  44749. };
  44750. if (route.children) {
  44751. // Warn if route is named, does not redirect and has a default child route.
  44752. // If users navigate to this route by name, the default child will
  44753. // not be rendered (GH Issue #629)
  44754. if (true) {
  44755. if (
  44756. route.name &&
  44757. !route.redirect &&
  44758. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  44759. ) {
  44760. warn(
  44761. false,
  44762. "Named Route '" + (route.name) + "' has a default child route. " +
  44763. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  44764. "the default child route will not be rendered. Remove the name from " +
  44765. "this route and use the name of the default child route for named " +
  44766. "links instead."
  44767. );
  44768. }
  44769. }
  44770. route.children.forEach(function (child) {
  44771. var childMatchAs = matchAs
  44772. ? cleanPath((matchAs + "/" + (child.path)))
  44773. : undefined;
  44774. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  44775. });
  44776. }
  44777. if (!pathMap[record.path]) {
  44778. pathList.push(record.path);
  44779. pathMap[record.path] = record;
  44780. }
  44781. if (route.alias !== undefined) {
  44782. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  44783. for (var i = 0; i < aliases.length; ++i) {
  44784. var alias = aliases[i];
  44785. if ( true && alias === path) {
  44786. warn(
  44787. false,
  44788. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  44789. );
  44790. // skip in dev to make it work
  44791. continue
  44792. }
  44793. var aliasRoute = {
  44794. path: alias,
  44795. children: route.children
  44796. };
  44797. addRouteRecord(
  44798. pathList,
  44799. pathMap,
  44800. nameMap,
  44801. aliasRoute,
  44802. parent,
  44803. record.path || '/' // matchAs
  44804. );
  44805. }
  44806. }
  44807. if (name) {
  44808. if (!nameMap[name]) {
  44809. nameMap[name] = record;
  44810. } else if ( true && !matchAs) {
  44811. warn(
  44812. false,
  44813. "Duplicate named routes definition: " +
  44814. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  44815. );
  44816. }
  44817. }
  44818. }
  44819. function compileRouteRegex (
  44820. path,
  44821. pathToRegexpOptions
  44822. ) {
  44823. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  44824. if (true) {
  44825. var keys = Object.create(null);
  44826. regex.keys.forEach(function (key) {
  44827. warn(
  44828. !keys[key.name],
  44829. ("Duplicate param keys in route with path: \"" + path + "\"")
  44830. );
  44831. keys[key.name] = true;
  44832. });
  44833. }
  44834. return regex
  44835. }
  44836. function normalizePath (
  44837. path,
  44838. parent,
  44839. strict
  44840. ) {
  44841. if (!strict) { path = path.replace(/\/$/, ''); }
  44842. if (path[0] === '/') { return path }
  44843. if (parent == null) { return path }
  44844. return cleanPath(((parent.path) + "/" + path))
  44845. }
  44846. /* */
  44847. function createMatcher (
  44848. routes,
  44849. router
  44850. ) {
  44851. var ref = createRouteMap(routes);
  44852. var pathList = ref.pathList;
  44853. var pathMap = ref.pathMap;
  44854. var nameMap = ref.nameMap;
  44855. function addRoutes (routes) {
  44856. createRouteMap(routes, pathList, pathMap, nameMap);
  44857. }
  44858. function match (
  44859. raw,
  44860. currentRoute,
  44861. redirectedFrom
  44862. ) {
  44863. var location = normalizeLocation(raw, currentRoute, false, router);
  44864. var name = location.name;
  44865. if (name) {
  44866. var record = nameMap[name];
  44867. if (true) {
  44868. warn(record, ("Route with name '" + name + "' does not exist"));
  44869. }
  44870. if (!record) { return _createRoute(null, location) }
  44871. var paramNames = record.regex.keys
  44872. .filter(function (key) { return !key.optional; })
  44873. .map(function (key) { return key.name; });
  44874. if (typeof location.params !== 'object') {
  44875. location.params = {};
  44876. }
  44877. if (currentRoute && typeof currentRoute.params === 'object') {
  44878. for (var key in currentRoute.params) {
  44879. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  44880. location.params[key] = currentRoute.params[key];
  44881. }
  44882. }
  44883. }
  44884. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  44885. return _createRoute(record, location, redirectedFrom)
  44886. } else if (location.path) {
  44887. location.params = {};
  44888. for (var i = 0; i < pathList.length; i++) {
  44889. var path = pathList[i];
  44890. var record$1 = pathMap[path];
  44891. if (matchRoute(record$1.regex, location.path, location.params)) {
  44892. return _createRoute(record$1, location, redirectedFrom)
  44893. }
  44894. }
  44895. }
  44896. // no match
  44897. return _createRoute(null, location)
  44898. }
  44899. function redirect (
  44900. record,
  44901. location
  44902. ) {
  44903. var originalRedirect = record.redirect;
  44904. var redirect = typeof originalRedirect === 'function'
  44905. ? originalRedirect(createRoute(record, location, null, router))
  44906. : originalRedirect;
  44907. if (typeof redirect === 'string') {
  44908. redirect = { path: redirect };
  44909. }
  44910. if (!redirect || typeof redirect !== 'object') {
  44911. if (true) {
  44912. warn(
  44913. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  44914. );
  44915. }
  44916. return _createRoute(null, location)
  44917. }
  44918. var re = redirect;
  44919. var name = re.name;
  44920. var path = re.path;
  44921. var query = location.query;
  44922. var hash = location.hash;
  44923. var params = location.params;
  44924. query = re.hasOwnProperty('query') ? re.query : query;
  44925. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  44926. params = re.hasOwnProperty('params') ? re.params : params;
  44927. if (name) {
  44928. // resolved named direct
  44929. var targetRecord = nameMap[name];
  44930. if (true) {
  44931. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  44932. }
  44933. return match({
  44934. _normalized: true,
  44935. name: name,
  44936. query: query,
  44937. hash: hash,
  44938. params: params
  44939. }, undefined, location)
  44940. } else if (path) {
  44941. // 1. resolve relative redirect
  44942. var rawPath = resolveRecordPath(path, record);
  44943. // 2. resolve params
  44944. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  44945. // 3. rematch with existing query and hash
  44946. return match({
  44947. _normalized: true,
  44948. path: resolvedPath,
  44949. query: query,
  44950. hash: hash
  44951. }, undefined, location)
  44952. } else {
  44953. if (true) {
  44954. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  44955. }
  44956. return _createRoute(null, location)
  44957. }
  44958. }
  44959. function alias (
  44960. record,
  44961. location,
  44962. matchAs
  44963. ) {
  44964. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  44965. var aliasedMatch = match({
  44966. _normalized: true,
  44967. path: aliasedPath
  44968. });
  44969. if (aliasedMatch) {
  44970. var matched = aliasedMatch.matched;
  44971. var aliasedRecord = matched[matched.length - 1];
  44972. location.params = aliasedMatch.params;
  44973. return _createRoute(aliasedRecord, location)
  44974. }
  44975. return _createRoute(null, location)
  44976. }
  44977. function _createRoute (
  44978. record,
  44979. location,
  44980. redirectedFrom
  44981. ) {
  44982. if (record && record.redirect) {
  44983. return redirect(record, redirectedFrom || location)
  44984. }
  44985. if (record && record.matchAs) {
  44986. return alias(record, location, record.matchAs)
  44987. }
  44988. return createRoute(record, location, redirectedFrom, router)
  44989. }
  44990. return {
  44991. match: match,
  44992. addRoutes: addRoutes
  44993. }
  44994. }
  44995. function matchRoute (
  44996. regex,
  44997. path,
  44998. params
  44999. ) {
  45000. var m = path.match(regex);
  45001. if (!m) {
  45002. return false
  45003. } else if (!params) {
  45004. return true
  45005. }
  45006. for (var i = 1, len = m.length; i < len; ++i) {
  45007. var key = regex.keys[i - 1];
  45008. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  45009. if (key) {
  45010. // Fix #1994: using * with props: true generates a param named 0
  45011. params[key.name || 'pathMatch'] = val;
  45012. }
  45013. }
  45014. return true
  45015. }
  45016. function resolveRecordPath (path, record) {
  45017. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  45018. }
  45019. /* */
  45020. // use User Timing api (if present) for more accurate key precision
  45021. var Time =
  45022. inBrowser && window.performance && window.performance.now
  45023. ? window.performance
  45024. : Date;
  45025. function genStateKey () {
  45026. return Time.now().toFixed(3)
  45027. }
  45028. var _key = genStateKey();
  45029. function getStateKey () {
  45030. return _key
  45031. }
  45032. function setStateKey (key) {
  45033. return (_key = key)
  45034. }
  45035. /* */
  45036. var positionStore = Object.create(null);
  45037. function setupScroll () {
  45038. // Fix for #1585 for Firefox
  45039. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  45040. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  45041. // window.location.protocol + '//' + window.location.host
  45042. // location.host contains the port and location.hostname doesn't
  45043. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  45044. var absolutePath = window.location.href.replace(protocolAndPath, '');
  45045. // preserve existing history state as it could be overriden by the user
  45046. var stateCopy = extend({}, window.history.state);
  45047. stateCopy.key = getStateKey();
  45048. window.history.replaceState(stateCopy, '', absolutePath);
  45049. window.addEventListener('popstate', function (e) {
  45050. saveScrollPosition();
  45051. if (e.state && e.state.key) {
  45052. setStateKey(e.state.key);
  45053. }
  45054. });
  45055. }
  45056. function handleScroll (
  45057. router,
  45058. to,
  45059. from,
  45060. isPop
  45061. ) {
  45062. if (!router.app) {
  45063. return
  45064. }
  45065. var behavior = router.options.scrollBehavior;
  45066. if (!behavior) {
  45067. return
  45068. }
  45069. if (true) {
  45070. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  45071. }
  45072. // wait until re-render finishes before scrolling
  45073. router.app.$nextTick(function () {
  45074. var position = getScrollPosition();
  45075. var shouldScroll = behavior.call(
  45076. router,
  45077. to,
  45078. from,
  45079. isPop ? position : null
  45080. );
  45081. if (!shouldScroll) {
  45082. return
  45083. }
  45084. if (typeof shouldScroll.then === 'function') {
  45085. shouldScroll
  45086. .then(function (shouldScroll) {
  45087. scrollToPosition((shouldScroll), position);
  45088. })
  45089. .catch(function (err) {
  45090. if (true) {
  45091. assert(false, err.toString());
  45092. }
  45093. });
  45094. } else {
  45095. scrollToPosition(shouldScroll, position);
  45096. }
  45097. });
  45098. }
  45099. function saveScrollPosition () {
  45100. var key = getStateKey();
  45101. if (key) {
  45102. positionStore[key] = {
  45103. x: window.pageXOffset,
  45104. y: window.pageYOffset
  45105. };
  45106. }
  45107. }
  45108. function getScrollPosition () {
  45109. var key = getStateKey();
  45110. if (key) {
  45111. return positionStore[key]
  45112. }
  45113. }
  45114. function getElementPosition (el, offset) {
  45115. var docEl = document.documentElement;
  45116. var docRect = docEl.getBoundingClientRect();
  45117. var elRect = el.getBoundingClientRect();
  45118. return {
  45119. x: elRect.left - docRect.left - offset.x,
  45120. y: elRect.top - docRect.top - offset.y
  45121. }
  45122. }
  45123. function isValidPosition (obj) {
  45124. return isNumber(obj.x) || isNumber(obj.y)
  45125. }
  45126. function normalizePosition (obj) {
  45127. return {
  45128. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  45129. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  45130. }
  45131. }
  45132. function normalizeOffset (obj) {
  45133. return {
  45134. x: isNumber(obj.x) ? obj.x : 0,
  45135. y: isNumber(obj.y) ? obj.y : 0
  45136. }
  45137. }
  45138. function isNumber (v) {
  45139. return typeof v === 'number'
  45140. }
  45141. var hashStartsWithNumberRE = /^#\d/;
  45142. function scrollToPosition (shouldScroll, position) {
  45143. var isObject = typeof shouldScroll === 'object';
  45144. if (isObject && typeof shouldScroll.selector === 'string') {
  45145. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  45146. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  45147. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  45148. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  45149. : document.querySelector(shouldScroll.selector);
  45150. if (el) {
  45151. var offset =
  45152. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  45153. ? shouldScroll.offset
  45154. : {};
  45155. offset = normalizeOffset(offset);
  45156. position = getElementPosition(el, offset);
  45157. } else if (isValidPosition(shouldScroll)) {
  45158. position = normalizePosition(shouldScroll);
  45159. }
  45160. } else if (isObject && isValidPosition(shouldScroll)) {
  45161. position = normalizePosition(shouldScroll);
  45162. }
  45163. if (position) {
  45164. window.scrollTo(position.x, position.y);
  45165. }
  45166. }
  45167. /* */
  45168. var supportsPushState =
  45169. inBrowser &&
  45170. (function () {
  45171. var ua = window.navigator.userAgent;
  45172. if (
  45173. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  45174. ua.indexOf('Mobile Safari') !== -1 &&
  45175. ua.indexOf('Chrome') === -1 &&
  45176. ua.indexOf('Windows Phone') === -1
  45177. ) {
  45178. return false
  45179. }
  45180. return window.history && 'pushState' in window.history
  45181. })();
  45182. function pushState (url, replace) {
  45183. saveScrollPosition();
  45184. // try...catch the pushState call to get around Safari
  45185. // DOM Exception 18 where it limits to 100 pushState calls
  45186. var history = window.history;
  45187. try {
  45188. if (replace) {
  45189. // preserve existing history state as it could be overriden by the user
  45190. var stateCopy = extend({}, history.state);
  45191. stateCopy.key = getStateKey();
  45192. history.replaceState(stateCopy, '', url);
  45193. } else {
  45194. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  45195. }
  45196. } catch (e) {
  45197. window.location[replace ? 'replace' : 'assign'](url);
  45198. }
  45199. }
  45200. function replaceState (url) {
  45201. pushState(url, true);
  45202. }
  45203. /* */
  45204. function runQueue (queue, fn, cb) {
  45205. var step = function (index) {
  45206. if (index >= queue.length) {
  45207. cb();
  45208. } else {
  45209. if (queue[index]) {
  45210. fn(queue[index], function () {
  45211. step(index + 1);
  45212. });
  45213. } else {
  45214. step(index + 1);
  45215. }
  45216. }
  45217. };
  45218. step(0);
  45219. }
  45220. /* */
  45221. function resolveAsyncComponents (matched) {
  45222. return function (to, from, next) {
  45223. var hasAsync = false;
  45224. var pending = 0;
  45225. var error = null;
  45226. flatMapComponents(matched, function (def, _, match, key) {
  45227. // if it's a function and doesn't have cid attached,
  45228. // assume it's an async component resolve function.
  45229. // we are not using Vue's default async resolving mechanism because
  45230. // we want to halt the navigation until the incoming component has been
  45231. // resolved.
  45232. if (typeof def === 'function' && def.cid === undefined) {
  45233. hasAsync = true;
  45234. pending++;
  45235. var resolve = once(function (resolvedDef) {
  45236. if (isESModule(resolvedDef)) {
  45237. resolvedDef = resolvedDef.default;
  45238. }
  45239. // save resolved on async factory in case it's used elsewhere
  45240. def.resolved = typeof resolvedDef === 'function'
  45241. ? resolvedDef
  45242. : _Vue.extend(resolvedDef);
  45243. match.components[key] = resolvedDef;
  45244. pending--;
  45245. if (pending <= 0) {
  45246. next();
  45247. }
  45248. });
  45249. var reject = once(function (reason) {
  45250. var msg = "Failed to resolve async component " + key + ": " + reason;
  45251. true && warn(false, msg);
  45252. if (!error) {
  45253. error = isError(reason)
  45254. ? reason
  45255. : new Error(msg);
  45256. next(error);
  45257. }
  45258. });
  45259. var res;
  45260. try {
  45261. res = def(resolve, reject);
  45262. } catch (e) {
  45263. reject(e);
  45264. }
  45265. if (res) {
  45266. if (typeof res.then === 'function') {
  45267. res.then(resolve, reject);
  45268. } else {
  45269. // new syntax in Vue 2.3
  45270. var comp = res.component;
  45271. if (comp && typeof comp.then === 'function') {
  45272. comp.then(resolve, reject);
  45273. }
  45274. }
  45275. }
  45276. }
  45277. });
  45278. if (!hasAsync) { next(); }
  45279. }
  45280. }
  45281. function flatMapComponents (
  45282. matched,
  45283. fn
  45284. ) {
  45285. return flatten(matched.map(function (m) {
  45286. return Object.keys(m.components).map(function (key) { return fn(
  45287. m.components[key],
  45288. m.instances[key],
  45289. m, key
  45290. ); })
  45291. }))
  45292. }
  45293. function flatten (arr) {
  45294. return Array.prototype.concat.apply([], arr)
  45295. }
  45296. var hasSymbol =
  45297. typeof Symbol === 'function' &&
  45298. typeof Symbol.toStringTag === 'symbol';
  45299. function isESModule (obj) {
  45300. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  45301. }
  45302. // in Webpack 2, require.ensure now also returns a Promise
  45303. // so the resolve/reject functions may get called an extra time
  45304. // if the user uses an arrow function shorthand that happens to
  45305. // return that Promise.
  45306. function once (fn) {
  45307. var called = false;
  45308. return function () {
  45309. var args = [], len = arguments.length;
  45310. while ( len-- ) args[ len ] = arguments[ len ];
  45311. if (called) { return }
  45312. called = true;
  45313. return fn.apply(this, args)
  45314. }
  45315. }
  45316. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  45317. function NavigationDuplicated (normalizedLocation) {
  45318. Error.call(this);
  45319. this.name = this._name = 'NavigationDuplicated';
  45320. // passing the message to super() doesn't seem to work in the transpiled version
  45321. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  45322. // add a stack property so services like Sentry can correctly display it
  45323. Object.defineProperty(this, 'stack', {
  45324. value: new Error().stack,
  45325. writable: true,
  45326. configurable: true
  45327. });
  45328. // we could also have used
  45329. // Error.captureStackTrace(this, this.constructor)
  45330. // but it only exists on node and chrome
  45331. }
  45332. if ( Error ) NavigationDuplicated.__proto__ = Error;
  45333. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  45334. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  45335. return NavigationDuplicated;
  45336. }(Error));
  45337. // support IE9
  45338. NavigationDuplicated._name = 'NavigationDuplicated';
  45339. /* */
  45340. var History = function History (router, base) {
  45341. this.router = router;
  45342. this.base = normalizeBase(base);
  45343. // start with a route object that stands for "nowhere"
  45344. this.current = START;
  45345. this.pending = null;
  45346. this.ready = false;
  45347. this.readyCbs = [];
  45348. this.readyErrorCbs = [];
  45349. this.errorCbs = [];
  45350. };
  45351. History.prototype.listen = function listen (cb) {
  45352. this.cb = cb;
  45353. };
  45354. History.prototype.onReady = function onReady (cb, errorCb) {
  45355. if (this.ready) {
  45356. cb();
  45357. } else {
  45358. this.readyCbs.push(cb);
  45359. if (errorCb) {
  45360. this.readyErrorCbs.push(errorCb);
  45361. }
  45362. }
  45363. };
  45364. History.prototype.onError = function onError (errorCb) {
  45365. this.errorCbs.push(errorCb);
  45366. };
  45367. History.prototype.transitionTo = function transitionTo (
  45368. location,
  45369. onComplete,
  45370. onAbort
  45371. ) {
  45372. var this$1 = this;
  45373. var route = this.router.match(location, this.current);
  45374. this.confirmTransition(
  45375. route,
  45376. function () {
  45377. this$1.updateRoute(route);
  45378. onComplete && onComplete(route);
  45379. this$1.ensureURL();
  45380. // fire ready cbs once
  45381. if (!this$1.ready) {
  45382. this$1.ready = true;
  45383. this$1.readyCbs.forEach(function (cb) {
  45384. cb(route);
  45385. });
  45386. }
  45387. },
  45388. function (err) {
  45389. if (onAbort) {
  45390. onAbort(err);
  45391. }
  45392. if (err && !this$1.ready) {
  45393. this$1.ready = true;
  45394. this$1.readyErrorCbs.forEach(function (cb) {
  45395. cb(err);
  45396. });
  45397. }
  45398. }
  45399. );
  45400. };
  45401. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  45402. var this$1 = this;
  45403. var current = this.current;
  45404. var abort = function (err) {
  45405. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  45406. // When the user navigates through history through back/forward buttons
  45407. // we do not want to throw the error. We only throw it if directly calling
  45408. // push/replace. That's why it's not included in isError
  45409. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  45410. if (this$1.errorCbs.length) {
  45411. this$1.errorCbs.forEach(function (cb) {
  45412. cb(err);
  45413. });
  45414. } else {
  45415. warn(false, 'uncaught error during route navigation:');
  45416. console.error(err);
  45417. }
  45418. }
  45419. onAbort && onAbort(err);
  45420. };
  45421. if (
  45422. isSameRoute(route, current) &&
  45423. // in the case the route map has been dynamically appended to
  45424. route.matched.length === current.matched.length
  45425. ) {
  45426. this.ensureURL();
  45427. return abort(new NavigationDuplicated(route))
  45428. }
  45429. var ref = resolveQueue(
  45430. this.current.matched,
  45431. route.matched
  45432. );
  45433. var updated = ref.updated;
  45434. var deactivated = ref.deactivated;
  45435. var activated = ref.activated;
  45436. var queue = [].concat(
  45437. // in-component leave guards
  45438. extractLeaveGuards(deactivated),
  45439. // global before hooks
  45440. this.router.beforeHooks,
  45441. // in-component update hooks
  45442. extractUpdateHooks(updated),
  45443. // in-config enter guards
  45444. activated.map(function (m) { return m.beforeEnter; }),
  45445. // async components
  45446. resolveAsyncComponents(activated)
  45447. );
  45448. this.pending = route;
  45449. var iterator = function (hook, next) {
  45450. if (this$1.pending !== route) {
  45451. return abort()
  45452. }
  45453. try {
  45454. hook(route, current, function (to) {
  45455. if (to === false || isError(to)) {
  45456. // next(false) -> abort navigation, ensure current URL
  45457. this$1.ensureURL(true);
  45458. abort(to);
  45459. } else if (
  45460. typeof to === 'string' ||
  45461. (typeof to === 'object' &&
  45462. (typeof to.path === 'string' || typeof to.name === 'string'))
  45463. ) {
  45464. // next('/') or next({ path: '/' }) -> redirect
  45465. abort();
  45466. if (typeof to === 'object' && to.replace) {
  45467. this$1.replace(to);
  45468. } else {
  45469. this$1.push(to);
  45470. }
  45471. } else {
  45472. // confirm transition and pass on the value
  45473. next(to);
  45474. }
  45475. });
  45476. } catch (e) {
  45477. abort(e);
  45478. }
  45479. };
  45480. runQueue(queue, iterator, function () {
  45481. var postEnterCbs = [];
  45482. var isValid = function () { return this$1.current === route; };
  45483. // wait until async components are resolved before
  45484. // extracting in-component enter guards
  45485. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  45486. var queue = enterGuards.concat(this$1.router.resolveHooks);
  45487. runQueue(queue, iterator, function () {
  45488. if (this$1.pending !== route) {
  45489. return abort()
  45490. }
  45491. this$1.pending = null;
  45492. onComplete(route);
  45493. if (this$1.router.app) {
  45494. this$1.router.app.$nextTick(function () {
  45495. postEnterCbs.forEach(function (cb) {
  45496. cb();
  45497. });
  45498. });
  45499. }
  45500. });
  45501. });
  45502. };
  45503. History.prototype.updateRoute = function updateRoute (route) {
  45504. var prev = this.current;
  45505. this.current = route;
  45506. this.cb && this.cb(route);
  45507. this.router.afterHooks.forEach(function (hook) {
  45508. hook && hook(route, prev);
  45509. });
  45510. };
  45511. function normalizeBase (base) {
  45512. if (!base) {
  45513. if (inBrowser) {
  45514. // respect <base> tag
  45515. var baseEl = document.querySelector('base');
  45516. base = (baseEl && baseEl.getAttribute('href')) || '/';
  45517. // strip full URL origin
  45518. base = base.replace(/^https?:\/\/[^\/]+/, '');
  45519. } else {
  45520. base = '/';
  45521. }
  45522. }
  45523. // make sure there's the starting slash
  45524. if (base.charAt(0) !== '/') {
  45525. base = '/' + base;
  45526. }
  45527. // remove trailing slash
  45528. return base.replace(/\/$/, '')
  45529. }
  45530. function resolveQueue (
  45531. current,
  45532. next
  45533. ) {
  45534. var i;
  45535. var max = Math.max(current.length, next.length);
  45536. for (i = 0; i < max; i++) {
  45537. if (current[i] !== next[i]) {
  45538. break
  45539. }
  45540. }
  45541. return {
  45542. updated: next.slice(0, i),
  45543. activated: next.slice(i),
  45544. deactivated: current.slice(i)
  45545. }
  45546. }
  45547. function extractGuards (
  45548. records,
  45549. name,
  45550. bind,
  45551. reverse
  45552. ) {
  45553. var guards = flatMapComponents(records, function (def, instance, match, key) {
  45554. var guard = extractGuard(def, name);
  45555. if (guard) {
  45556. return Array.isArray(guard)
  45557. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  45558. : bind(guard, instance, match, key)
  45559. }
  45560. });
  45561. return flatten(reverse ? guards.reverse() : guards)
  45562. }
  45563. function extractGuard (
  45564. def,
  45565. key
  45566. ) {
  45567. if (typeof def !== 'function') {
  45568. // extend now so that global mixins are applied.
  45569. def = _Vue.extend(def);
  45570. }
  45571. return def.options[key]
  45572. }
  45573. function extractLeaveGuards (deactivated) {
  45574. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  45575. }
  45576. function extractUpdateHooks (updated) {
  45577. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  45578. }
  45579. function bindGuard (guard, instance) {
  45580. if (instance) {
  45581. return function boundRouteGuard () {
  45582. return guard.apply(instance, arguments)
  45583. }
  45584. }
  45585. }
  45586. function extractEnterGuards (
  45587. activated,
  45588. cbs,
  45589. isValid
  45590. ) {
  45591. return extractGuards(
  45592. activated,
  45593. 'beforeRouteEnter',
  45594. function (guard, _, match, key) {
  45595. return bindEnterGuard(guard, match, key, cbs, isValid)
  45596. }
  45597. )
  45598. }
  45599. function bindEnterGuard (
  45600. guard,
  45601. match,
  45602. key,
  45603. cbs,
  45604. isValid
  45605. ) {
  45606. return function routeEnterGuard (to, from, next) {
  45607. return guard(to, from, function (cb) {
  45608. if (typeof cb === 'function') {
  45609. cbs.push(function () {
  45610. // #750
  45611. // if a router-view is wrapped with an out-in transition,
  45612. // the instance may not have been registered at this time.
  45613. // we will need to poll for registration until current route
  45614. // is no longer valid.
  45615. poll(cb, match.instances, key, isValid);
  45616. });
  45617. }
  45618. next(cb);
  45619. })
  45620. }
  45621. }
  45622. function poll (
  45623. cb, // somehow flow cannot infer this is a function
  45624. instances,
  45625. key,
  45626. isValid
  45627. ) {
  45628. if (
  45629. instances[key] &&
  45630. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  45631. ) {
  45632. cb(instances[key]);
  45633. } else if (isValid()) {
  45634. setTimeout(function () {
  45635. poll(cb, instances, key, isValid);
  45636. }, 16);
  45637. }
  45638. }
  45639. /* */
  45640. var HTML5History = /*@__PURE__*/(function (History) {
  45641. function HTML5History (router, base) {
  45642. var this$1 = this;
  45643. History.call(this, router, base);
  45644. var expectScroll = router.options.scrollBehavior;
  45645. var supportsScroll = supportsPushState && expectScroll;
  45646. if (supportsScroll) {
  45647. setupScroll();
  45648. }
  45649. var initLocation = getLocation(this.base);
  45650. window.addEventListener('popstate', function (e) {
  45651. var current = this$1.current;
  45652. // Avoiding first `popstate` event dispatched in some browsers but first
  45653. // history route not updated since async guard at the same time.
  45654. var location = getLocation(this$1.base);
  45655. if (this$1.current === START && location === initLocation) {
  45656. return
  45657. }
  45658. this$1.transitionTo(location, function (route) {
  45659. if (supportsScroll) {
  45660. handleScroll(router, route, current, true);
  45661. }
  45662. });
  45663. });
  45664. }
  45665. if ( History ) HTML5History.__proto__ = History;
  45666. HTML5History.prototype = Object.create( History && History.prototype );
  45667. HTML5History.prototype.constructor = HTML5History;
  45668. HTML5History.prototype.go = function go (n) {
  45669. window.history.go(n);
  45670. };
  45671. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  45672. var this$1 = this;
  45673. var ref = this;
  45674. var fromRoute = ref.current;
  45675. this.transitionTo(location, function (route) {
  45676. pushState(cleanPath(this$1.base + route.fullPath));
  45677. handleScroll(this$1.router, route, fromRoute, false);
  45678. onComplete && onComplete(route);
  45679. }, onAbort);
  45680. };
  45681. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  45682. var this$1 = this;
  45683. var ref = this;
  45684. var fromRoute = ref.current;
  45685. this.transitionTo(location, function (route) {
  45686. replaceState(cleanPath(this$1.base + route.fullPath));
  45687. handleScroll(this$1.router, route, fromRoute, false);
  45688. onComplete && onComplete(route);
  45689. }, onAbort);
  45690. };
  45691. HTML5History.prototype.ensureURL = function ensureURL (push) {
  45692. if (getLocation(this.base) !== this.current.fullPath) {
  45693. var current = cleanPath(this.base + this.current.fullPath);
  45694. push ? pushState(current) : replaceState(current);
  45695. }
  45696. };
  45697. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  45698. return getLocation(this.base)
  45699. };
  45700. return HTML5History;
  45701. }(History));
  45702. function getLocation (base) {
  45703. var path = decodeURI(window.location.pathname);
  45704. if (base && path.indexOf(base) === 0) {
  45705. path = path.slice(base.length);
  45706. }
  45707. return (path || '/') + window.location.search + window.location.hash
  45708. }
  45709. /* */
  45710. var HashHistory = /*@__PURE__*/(function (History) {
  45711. function HashHistory (router, base, fallback) {
  45712. History.call(this, router, base);
  45713. // check history fallback deeplinking
  45714. if (fallback && checkFallback(this.base)) {
  45715. return
  45716. }
  45717. ensureSlash();
  45718. }
  45719. if ( History ) HashHistory.__proto__ = History;
  45720. HashHistory.prototype = Object.create( History && History.prototype );
  45721. HashHistory.prototype.constructor = HashHistory;
  45722. // this is delayed until the app mounts
  45723. // to avoid the hashchange listener being fired too early
  45724. HashHistory.prototype.setupListeners = function setupListeners () {
  45725. var this$1 = this;
  45726. var router = this.router;
  45727. var expectScroll = router.options.scrollBehavior;
  45728. var supportsScroll = supportsPushState && expectScroll;
  45729. if (supportsScroll) {
  45730. setupScroll();
  45731. }
  45732. window.addEventListener(
  45733. supportsPushState ? 'popstate' : 'hashchange',
  45734. function () {
  45735. var current = this$1.current;
  45736. if (!ensureSlash()) {
  45737. return
  45738. }
  45739. this$1.transitionTo(getHash(), function (route) {
  45740. if (supportsScroll) {
  45741. handleScroll(this$1.router, route, current, true);
  45742. }
  45743. if (!supportsPushState) {
  45744. replaceHash(route.fullPath);
  45745. }
  45746. });
  45747. }
  45748. );
  45749. };
  45750. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  45751. var this$1 = this;
  45752. var ref = this;
  45753. var fromRoute = ref.current;
  45754. this.transitionTo(
  45755. location,
  45756. function (route) {
  45757. pushHash(route.fullPath);
  45758. handleScroll(this$1.router, route, fromRoute, false);
  45759. onComplete && onComplete(route);
  45760. },
  45761. onAbort
  45762. );
  45763. };
  45764. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  45765. var this$1 = this;
  45766. var ref = this;
  45767. var fromRoute = ref.current;
  45768. this.transitionTo(
  45769. location,
  45770. function (route) {
  45771. replaceHash(route.fullPath);
  45772. handleScroll(this$1.router, route, fromRoute, false);
  45773. onComplete && onComplete(route);
  45774. },
  45775. onAbort
  45776. );
  45777. };
  45778. HashHistory.prototype.go = function go (n) {
  45779. window.history.go(n);
  45780. };
  45781. HashHistory.prototype.ensureURL = function ensureURL (push) {
  45782. var current = this.current.fullPath;
  45783. if (getHash() !== current) {
  45784. push ? pushHash(current) : replaceHash(current);
  45785. }
  45786. };
  45787. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  45788. return getHash()
  45789. };
  45790. return HashHistory;
  45791. }(History));
  45792. function checkFallback (base) {
  45793. var location = getLocation(base);
  45794. if (!/^\/#/.test(location)) {
  45795. window.location.replace(cleanPath(base + '/#' + location));
  45796. return true
  45797. }
  45798. }
  45799. function ensureSlash () {
  45800. var path = getHash();
  45801. if (path.charAt(0) === '/') {
  45802. return true
  45803. }
  45804. replaceHash('/' + path);
  45805. return false
  45806. }
  45807. function getHash () {
  45808. // We can't use window.location.hash here because it's not
  45809. // consistent across browsers - Firefox will pre-decode it!
  45810. var href = window.location.href;
  45811. var index = href.indexOf('#');
  45812. // empty path
  45813. if (index < 0) { return '' }
  45814. href = href.slice(index + 1);
  45815. // decode the hash but not the search or hash
  45816. // as search(query) is already decoded
  45817. // https://github.com/vuejs/vue-router/issues/2708
  45818. var searchIndex = href.indexOf('?');
  45819. if (searchIndex < 0) {
  45820. var hashIndex = href.indexOf('#');
  45821. if (hashIndex > -1) {
  45822. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  45823. } else { href = decodeURI(href); }
  45824. } else {
  45825. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  45826. }
  45827. return href
  45828. }
  45829. function getUrl (path) {
  45830. var href = window.location.href;
  45831. var i = href.indexOf('#');
  45832. var base = i >= 0 ? href.slice(0, i) : href;
  45833. return (base + "#" + path)
  45834. }
  45835. function pushHash (path) {
  45836. if (supportsPushState) {
  45837. pushState(getUrl(path));
  45838. } else {
  45839. window.location.hash = path;
  45840. }
  45841. }
  45842. function replaceHash (path) {
  45843. if (supportsPushState) {
  45844. replaceState(getUrl(path));
  45845. } else {
  45846. window.location.replace(getUrl(path));
  45847. }
  45848. }
  45849. /* */
  45850. var AbstractHistory = /*@__PURE__*/(function (History) {
  45851. function AbstractHistory (router, base) {
  45852. History.call(this, router, base);
  45853. this.stack = [];
  45854. this.index = -1;
  45855. }
  45856. if ( History ) AbstractHistory.__proto__ = History;
  45857. AbstractHistory.prototype = Object.create( History && History.prototype );
  45858. AbstractHistory.prototype.constructor = AbstractHistory;
  45859. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  45860. var this$1 = this;
  45861. this.transitionTo(
  45862. location,
  45863. function (route) {
  45864. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  45865. this$1.index++;
  45866. onComplete && onComplete(route);
  45867. },
  45868. onAbort
  45869. );
  45870. };
  45871. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  45872. var this$1 = this;
  45873. this.transitionTo(
  45874. location,
  45875. function (route) {
  45876. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  45877. onComplete && onComplete(route);
  45878. },
  45879. onAbort
  45880. );
  45881. };
  45882. AbstractHistory.prototype.go = function go (n) {
  45883. var this$1 = this;
  45884. var targetIndex = this.index + n;
  45885. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  45886. return
  45887. }
  45888. var route = this.stack[targetIndex];
  45889. this.confirmTransition(
  45890. route,
  45891. function () {
  45892. this$1.index = targetIndex;
  45893. this$1.updateRoute(route);
  45894. },
  45895. function (err) {
  45896. if (isExtendedError(NavigationDuplicated, err)) {
  45897. this$1.index = targetIndex;
  45898. }
  45899. }
  45900. );
  45901. };
  45902. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  45903. var current = this.stack[this.stack.length - 1];
  45904. return current ? current.fullPath : '/'
  45905. };
  45906. AbstractHistory.prototype.ensureURL = function ensureURL () {
  45907. // noop
  45908. };
  45909. return AbstractHistory;
  45910. }(History));
  45911. /* */
  45912. var VueRouter = function VueRouter (options) {
  45913. if ( options === void 0 ) options = {};
  45914. this.app = null;
  45915. this.apps = [];
  45916. this.options = options;
  45917. this.beforeHooks = [];
  45918. this.resolveHooks = [];
  45919. this.afterHooks = [];
  45920. this.matcher = createMatcher(options.routes || [], this);
  45921. var mode = options.mode || 'hash';
  45922. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  45923. if (this.fallback) {
  45924. mode = 'hash';
  45925. }
  45926. if (!inBrowser) {
  45927. mode = 'abstract';
  45928. }
  45929. this.mode = mode;
  45930. switch (mode) {
  45931. case 'history':
  45932. this.history = new HTML5History(this, options.base);
  45933. break
  45934. case 'hash':
  45935. this.history = new HashHistory(this, options.base, this.fallback);
  45936. break
  45937. case 'abstract':
  45938. this.history = new AbstractHistory(this, options.base);
  45939. break
  45940. default:
  45941. if (true) {
  45942. assert(false, ("invalid mode: " + mode));
  45943. }
  45944. }
  45945. };
  45946. var prototypeAccessors = { currentRoute: { configurable: true } };
  45947. VueRouter.prototype.match = function match (
  45948. raw,
  45949. current,
  45950. redirectedFrom
  45951. ) {
  45952. return this.matcher.match(raw, current, redirectedFrom)
  45953. };
  45954. prototypeAccessors.currentRoute.get = function () {
  45955. return this.history && this.history.current
  45956. };
  45957. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  45958. var this$1 = this;
  45959. true && assert(
  45960. install.installed,
  45961. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  45962. "before creating root instance."
  45963. );
  45964. this.apps.push(app);
  45965. // set up app destroyed handler
  45966. // https://github.com/vuejs/vue-router/issues/2639
  45967. app.$once('hook:destroyed', function () {
  45968. // clean out app from this.apps array once destroyed
  45969. var index = this$1.apps.indexOf(app);
  45970. if (index > -1) { this$1.apps.splice(index, 1); }
  45971. // ensure we still have a main app or null if no apps
  45972. // we do not release the router so it can be reused
  45973. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  45974. });
  45975. // main app previously initialized
  45976. // return as we don't need to set up new history listener
  45977. if (this.app) {
  45978. return
  45979. }
  45980. this.app = app;
  45981. var history = this.history;
  45982. if (history instanceof HTML5History) {
  45983. history.transitionTo(history.getCurrentLocation());
  45984. } else if (history instanceof HashHistory) {
  45985. var setupHashListener = function () {
  45986. history.setupListeners();
  45987. };
  45988. history.transitionTo(
  45989. history.getCurrentLocation(),
  45990. setupHashListener,
  45991. setupHashListener
  45992. );
  45993. }
  45994. history.listen(function (route) {
  45995. this$1.apps.forEach(function (app) {
  45996. app._route = route;
  45997. });
  45998. });
  45999. };
  46000. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  46001. return registerHook(this.beforeHooks, fn)
  46002. };
  46003. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  46004. return registerHook(this.resolveHooks, fn)
  46005. };
  46006. VueRouter.prototype.afterEach = function afterEach (fn) {
  46007. return registerHook(this.afterHooks, fn)
  46008. };
  46009. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  46010. this.history.onReady(cb, errorCb);
  46011. };
  46012. VueRouter.prototype.onError = function onError (errorCb) {
  46013. this.history.onError(errorCb);
  46014. };
  46015. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  46016. var this$1 = this;
  46017. // $flow-disable-line
  46018. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  46019. return new Promise(function (resolve, reject) {
  46020. this$1.history.push(location, resolve, reject);
  46021. })
  46022. } else {
  46023. this.history.push(location, onComplete, onAbort);
  46024. }
  46025. };
  46026. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  46027. var this$1 = this;
  46028. // $flow-disable-line
  46029. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  46030. return new Promise(function (resolve, reject) {
  46031. this$1.history.replace(location, resolve, reject);
  46032. })
  46033. } else {
  46034. this.history.replace(location, onComplete, onAbort);
  46035. }
  46036. };
  46037. VueRouter.prototype.go = function go (n) {
  46038. this.history.go(n);
  46039. };
  46040. VueRouter.prototype.back = function back () {
  46041. this.go(-1);
  46042. };
  46043. VueRouter.prototype.forward = function forward () {
  46044. this.go(1);
  46045. };
  46046. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  46047. var route = to
  46048. ? to.matched
  46049. ? to
  46050. : this.resolve(to).route
  46051. : this.currentRoute;
  46052. if (!route) {
  46053. return []
  46054. }
  46055. return [].concat.apply([], route.matched.map(function (m) {
  46056. return Object.keys(m.components).map(function (key) {
  46057. return m.components[key]
  46058. })
  46059. }))
  46060. };
  46061. VueRouter.prototype.resolve = function resolve (
  46062. to,
  46063. current,
  46064. append
  46065. ) {
  46066. current = current || this.history.current;
  46067. var location = normalizeLocation(
  46068. to,
  46069. current,
  46070. append,
  46071. this
  46072. );
  46073. var route = this.match(location, current);
  46074. var fullPath = route.redirectedFrom || route.fullPath;
  46075. var base = this.history.base;
  46076. var href = createHref(base, fullPath, this.mode);
  46077. return {
  46078. location: location,
  46079. route: route,
  46080. href: href,
  46081. // for backwards compat
  46082. normalizedTo: location,
  46083. resolved: route
  46084. }
  46085. };
  46086. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  46087. this.matcher.addRoutes(routes);
  46088. if (this.history.current !== START) {
  46089. this.history.transitionTo(this.history.getCurrentLocation());
  46090. }
  46091. };
  46092. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  46093. function registerHook (list, fn) {
  46094. list.push(fn);
  46095. return function () {
  46096. var i = list.indexOf(fn);
  46097. if (i > -1) { list.splice(i, 1); }
  46098. }
  46099. }
  46100. function createHref (base, fullPath, mode) {
  46101. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  46102. return base ? cleanPath(base + '/' + path) : path
  46103. }
  46104. VueRouter.install = install;
  46105. VueRouter.version = '3.1.6';
  46106. if (inBrowser && window.Vue) {
  46107. window.Vue.use(VueRouter);
  46108. }
  46109. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  46110. /***/ }),
  46111. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  46112. /*!*************************************************!*\
  46113. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  46114. \*************************************************/
  46115. /*! no static exports found */
  46116. /***/ (function(module, exports, __webpack_require__) {
  46117. "use strict";
  46118. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  46119. * Vue.js v2.6.11
  46120. * (c) 2014-2019 Evan You
  46121. * Released under the MIT License.
  46122. */
  46123. /* */
  46124. var emptyObject = Object.freeze({});
  46125. // These helpers produce better VM code in JS engines due to their
  46126. // explicitness and function inlining.
  46127. function isUndef (v) {
  46128. return v === undefined || v === null
  46129. }
  46130. function isDef (v) {
  46131. return v !== undefined && v !== null
  46132. }
  46133. function isTrue (v) {
  46134. return v === true
  46135. }
  46136. function isFalse (v) {
  46137. return v === false
  46138. }
  46139. /**
  46140. * Check if value is primitive.
  46141. */
  46142. function isPrimitive (value) {
  46143. return (
  46144. typeof value === 'string' ||
  46145. typeof value === 'number' ||
  46146. // $flow-disable-line
  46147. typeof value === 'symbol' ||
  46148. typeof value === 'boolean'
  46149. )
  46150. }
  46151. /**
  46152. * Quick object check - this is primarily used to tell
  46153. * Objects from primitive values when we know the value
  46154. * is a JSON-compliant type.
  46155. */
  46156. function isObject (obj) {
  46157. return obj !== null && typeof obj === 'object'
  46158. }
  46159. /**
  46160. * Get the raw type string of a value, e.g., [object Object].
  46161. */
  46162. var _toString = Object.prototype.toString;
  46163. function toRawType (value) {
  46164. return _toString.call(value).slice(8, -1)
  46165. }
  46166. /**
  46167. * Strict object type check. Only returns true
  46168. * for plain JavaScript objects.
  46169. */
  46170. function isPlainObject (obj) {
  46171. return _toString.call(obj) === '[object Object]'
  46172. }
  46173. function isRegExp (v) {
  46174. return _toString.call(v) === '[object RegExp]'
  46175. }
  46176. /**
  46177. * Check if val is a valid array index.
  46178. */
  46179. function isValidArrayIndex (val) {
  46180. var n = parseFloat(String(val));
  46181. return n >= 0 && Math.floor(n) === n && isFinite(val)
  46182. }
  46183. function isPromise (val) {
  46184. return (
  46185. isDef(val) &&
  46186. typeof val.then === 'function' &&
  46187. typeof val.catch === 'function'
  46188. )
  46189. }
  46190. /**
  46191. * Convert a value to a string that is actually rendered.
  46192. */
  46193. function toString (val) {
  46194. return val == null
  46195. ? ''
  46196. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  46197. ? JSON.stringify(val, null, 2)
  46198. : String(val)
  46199. }
  46200. /**
  46201. * Convert an input value to a number for persistence.
  46202. * If the conversion fails, return original string.
  46203. */
  46204. function toNumber (val) {
  46205. var n = parseFloat(val);
  46206. return isNaN(n) ? val : n
  46207. }
  46208. /**
  46209. * Make a map and return a function for checking if a key
  46210. * is in that map.
  46211. */
  46212. function makeMap (
  46213. str,
  46214. expectsLowerCase
  46215. ) {
  46216. var map = Object.create(null);
  46217. var list = str.split(',');
  46218. for (var i = 0; i < list.length; i++) {
  46219. map[list[i]] = true;
  46220. }
  46221. return expectsLowerCase
  46222. ? function (val) { return map[val.toLowerCase()]; }
  46223. : function (val) { return map[val]; }
  46224. }
  46225. /**
  46226. * Check if a tag is a built-in tag.
  46227. */
  46228. var isBuiltInTag = makeMap('slot,component', true);
  46229. /**
  46230. * Check if an attribute is a reserved attribute.
  46231. */
  46232. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  46233. /**
  46234. * Remove an item from an array.
  46235. */
  46236. function remove (arr, item) {
  46237. if (arr.length) {
  46238. var index = arr.indexOf(item);
  46239. if (index > -1) {
  46240. return arr.splice(index, 1)
  46241. }
  46242. }
  46243. }
  46244. /**
  46245. * Check whether an object has the property.
  46246. */
  46247. var hasOwnProperty = Object.prototype.hasOwnProperty;
  46248. function hasOwn (obj, key) {
  46249. return hasOwnProperty.call(obj, key)
  46250. }
  46251. /**
  46252. * Create a cached version of a pure function.
  46253. */
  46254. function cached (fn) {
  46255. var cache = Object.create(null);
  46256. return (function cachedFn (str) {
  46257. var hit = cache[str];
  46258. return hit || (cache[str] = fn(str))
  46259. })
  46260. }
  46261. /**
  46262. * Camelize a hyphen-delimited string.
  46263. */
  46264. var camelizeRE = /-(\w)/g;
  46265. var camelize = cached(function (str) {
  46266. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  46267. });
  46268. /**
  46269. * Capitalize a string.
  46270. */
  46271. var capitalize = cached(function (str) {
  46272. return str.charAt(0).toUpperCase() + str.slice(1)
  46273. });
  46274. /**
  46275. * Hyphenate a camelCase string.
  46276. */
  46277. var hyphenateRE = /\B([A-Z])/g;
  46278. var hyphenate = cached(function (str) {
  46279. return str.replace(hyphenateRE, '-$1').toLowerCase()
  46280. });
  46281. /**
  46282. * Simple bind polyfill for environments that do not support it,
  46283. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  46284. * since native bind is now performant enough in most browsers.
  46285. * But removing it would mean breaking code that was able to run in
  46286. * PhantomJS 1.x, so this must be kept for backward compatibility.
  46287. */
  46288. /* istanbul ignore next */
  46289. function polyfillBind (fn, ctx) {
  46290. function boundFn (a) {
  46291. var l = arguments.length;
  46292. return l
  46293. ? l > 1
  46294. ? fn.apply(ctx, arguments)
  46295. : fn.call(ctx, a)
  46296. : fn.call(ctx)
  46297. }
  46298. boundFn._length = fn.length;
  46299. return boundFn
  46300. }
  46301. function nativeBind (fn, ctx) {
  46302. return fn.bind(ctx)
  46303. }
  46304. var bind = Function.prototype.bind
  46305. ? nativeBind
  46306. : polyfillBind;
  46307. /**
  46308. * Convert an Array-like object to a real Array.
  46309. */
  46310. function toArray (list, start) {
  46311. start = start || 0;
  46312. var i = list.length - start;
  46313. var ret = new Array(i);
  46314. while (i--) {
  46315. ret[i] = list[i + start];
  46316. }
  46317. return ret
  46318. }
  46319. /**
  46320. * Mix properties into target object.
  46321. */
  46322. function extend (to, _from) {
  46323. for (var key in _from) {
  46324. to[key] = _from[key];
  46325. }
  46326. return to
  46327. }
  46328. /**
  46329. * Merge an Array of Objects into a single Object.
  46330. */
  46331. function toObject (arr) {
  46332. var res = {};
  46333. for (var i = 0; i < arr.length; i++) {
  46334. if (arr[i]) {
  46335. extend(res, arr[i]);
  46336. }
  46337. }
  46338. return res
  46339. }
  46340. /* eslint-disable no-unused-vars */
  46341. /**
  46342. * Perform no operation.
  46343. * Stubbing args to make Flow happy without leaving useless transpiled code
  46344. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  46345. */
  46346. function noop (a, b, c) {}
  46347. /**
  46348. * Always return false.
  46349. */
  46350. var no = function (a, b, c) { return false; };
  46351. /* eslint-enable no-unused-vars */
  46352. /**
  46353. * Return the same value.
  46354. */
  46355. var identity = function (_) { return _; };
  46356. /**
  46357. * Generate a string containing static keys from compiler modules.
  46358. */
  46359. function genStaticKeys (modules) {
  46360. return modules.reduce(function (keys, m) {
  46361. return keys.concat(m.staticKeys || [])
  46362. }, []).join(',')
  46363. }
  46364. /**
  46365. * Check if two values are loosely equal - that is,
  46366. * if they are plain objects, do they have the same shape?
  46367. */
  46368. function looseEqual (a, b) {
  46369. if (a === b) { return true }
  46370. var isObjectA = isObject(a);
  46371. var isObjectB = isObject(b);
  46372. if (isObjectA && isObjectB) {
  46373. try {
  46374. var isArrayA = Array.isArray(a);
  46375. var isArrayB = Array.isArray(b);
  46376. if (isArrayA && isArrayB) {
  46377. return a.length === b.length && a.every(function (e, i) {
  46378. return looseEqual(e, b[i])
  46379. })
  46380. } else if (a instanceof Date && b instanceof Date) {
  46381. return a.getTime() === b.getTime()
  46382. } else if (!isArrayA && !isArrayB) {
  46383. var keysA = Object.keys(a);
  46384. var keysB = Object.keys(b);
  46385. return keysA.length === keysB.length && keysA.every(function (key) {
  46386. return looseEqual(a[key], b[key])
  46387. })
  46388. } else {
  46389. /* istanbul ignore next */
  46390. return false
  46391. }
  46392. } catch (e) {
  46393. /* istanbul ignore next */
  46394. return false
  46395. }
  46396. } else if (!isObjectA && !isObjectB) {
  46397. return String(a) === String(b)
  46398. } else {
  46399. return false
  46400. }
  46401. }
  46402. /**
  46403. * Return the first index at which a loosely equal value can be
  46404. * found in the array (if value is a plain object, the array must
  46405. * contain an object of the same shape), or -1 if it is not present.
  46406. */
  46407. function looseIndexOf (arr, val) {
  46408. for (var i = 0; i < arr.length; i++) {
  46409. if (looseEqual(arr[i], val)) { return i }
  46410. }
  46411. return -1
  46412. }
  46413. /**
  46414. * Ensure a function is called only once.
  46415. */
  46416. function once (fn) {
  46417. var called = false;
  46418. return function () {
  46419. if (!called) {
  46420. called = true;
  46421. fn.apply(this, arguments);
  46422. }
  46423. }
  46424. }
  46425. var SSR_ATTR = 'data-server-rendered';
  46426. var ASSET_TYPES = [
  46427. 'component',
  46428. 'directive',
  46429. 'filter'
  46430. ];
  46431. var LIFECYCLE_HOOKS = [
  46432. 'beforeCreate',
  46433. 'created',
  46434. 'beforeMount',
  46435. 'mounted',
  46436. 'beforeUpdate',
  46437. 'updated',
  46438. 'beforeDestroy',
  46439. 'destroyed',
  46440. 'activated',
  46441. 'deactivated',
  46442. 'errorCaptured',
  46443. 'serverPrefetch'
  46444. ];
  46445. /* */
  46446. var config = ({
  46447. /**
  46448. * Option merge strategies (used in core/util/options)
  46449. */
  46450. // $flow-disable-line
  46451. optionMergeStrategies: Object.create(null),
  46452. /**
  46453. * Whether to suppress warnings.
  46454. */
  46455. silent: false,
  46456. /**
  46457. * Show production mode tip message on boot?
  46458. */
  46459. productionTip: "development" !== 'production',
  46460. /**
  46461. * Whether to enable devtools
  46462. */
  46463. devtools: "development" !== 'production',
  46464. /**
  46465. * Whether to record perf
  46466. */
  46467. performance: false,
  46468. /**
  46469. * Error handler for watcher errors
  46470. */
  46471. errorHandler: null,
  46472. /**
  46473. * Warn handler for watcher warns
  46474. */
  46475. warnHandler: null,
  46476. /**
  46477. * Ignore certain custom elements
  46478. */
  46479. ignoredElements: [],
  46480. /**
  46481. * Custom user key aliases for v-on
  46482. */
  46483. // $flow-disable-line
  46484. keyCodes: Object.create(null),
  46485. /**
  46486. * Check if a tag is reserved so that it cannot be registered as a
  46487. * component. This is platform-dependent and may be overwritten.
  46488. */
  46489. isReservedTag: no,
  46490. /**
  46491. * Check if an attribute is reserved so that it cannot be used as a component
  46492. * prop. This is platform-dependent and may be overwritten.
  46493. */
  46494. isReservedAttr: no,
  46495. /**
  46496. * Check if a tag is an unknown element.
  46497. * Platform-dependent.
  46498. */
  46499. isUnknownElement: no,
  46500. /**
  46501. * Get the namespace of an element
  46502. */
  46503. getTagNamespace: noop,
  46504. /**
  46505. * Parse the real tag name for the specific platform.
  46506. */
  46507. parsePlatformTagName: identity,
  46508. /**
  46509. * Check if an attribute must be bound using property, e.g. value
  46510. * Platform-dependent.
  46511. */
  46512. mustUseProp: no,
  46513. /**
  46514. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  46515. * This will significantly reduce performance if set to false.
  46516. */
  46517. async: true,
  46518. /**
  46519. * Exposed for legacy reasons
  46520. */
  46521. _lifecycleHooks: LIFECYCLE_HOOKS
  46522. });
  46523. /* */
  46524. /**
  46525. * unicode letters used for parsing html tags, component names and property paths.
  46526. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  46527. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  46528. */
  46529. 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/;
  46530. /**
  46531. * Check if a string starts with $ or _
  46532. */
  46533. function isReserved (str) {
  46534. var c = (str + '').charCodeAt(0);
  46535. return c === 0x24 || c === 0x5F
  46536. }
  46537. /**
  46538. * Define a property.
  46539. */
  46540. function def (obj, key, val, enumerable) {
  46541. Object.defineProperty(obj, key, {
  46542. value: val,
  46543. enumerable: !!enumerable,
  46544. writable: true,
  46545. configurable: true
  46546. });
  46547. }
  46548. /**
  46549. * Parse simple path.
  46550. */
  46551. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  46552. function parsePath (path) {
  46553. if (bailRE.test(path)) {
  46554. return
  46555. }
  46556. var segments = path.split('.');
  46557. return function (obj) {
  46558. for (var i = 0; i < segments.length; i++) {
  46559. if (!obj) { return }
  46560. obj = obj[segments[i]];
  46561. }
  46562. return obj
  46563. }
  46564. }
  46565. /* */
  46566. // can we use __proto__?
  46567. var hasProto = '__proto__' in {};
  46568. // Browser environment sniffing
  46569. var inBrowser = typeof window !== 'undefined';
  46570. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  46571. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  46572. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  46573. var isIE = UA && /msie|trident/.test(UA);
  46574. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  46575. var isEdge = UA && UA.indexOf('edge/') > 0;
  46576. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  46577. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  46578. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  46579. var isPhantomJS = UA && /phantomjs/.test(UA);
  46580. var isFF = UA && UA.match(/firefox\/(\d+)/);
  46581. // Firefox has a "watch" function on Object.prototype...
  46582. var nativeWatch = ({}).watch;
  46583. var supportsPassive = false;
  46584. if (inBrowser) {
  46585. try {
  46586. var opts = {};
  46587. Object.defineProperty(opts, 'passive', ({
  46588. get: function get () {
  46589. /* istanbul ignore next */
  46590. supportsPassive = true;
  46591. }
  46592. })); // https://github.com/facebook/flow/issues/285
  46593. window.addEventListener('test-passive', null, opts);
  46594. } catch (e) {}
  46595. }
  46596. // this needs to be lazy-evaled because vue may be required before
  46597. // vue-server-renderer can set VUE_ENV
  46598. var _isServer;
  46599. var isServerRendering = function () {
  46600. if (_isServer === undefined) {
  46601. /* istanbul ignore if */
  46602. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  46603. // detect presence of vue-server-renderer and avoid
  46604. // Webpack shimming the process
  46605. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  46606. } else {
  46607. _isServer = false;
  46608. }
  46609. }
  46610. return _isServer
  46611. };
  46612. // detect devtools
  46613. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  46614. /* istanbul ignore next */
  46615. function isNative (Ctor) {
  46616. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  46617. }
  46618. var hasSymbol =
  46619. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  46620. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  46621. var _Set;
  46622. /* istanbul ignore if */ // $flow-disable-line
  46623. if (typeof Set !== 'undefined' && isNative(Set)) {
  46624. // use native Set when available.
  46625. _Set = Set;
  46626. } else {
  46627. // a non-standard Set polyfill that only works with primitive keys.
  46628. _Set = /*@__PURE__*/(function () {
  46629. function Set () {
  46630. this.set = Object.create(null);
  46631. }
  46632. Set.prototype.has = function has (key) {
  46633. return this.set[key] === true
  46634. };
  46635. Set.prototype.add = function add (key) {
  46636. this.set[key] = true;
  46637. };
  46638. Set.prototype.clear = function clear () {
  46639. this.set = Object.create(null);
  46640. };
  46641. return Set;
  46642. }());
  46643. }
  46644. /* */
  46645. var warn = noop;
  46646. var tip = noop;
  46647. var generateComponentTrace = (noop); // work around flow check
  46648. var formatComponentName = (noop);
  46649. {
  46650. var hasConsole = typeof console !== 'undefined';
  46651. var classifyRE = /(?:^|[-_])(\w)/g;
  46652. var classify = function (str) { return str
  46653. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  46654. .replace(/[-_]/g, ''); };
  46655. warn = function (msg, vm) {
  46656. var trace = vm ? generateComponentTrace(vm) : '';
  46657. if (config.warnHandler) {
  46658. config.warnHandler.call(null, msg, vm, trace);
  46659. } else if (hasConsole && (!config.silent)) {
  46660. console.error(("[Vue warn]: " + msg + trace));
  46661. }
  46662. };
  46663. tip = function (msg, vm) {
  46664. if (hasConsole && (!config.silent)) {
  46665. console.warn("[Vue tip]: " + msg + (
  46666. vm ? generateComponentTrace(vm) : ''
  46667. ));
  46668. }
  46669. };
  46670. formatComponentName = function (vm, includeFile) {
  46671. if (vm.$root === vm) {
  46672. return '<Root>'
  46673. }
  46674. var options = typeof vm === 'function' && vm.cid != null
  46675. ? vm.options
  46676. : vm._isVue
  46677. ? vm.$options || vm.constructor.options
  46678. : vm;
  46679. var name = options.name || options._componentTag;
  46680. var file = options.__file;
  46681. if (!name && file) {
  46682. var match = file.match(/([^/\\]+)\.vue$/);
  46683. name = match && match[1];
  46684. }
  46685. return (
  46686. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  46687. (file && includeFile !== false ? (" at " + file) : '')
  46688. )
  46689. };
  46690. var repeat = function (str, n) {
  46691. var res = '';
  46692. while (n) {
  46693. if (n % 2 === 1) { res += str; }
  46694. if (n > 1) { str += str; }
  46695. n >>= 1;
  46696. }
  46697. return res
  46698. };
  46699. generateComponentTrace = function (vm) {
  46700. if (vm._isVue && vm.$parent) {
  46701. var tree = [];
  46702. var currentRecursiveSequence = 0;
  46703. while (vm) {
  46704. if (tree.length > 0) {
  46705. var last = tree[tree.length - 1];
  46706. if (last.constructor === vm.constructor) {
  46707. currentRecursiveSequence++;
  46708. vm = vm.$parent;
  46709. continue
  46710. } else if (currentRecursiveSequence > 0) {
  46711. tree[tree.length - 1] = [last, currentRecursiveSequence];
  46712. currentRecursiveSequence = 0;
  46713. }
  46714. }
  46715. tree.push(vm);
  46716. vm = vm.$parent;
  46717. }
  46718. return '\n\nfound in\n\n' + tree
  46719. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  46720. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  46721. : formatComponentName(vm))); })
  46722. .join('\n')
  46723. } else {
  46724. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  46725. }
  46726. };
  46727. }
  46728. /* */
  46729. var uid = 0;
  46730. /**
  46731. * A dep is an observable that can have multiple
  46732. * directives subscribing to it.
  46733. */
  46734. var Dep = function Dep () {
  46735. this.id = uid++;
  46736. this.subs = [];
  46737. };
  46738. Dep.prototype.addSub = function addSub (sub) {
  46739. this.subs.push(sub);
  46740. };
  46741. Dep.prototype.removeSub = function removeSub (sub) {
  46742. remove(this.subs, sub);
  46743. };
  46744. Dep.prototype.depend = function depend () {
  46745. if (Dep.target) {
  46746. Dep.target.addDep(this);
  46747. }
  46748. };
  46749. Dep.prototype.notify = function notify () {
  46750. // stabilize the subscriber list first
  46751. var subs = this.subs.slice();
  46752. if (!config.async) {
  46753. // subs aren't sorted in scheduler if not running async
  46754. // we need to sort them now to make sure they fire in correct
  46755. // order
  46756. subs.sort(function (a, b) { return a.id - b.id; });
  46757. }
  46758. for (var i = 0, l = subs.length; i < l; i++) {
  46759. subs[i].update();
  46760. }
  46761. };
  46762. // The current target watcher being evaluated.
  46763. // This is globally unique because only one watcher
  46764. // can be evaluated at a time.
  46765. Dep.target = null;
  46766. var targetStack = [];
  46767. function pushTarget (target) {
  46768. targetStack.push(target);
  46769. Dep.target = target;
  46770. }
  46771. function popTarget () {
  46772. targetStack.pop();
  46773. Dep.target = targetStack[targetStack.length - 1];
  46774. }
  46775. /* */
  46776. var VNode = function VNode (
  46777. tag,
  46778. data,
  46779. children,
  46780. text,
  46781. elm,
  46782. context,
  46783. componentOptions,
  46784. asyncFactory
  46785. ) {
  46786. this.tag = tag;
  46787. this.data = data;
  46788. this.children = children;
  46789. this.text = text;
  46790. this.elm = elm;
  46791. this.ns = undefined;
  46792. this.context = context;
  46793. this.fnContext = undefined;
  46794. this.fnOptions = undefined;
  46795. this.fnScopeId = undefined;
  46796. this.key = data && data.key;
  46797. this.componentOptions = componentOptions;
  46798. this.componentInstance = undefined;
  46799. this.parent = undefined;
  46800. this.raw = false;
  46801. this.isStatic = false;
  46802. this.isRootInsert = true;
  46803. this.isComment = false;
  46804. this.isCloned = false;
  46805. this.isOnce = false;
  46806. this.asyncFactory = asyncFactory;
  46807. this.asyncMeta = undefined;
  46808. this.isAsyncPlaceholder = false;
  46809. };
  46810. var prototypeAccessors = { child: { configurable: true } };
  46811. // DEPRECATED: alias for componentInstance for backwards compat.
  46812. /* istanbul ignore next */
  46813. prototypeAccessors.child.get = function () {
  46814. return this.componentInstance
  46815. };
  46816. Object.defineProperties( VNode.prototype, prototypeAccessors );
  46817. var createEmptyVNode = function (text) {
  46818. if ( text === void 0 ) text = '';
  46819. var node = new VNode();
  46820. node.text = text;
  46821. node.isComment = true;
  46822. return node
  46823. };
  46824. function createTextVNode (val) {
  46825. return new VNode(undefined, undefined, undefined, String(val))
  46826. }
  46827. // optimized shallow clone
  46828. // used for static nodes and slot nodes because they may be reused across
  46829. // multiple renders, cloning them avoids errors when DOM manipulations rely
  46830. // on their elm reference.
  46831. function cloneVNode (vnode) {
  46832. var cloned = new VNode(
  46833. vnode.tag,
  46834. vnode.data,
  46835. // #7975
  46836. // clone children array to avoid mutating original in case of cloning
  46837. // a child.
  46838. vnode.children && vnode.children.slice(),
  46839. vnode.text,
  46840. vnode.elm,
  46841. vnode.context,
  46842. vnode.componentOptions,
  46843. vnode.asyncFactory
  46844. );
  46845. cloned.ns = vnode.ns;
  46846. cloned.isStatic = vnode.isStatic;
  46847. cloned.key = vnode.key;
  46848. cloned.isComment = vnode.isComment;
  46849. cloned.fnContext = vnode.fnContext;
  46850. cloned.fnOptions = vnode.fnOptions;
  46851. cloned.fnScopeId = vnode.fnScopeId;
  46852. cloned.asyncMeta = vnode.asyncMeta;
  46853. cloned.isCloned = true;
  46854. return cloned
  46855. }
  46856. /*
  46857. * not type checking this file because flow doesn't play well with
  46858. * dynamically accessing methods on Array prototype
  46859. */
  46860. var arrayProto = Array.prototype;
  46861. var arrayMethods = Object.create(arrayProto);
  46862. var methodsToPatch = [
  46863. 'push',
  46864. 'pop',
  46865. 'shift',
  46866. 'unshift',
  46867. 'splice',
  46868. 'sort',
  46869. 'reverse'
  46870. ];
  46871. /**
  46872. * Intercept mutating methods and emit events
  46873. */
  46874. methodsToPatch.forEach(function (method) {
  46875. // cache original method
  46876. var original = arrayProto[method];
  46877. def(arrayMethods, method, function mutator () {
  46878. var args = [], len = arguments.length;
  46879. while ( len-- ) args[ len ] = arguments[ len ];
  46880. var result = original.apply(this, args);
  46881. var ob = this.__ob__;
  46882. var inserted;
  46883. switch (method) {
  46884. case 'push':
  46885. case 'unshift':
  46886. inserted = args;
  46887. break
  46888. case 'splice':
  46889. inserted = args.slice(2);
  46890. break
  46891. }
  46892. if (inserted) { ob.observeArray(inserted); }
  46893. // notify change
  46894. ob.dep.notify();
  46895. return result
  46896. });
  46897. });
  46898. /* */
  46899. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  46900. /**
  46901. * In some cases we may want to disable observation inside a component's
  46902. * update computation.
  46903. */
  46904. var shouldObserve = true;
  46905. function toggleObserving (value) {
  46906. shouldObserve = value;
  46907. }
  46908. /**
  46909. * Observer class that is attached to each observed
  46910. * object. Once attached, the observer converts the target
  46911. * object's property keys into getter/setters that
  46912. * collect dependencies and dispatch updates.
  46913. */
  46914. var Observer = function Observer (value) {
  46915. this.value = value;
  46916. this.dep = new Dep();
  46917. this.vmCount = 0;
  46918. def(value, '__ob__', this);
  46919. if (Array.isArray(value)) {
  46920. if (hasProto) {
  46921. protoAugment(value, arrayMethods);
  46922. } else {
  46923. copyAugment(value, arrayMethods, arrayKeys);
  46924. }
  46925. this.observeArray(value);
  46926. } else {
  46927. this.walk(value);
  46928. }
  46929. };
  46930. /**
  46931. * Walk through all properties and convert them into
  46932. * getter/setters. This method should only be called when
  46933. * value type is Object.
  46934. */
  46935. Observer.prototype.walk = function walk (obj) {
  46936. var keys = Object.keys(obj);
  46937. for (var i = 0; i < keys.length; i++) {
  46938. defineReactive$$1(obj, keys[i]);
  46939. }
  46940. };
  46941. /**
  46942. * Observe a list of Array items.
  46943. */
  46944. Observer.prototype.observeArray = function observeArray (items) {
  46945. for (var i = 0, l = items.length; i < l; i++) {
  46946. observe(items[i]);
  46947. }
  46948. };
  46949. // helpers
  46950. /**
  46951. * Augment a target Object or Array by intercepting
  46952. * the prototype chain using __proto__
  46953. */
  46954. function protoAugment (target, src) {
  46955. /* eslint-disable no-proto */
  46956. target.__proto__ = src;
  46957. /* eslint-enable no-proto */
  46958. }
  46959. /**
  46960. * Augment a target Object or Array by defining
  46961. * hidden properties.
  46962. */
  46963. /* istanbul ignore next */
  46964. function copyAugment (target, src, keys) {
  46965. for (var i = 0, l = keys.length; i < l; i++) {
  46966. var key = keys[i];
  46967. def(target, key, src[key]);
  46968. }
  46969. }
  46970. /**
  46971. * Attempt to create an observer instance for a value,
  46972. * returns the new observer if successfully observed,
  46973. * or the existing observer if the value already has one.
  46974. */
  46975. function observe (value, asRootData) {
  46976. if (!isObject(value) || value instanceof VNode) {
  46977. return
  46978. }
  46979. var ob;
  46980. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  46981. ob = value.__ob__;
  46982. } else if (
  46983. shouldObserve &&
  46984. !isServerRendering() &&
  46985. (Array.isArray(value) || isPlainObject(value)) &&
  46986. Object.isExtensible(value) &&
  46987. !value._isVue
  46988. ) {
  46989. ob = new Observer(value);
  46990. }
  46991. if (asRootData && ob) {
  46992. ob.vmCount++;
  46993. }
  46994. return ob
  46995. }
  46996. /**
  46997. * Define a reactive property on an Object.
  46998. */
  46999. function defineReactive$$1 (
  47000. obj,
  47001. key,
  47002. val,
  47003. customSetter,
  47004. shallow
  47005. ) {
  47006. var dep = new Dep();
  47007. var property = Object.getOwnPropertyDescriptor(obj, key);
  47008. if (property && property.configurable === false) {
  47009. return
  47010. }
  47011. // cater for pre-defined getter/setters
  47012. var getter = property && property.get;
  47013. var setter = property && property.set;
  47014. if ((!getter || setter) && arguments.length === 2) {
  47015. val = obj[key];
  47016. }
  47017. var childOb = !shallow && observe(val);
  47018. Object.defineProperty(obj, key, {
  47019. enumerable: true,
  47020. configurable: true,
  47021. get: function reactiveGetter () {
  47022. var value = getter ? getter.call(obj) : val;
  47023. if (Dep.target) {
  47024. dep.depend();
  47025. if (childOb) {
  47026. childOb.dep.depend();
  47027. if (Array.isArray(value)) {
  47028. dependArray(value);
  47029. }
  47030. }
  47031. }
  47032. return value
  47033. },
  47034. set: function reactiveSetter (newVal) {
  47035. var value = getter ? getter.call(obj) : val;
  47036. /* eslint-disable no-self-compare */
  47037. if (newVal === value || (newVal !== newVal && value !== value)) {
  47038. return
  47039. }
  47040. /* eslint-enable no-self-compare */
  47041. if (customSetter) {
  47042. customSetter();
  47043. }
  47044. // #7981: for accessor properties without setter
  47045. if (getter && !setter) { return }
  47046. if (setter) {
  47047. setter.call(obj, newVal);
  47048. } else {
  47049. val = newVal;
  47050. }
  47051. childOb = !shallow && observe(newVal);
  47052. dep.notify();
  47053. }
  47054. });
  47055. }
  47056. /**
  47057. * Set a property on an object. Adds the new property and
  47058. * triggers change notification if the property doesn't
  47059. * already exist.
  47060. */
  47061. function set (target, key, val) {
  47062. if (isUndef(target) || isPrimitive(target)
  47063. ) {
  47064. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  47065. }
  47066. if (Array.isArray(target) && isValidArrayIndex(key)) {
  47067. target.length = Math.max(target.length, key);
  47068. target.splice(key, 1, val);
  47069. return val
  47070. }
  47071. if (key in target && !(key in Object.prototype)) {
  47072. target[key] = val;
  47073. return val
  47074. }
  47075. var ob = (target).__ob__;
  47076. if (target._isVue || (ob && ob.vmCount)) {
  47077. warn(
  47078. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  47079. 'at runtime - declare it upfront in the data option.'
  47080. );
  47081. return val
  47082. }
  47083. if (!ob) {
  47084. target[key] = val;
  47085. return val
  47086. }
  47087. defineReactive$$1(ob.value, key, val);
  47088. ob.dep.notify();
  47089. return val
  47090. }
  47091. /**
  47092. * Delete a property and trigger change if necessary.
  47093. */
  47094. function del (target, key) {
  47095. if (isUndef(target) || isPrimitive(target)
  47096. ) {
  47097. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  47098. }
  47099. if (Array.isArray(target) && isValidArrayIndex(key)) {
  47100. target.splice(key, 1);
  47101. return
  47102. }
  47103. var ob = (target).__ob__;
  47104. if (target._isVue || (ob && ob.vmCount)) {
  47105. warn(
  47106. 'Avoid deleting properties on a Vue instance or its root $data ' +
  47107. '- just set it to null.'
  47108. );
  47109. return
  47110. }
  47111. if (!hasOwn(target, key)) {
  47112. return
  47113. }
  47114. delete target[key];
  47115. if (!ob) {
  47116. return
  47117. }
  47118. ob.dep.notify();
  47119. }
  47120. /**
  47121. * Collect dependencies on array elements when the array is touched, since
  47122. * we cannot intercept array element access like property getters.
  47123. */
  47124. function dependArray (value) {
  47125. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  47126. e = value[i];
  47127. e && e.__ob__ && e.__ob__.dep.depend();
  47128. if (Array.isArray(e)) {
  47129. dependArray(e);
  47130. }
  47131. }
  47132. }
  47133. /* */
  47134. /**
  47135. * Option overwriting strategies are functions that handle
  47136. * how to merge a parent option value and a child option
  47137. * value into the final value.
  47138. */
  47139. var strats = config.optionMergeStrategies;
  47140. /**
  47141. * Options with restrictions
  47142. */
  47143. {
  47144. strats.el = strats.propsData = function (parent, child, vm, key) {
  47145. if (!vm) {
  47146. warn(
  47147. "option \"" + key + "\" can only be used during instance " +
  47148. 'creation with the `new` keyword.'
  47149. );
  47150. }
  47151. return defaultStrat(parent, child)
  47152. };
  47153. }
  47154. /**
  47155. * Helper that recursively merges two data objects together.
  47156. */
  47157. function mergeData (to, from) {
  47158. if (!from) { return to }
  47159. var key, toVal, fromVal;
  47160. var keys = hasSymbol
  47161. ? Reflect.ownKeys(from)
  47162. : Object.keys(from);
  47163. for (var i = 0; i < keys.length; i++) {
  47164. key = keys[i];
  47165. // in case the object is already observed...
  47166. if (key === '__ob__') { continue }
  47167. toVal = to[key];
  47168. fromVal = from[key];
  47169. if (!hasOwn(to, key)) {
  47170. set(to, key, fromVal);
  47171. } else if (
  47172. toVal !== fromVal &&
  47173. isPlainObject(toVal) &&
  47174. isPlainObject(fromVal)
  47175. ) {
  47176. mergeData(toVal, fromVal);
  47177. }
  47178. }
  47179. return to
  47180. }
  47181. /**
  47182. * Data
  47183. */
  47184. function mergeDataOrFn (
  47185. parentVal,
  47186. childVal,
  47187. vm
  47188. ) {
  47189. if (!vm) {
  47190. // in a Vue.extend merge, both should be functions
  47191. if (!childVal) {
  47192. return parentVal
  47193. }
  47194. if (!parentVal) {
  47195. return childVal
  47196. }
  47197. // when parentVal & childVal are both present,
  47198. // we need to return a function that returns the
  47199. // merged result of both functions... no need to
  47200. // check if parentVal is a function here because
  47201. // it has to be a function to pass previous merges.
  47202. return function mergedDataFn () {
  47203. return mergeData(
  47204. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  47205. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  47206. )
  47207. }
  47208. } else {
  47209. return function mergedInstanceDataFn () {
  47210. // instance merge
  47211. var instanceData = typeof childVal === 'function'
  47212. ? childVal.call(vm, vm)
  47213. : childVal;
  47214. var defaultData = typeof parentVal === 'function'
  47215. ? parentVal.call(vm, vm)
  47216. : parentVal;
  47217. if (instanceData) {
  47218. return mergeData(instanceData, defaultData)
  47219. } else {
  47220. return defaultData
  47221. }
  47222. }
  47223. }
  47224. }
  47225. strats.data = function (
  47226. parentVal,
  47227. childVal,
  47228. vm
  47229. ) {
  47230. if (!vm) {
  47231. if (childVal && typeof childVal !== 'function') {
  47232. warn(
  47233. 'The "data" option should be a function ' +
  47234. 'that returns a per-instance value in component ' +
  47235. 'definitions.',
  47236. vm
  47237. );
  47238. return parentVal
  47239. }
  47240. return mergeDataOrFn(parentVal, childVal)
  47241. }
  47242. return mergeDataOrFn(parentVal, childVal, vm)
  47243. };
  47244. /**
  47245. * Hooks and props are merged as arrays.
  47246. */
  47247. function mergeHook (
  47248. parentVal,
  47249. childVal
  47250. ) {
  47251. var res = childVal
  47252. ? parentVal
  47253. ? parentVal.concat(childVal)
  47254. : Array.isArray(childVal)
  47255. ? childVal
  47256. : [childVal]
  47257. : parentVal;
  47258. return res
  47259. ? dedupeHooks(res)
  47260. : res
  47261. }
  47262. function dedupeHooks (hooks) {
  47263. var res = [];
  47264. for (var i = 0; i < hooks.length; i++) {
  47265. if (res.indexOf(hooks[i]) === -1) {
  47266. res.push(hooks[i]);
  47267. }
  47268. }
  47269. return res
  47270. }
  47271. LIFECYCLE_HOOKS.forEach(function (hook) {
  47272. strats[hook] = mergeHook;
  47273. });
  47274. /**
  47275. * Assets
  47276. *
  47277. * When a vm is present (instance creation), we need to do
  47278. * a three-way merge between constructor options, instance
  47279. * options and parent options.
  47280. */
  47281. function mergeAssets (
  47282. parentVal,
  47283. childVal,
  47284. vm,
  47285. key
  47286. ) {
  47287. var res = Object.create(parentVal || null);
  47288. if (childVal) {
  47289. assertObjectType(key, childVal, vm);
  47290. return extend(res, childVal)
  47291. } else {
  47292. return res
  47293. }
  47294. }
  47295. ASSET_TYPES.forEach(function (type) {
  47296. strats[type + 's'] = mergeAssets;
  47297. });
  47298. /**
  47299. * Watchers.
  47300. *
  47301. * Watchers hashes should not overwrite one
  47302. * another, so we merge them as arrays.
  47303. */
  47304. strats.watch = function (
  47305. parentVal,
  47306. childVal,
  47307. vm,
  47308. key
  47309. ) {
  47310. // work around Firefox's Object.prototype.watch...
  47311. if (parentVal === nativeWatch) { parentVal = undefined; }
  47312. if (childVal === nativeWatch) { childVal = undefined; }
  47313. /* istanbul ignore if */
  47314. if (!childVal) { return Object.create(parentVal || null) }
  47315. {
  47316. assertObjectType(key, childVal, vm);
  47317. }
  47318. if (!parentVal) { return childVal }
  47319. var ret = {};
  47320. extend(ret, parentVal);
  47321. for (var key$1 in childVal) {
  47322. var parent = ret[key$1];
  47323. var child = childVal[key$1];
  47324. if (parent && !Array.isArray(parent)) {
  47325. parent = [parent];
  47326. }
  47327. ret[key$1] = parent
  47328. ? parent.concat(child)
  47329. : Array.isArray(child) ? child : [child];
  47330. }
  47331. return ret
  47332. };
  47333. /**
  47334. * Other object hashes.
  47335. */
  47336. strats.props =
  47337. strats.methods =
  47338. strats.inject =
  47339. strats.computed = function (
  47340. parentVal,
  47341. childVal,
  47342. vm,
  47343. key
  47344. ) {
  47345. if (childVal && "development" !== 'production') {
  47346. assertObjectType(key, childVal, vm);
  47347. }
  47348. if (!parentVal) { return childVal }
  47349. var ret = Object.create(null);
  47350. extend(ret, parentVal);
  47351. if (childVal) { extend(ret, childVal); }
  47352. return ret
  47353. };
  47354. strats.provide = mergeDataOrFn;
  47355. /**
  47356. * Default strategy.
  47357. */
  47358. var defaultStrat = function (parentVal, childVal) {
  47359. return childVal === undefined
  47360. ? parentVal
  47361. : childVal
  47362. };
  47363. /**
  47364. * Validate component names
  47365. */
  47366. function checkComponents (options) {
  47367. for (var key in options.components) {
  47368. validateComponentName(key);
  47369. }
  47370. }
  47371. function validateComponentName (name) {
  47372. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  47373. warn(
  47374. 'Invalid component name: "' + name + '". Component names ' +
  47375. 'should conform to valid custom element name in html5 specification.'
  47376. );
  47377. }
  47378. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  47379. warn(
  47380. 'Do not use built-in or reserved HTML elements as component ' +
  47381. 'id: ' + name
  47382. );
  47383. }
  47384. }
  47385. /**
  47386. * Ensure all props option syntax are normalized into the
  47387. * Object-based format.
  47388. */
  47389. function normalizeProps (options, vm) {
  47390. var props = options.props;
  47391. if (!props) { return }
  47392. var res = {};
  47393. var i, val, name;
  47394. if (Array.isArray(props)) {
  47395. i = props.length;
  47396. while (i--) {
  47397. val = props[i];
  47398. if (typeof val === 'string') {
  47399. name = camelize(val);
  47400. res[name] = { type: null };
  47401. } else {
  47402. warn('props must be strings when using array syntax.');
  47403. }
  47404. }
  47405. } else if (isPlainObject(props)) {
  47406. for (var key in props) {
  47407. val = props[key];
  47408. name = camelize(key);
  47409. res[name] = isPlainObject(val)
  47410. ? val
  47411. : { type: val };
  47412. }
  47413. } else {
  47414. warn(
  47415. "Invalid value for option \"props\": expected an Array or an Object, " +
  47416. "but got " + (toRawType(props)) + ".",
  47417. vm
  47418. );
  47419. }
  47420. options.props = res;
  47421. }
  47422. /**
  47423. * Normalize all injections into Object-based format
  47424. */
  47425. function normalizeInject (options, vm) {
  47426. var inject = options.inject;
  47427. if (!inject) { return }
  47428. var normalized = options.inject = {};
  47429. if (Array.isArray(inject)) {
  47430. for (var i = 0; i < inject.length; i++) {
  47431. normalized[inject[i]] = { from: inject[i] };
  47432. }
  47433. } else if (isPlainObject(inject)) {
  47434. for (var key in inject) {
  47435. var val = inject[key];
  47436. normalized[key] = isPlainObject(val)
  47437. ? extend({ from: key }, val)
  47438. : { from: val };
  47439. }
  47440. } else {
  47441. warn(
  47442. "Invalid value for option \"inject\": expected an Array or an Object, " +
  47443. "but got " + (toRawType(inject)) + ".",
  47444. vm
  47445. );
  47446. }
  47447. }
  47448. /**
  47449. * Normalize raw function directives into object format.
  47450. */
  47451. function normalizeDirectives (options) {
  47452. var dirs = options.directives;
  47453. if (dirs) {
  47454. for (var key in dirs) {
  47455. var def$$1 = dirs[key];
  47456. if (typeof def$$1 === 'function') {
  47457. dirs[key] = { bind: def$$1, update: def$$1 };
  47458. }
  47459. }
  47460. }
  47461. }
  47462. function assertObjectType (name, value, vm) {
  47463. if (!isPlainObject(value)) {
  47464. warn(
  47465. "Invalid value for option \"" + name + "\": expected an Object, " +
  47466. "but got " + (toRawType(value)) + ".",
  47467. vm
  47468. );
  47469. }
  47470. }
  47471. /**
  47472. * Merge two option objects into a new one.
  47473. * Core utility used in both instantiation and inheritance.
  47474. */
  47475. function mergeOptions (
  47476. parent,
  47477. child,
  47478. vm
  47479. ) {
  47480. {
  47481. checkComponents(child);
  47482. }
  47483. if (typeof child === 'function') {
  47484. child = child.options;
  47485. }
  47486. normalizeProps(child, vm);
  47487. normalizeInject(child, vm);
  47488. normalizeDirectives(child);
  47489. // Apply extends and mixins on the child options,
  47490. // but only if it is a raw options object that isn't
  47491. // the result of another mergeOptions call.
  47492. // Only merged options has the _base property.
  47493. if (!child._base) {
  47494. if (child.extends) {
  47495. parent = mergeOptions(parent, child.extends, vm);
  47496. }
  47497. if (child.mixins) {
  47498. for (var i = 0, l = child.mixins.length; i < l; i++) {
  47499. parent = mergeOptions(parent, child.mixins[i], vm);
  47500. }
  47501. }
  47502. }
  47503. var options = {};
  47504. var key;
  47505. for (key in parent) {
  47506. mergeField(key);
  47507. }
  47508. for (key in child) {
  47509. if (!hasOwn(parent, key)) {
  47510. mergeField(key);
  47511. }
  47512. }
  47513. function mergeField (key) {
  47514. var strat = strats[key] || defaultStrat;
  47515. options[key] = strat(parent[key], child[key], vm, key);
  47516. }
  47517. return options
  47518. }
  47519. /**
  47520. * Resolve an asset.
  47521. * This function is used because child instances need access
  47522. * to assets defined in its ancestor chain.
  47523. */
  47524. function resolveAsset (
  47525. options,
  47526. type,
  47527. id,
  47528. warnMissing
  47529. ) {
  47530. /* istanbul ignore if */
  47531. if (typeof id !== 'string') {
  47532. return
  47533. }
  47534. var assets = options[type];
  47535. // check local registration variations first
  47536. if (hasOwn(assets, id)) { return assets[id] }
  47537. var camelizedId = camelize(id);
  47538. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  47539. var PascalCaseId = capitalize(camelizedId);
  47540. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  47541. // fallback to prototype chain
  47542. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  47543. if (warnMissing && !res) {
  47544. warn(
  47545. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  47546. options
  47547. );
  47548. }
  47549. return res
  47550. }
  47551. /* */
  47552. function validateProp (
  47553. key,
  47554. propOptions,
  47555. propsData,
  47556. vm
  47557. ) {
  47558. var prop = propOptions[key];
  47559. var absent = !hasOwn(propsData, key);
  47560. var value = propsData[key];
  47561. // boolean casting
  47562. var booleanIndex = getTypeIndex(Boolean, prop.type);
  47563. if (booleanIndex > -1) {
  47564. if (absent && !hasOwn(prop, 'default')) {
  47565. value = false;
  47566. } else if (value === '' || value === hyphenate(key)) {
  47567. // only cast empty string / same name to boolean if
  47568. // boolean has higher priority
  47569. var stringIndex = getTypeIndex(String, prop.type);
  47570. if (stringIndex < 0 || booleanIndex < stringIndex) {
  47571. value = true;
  47572. }
  47573. }
  47574. }
  47575. // check default value
  47576. if (value === undefined) {
  47577. value = getPropDefaultValue(vm, prop, key);
  47578. // since the default value is a fresh copy,
  47579. // make sure to observe it.
  47580. var prevShouldObserve = shouldObserve;
  47581. toggleObserving(true);
  47582. observe(value);
  47583. toggleObserving(prevShouldObserve);
  47584. }
  47585. {
  47586. assertProp(prop, key, value, vm, absent);
  47587. }
  47588. return value
  47589. }
  47590. /**
  47591. * Get the default value of a prop.
  47592. */
  47593. function getPropDefaultValue (vm, prop, key) {
  47594. // no default, return undefined
  47595. if (!hasOwn(prop, 'default')) {
  47596. return undefined
  47597. }
  47598. var def = prop.default;
  47599. // warn against non-factory defaults for Object & Array
  47600. if (isObject(def)) {
  47601. warn(
  47602. 'Invalid default value for prop "' + key + '": ' +
  47603. 'Props with type Object/Array must use a factory function ' +
  47604. 'to return the default value.',
  47605. vm
  47606. );
  47607. }
  47608. // the raw prop value was also undefined from previous render,
  47609. // return previous default value to avoid unnecessary watcher trigger
  47610. if (vm && vm.$options.propsData &&
  47611. vm.$options.propsData[key] === undefined &&
  47612. vm._props[key] !== undefined
  47613. ) {
  47614. return vm._props[key]
  47615. }
  47616. // call factory function for non-Function types
  47617. // a value is Function if its prototype is function even across different execution context
  47618. return typeof def === 'function' && getType(prop.type) !== 'Function'
  47619. ? def.call(vm)
  47620. : def
  47621. }
  47622. /**
  47623. * Assert whether a prop is valid.
  47624. */
  47625. function assertProp (
  47626. prop,
  47627. name,
  47628. value,
  47629. vm,
  47630. absent
  47631. ) {
  47632. if (prop.required && absent) {
  47633. warn(
  47634. 'Missing required prop: "' + name + '"',
  47635. vm
  47636. );
  47637. return
  47638. }
  47639. if (value == null && !prop.required) {
  47640. return
  47641. }
  47642. var type = prop.type;
  47643. var valid = !type || type === true;
  47644. var expectedTypes = [];
  47645. if (type) {
  47646. if (!Array.isArray(type)) {
  47647. type = [type];
  47648. }
  47649. for (var i = 0; i < type.length && !valid; i++) {
  47650. var assertedType = assertType(value, type[i]);
  47651. expectedTypes.push(assertedType.expectedType || '');
  47652. valid = assertedType.valid;
  47653. }
  47654. }
  47655. if (!valid) {
  47656. warn(
  47657. getInvalidTypeMessage(name, value, expectedTypes),
  47658. vm
  47659. );
  47660. return
  47661. }
  47662. var validator = prop.validator;
  47663. if (validator) {
  47664. if (!validator(value)) {
  47665. warn(
  47666. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  47667. vm
  47668. );
  47669. }
  47670. }
  47671. }
  47672. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  47673. function assertType (value, type) {
  47674. var valid;
  47675. var expectedType = getType(type);
  47676. if (simpleCheckRE.test(expectedType)) {
  47677. var t = typeof value;
  47678. valid = t === expectedType.toLowerCase();
  47679. // for primitive wrapper objects
  47680. if (!valid && t === 'object') {
  47681. valid = value instanceof type;
  47682. }
  47683. } else if (expectedType === 'Object') {
  47684. valid = isPlainObject(value);
  47685. } else if (expectedType === 'Array') {
  47686. valid = Array.isArray(value);
  47687. } else {
  47688. valid = value instanceof type;
  47689. }
  47690. return {
  47691. valid: valid,
  47692. expectedType: expectedType
  47693. }
  47694. }
  47695. /**
  47696. * Use function string name to check built-in types,
  47697. * because a simple equality check will fail when running
  47698. * across different vms / iframes.
  47699. */
  47700. function getType (fn) {
  47701. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  47702. return match ? match[1] : ''
  47703. }
  47704. function isSameType (a, b) {
  47705. return getType(a) === getType(b)
  47706. }
  47707. function getTypeIndex (type, expectedTypes) {
  47708. if (!Array.isArray(expectedTypes)) {
  47709. return isSameType(expectedTypes, type) ? 0 : -1
  47710. }
  47711. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  47712. if (isSameType(expectedTypes[i], type)) {
  47713. return i
  47714. }
  47715. }
  47716. return -1
  47717. }
  47718. function getInvalidTypeMessage (name, value, expectedTypes) {
  47719. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  47720. " Expected " + (expectedTypes.map(capitalize).join(', '));
  47721. var expectedType = expectedTypes[0];
  47722. var receivedType = toRawType(value);
  47723. var expectedValue = styleValue(value, expectedType);
  47724. var receivedValue = styleValue(value, receivedType);
  47725. // check if we need to specify expected value
  47726. if (expectedTypes.length === 1 &&
  47727. isExplicable(expectedType) &&
  47728. !isBoolean(expectedType, receivedType)) {
  47729. message += " with value " + expectedValue;
  47730. }
  47731. message += ", got " + receivedType + " ";
  47732. // check if we need to specify received value
  47733. if (isExplicable(receivedType)) {
  47734. message += "with value " + receivedValue + ".";
  47735. }
  47736. return message
  47737. }
  47738. function styleValue (value, type) {
  47739. if (type === 'String') {
  47740. return ("\"" + value + "\"")
  47741. } else if (type === 'Number') {
  47742. return ("" + (Number(value)))
  47743. } else {
  47744. return ("" + value)
  47745. }
  47746. }
  47747. function isExplicable (value) {
  47748. var explicitTypes = ['string', 'number', 'boolean'];
  47749. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  47750. }
  47751. function isBoolean () {
  47752. var args = [], len = arguments.length;
  47753. while ( len-- ) args[ len ] = arguments[ len ];
  47754. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  47755. }
  47756. /* */
  47757. function handleError (err, vm, info) {
  47758. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  47759. // See: https://github.com/vuejs/vuex/issues/1505
  47760. pushTarget();
  47761. try {
  47762. if (vm) {
  47763. var cur = vm;
  47764. while ((cur = cur.$parent)) {
  47765. var hooks = cur.$options.errorCaptured;
  47766. if (hooks) {
  47767. for (var i = 0; i < hooks.length; i++) {
  47768. try {
  47769. var capture = hooks[i].call(cur, err, vm, info) === false;
  47770. if (capture) { return }
  47771. } catch (e) {
  47772. globalHandleError(e, cur, 'errorCaptured hook');
  47773. }
  47774. }
  47775. }
  47776. }
  47777. }
  47778. globalHandleError(err, vm, info);
  47779. } finally {
  47780. popTarget();
  47781. }
  47782. }
  47783. function invokeWithErrorHandling (
  47784. handler,
  47785. context,
  47786. args,
  47787. vm,
  47788. info
  47789. ) {
  47790. var res;
  47791. try {
  47792. res = args ? handler.apply(context, args) : handler.call(context);
  47793. if (res && !res._isVue && isPromise(res) && !res._handled) {
  47794. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  47795. // issue #9511
  47796. // avoid catch triggering multiple times when nested calls
  47797. res._handled = true;
  47798. }
  47799. } catch (e) {
  47800. handleError(e, vm, info);
  47801. }
  47802. return res
  47803. }
  47804. function globalHandleError (err, vm, info) {
  47805. if (config.errorHandler) {
  47806. try {
  47807. return config.errorHandler.call(null, err, vm, info)
  47808. } catch (e) {
  47809. // if the user intentionally throws the original error in the handler,
  47810. // do not log it twice
  47811. if (e !== err) {
  47812. logError(e, null, 'config.errorHandler');
  47813. }
  47814. }
  47815. }
  47816. logError(err, vm, info);
  47817. }
  47818. function logError (err, vm, info) {
  47819. {
  47820. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  47821. }
  47822. /* istanbul ignore else */
  47823. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  47824. console.error(err);
  47825. } else {
  47826. throw err
  47827. }
  47828. }
  47829. /* */
  47830. var isUsingMicroTask = false;
  47831. var callbacks = [];
  47832. var pending = false;
  47833. function flushCallbacks () {
  47834. pending = false;
  47835. var copies = callbacks.slice(0);
  47836. callbacks.length = 0;
  47837. for (var i = 0; i < copies.length; i++) {
  47838. copies[i]();
  47839. }
  47840. }
  47841. // Here we have async deferring wrappers using microtasks.
  47842. // In 2.5 we used (macro) tasks (in combination with microtasks).
  47843. // However, it has subtle problems when state is changed right before repaint
  47844. // (e.g. #6813, out-in transitions).
  47845. // Also, using (macro) tasks in event handler would cause some weird behaviors
  47846. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  47847. // So we now use microtasks everywhere, again.
  47848. // A major drawback of this tradeoff is that there are some scenarios
  47849. // where microtasks have too high a priority and fire in between supposedly
  47850. // sequential events (e.g. #4521, #6690, which have workarounds)
  47851. // or even between bubbling of the same event (#6566).
  47852. var timerFunc;
  47853. // The nextTick behavior leverages the microtask queue, which can be accessed
  47854. // via either native Promise.then or MutationObserver.
  47855. // MutationObserver has wider support, however it is seriously bugged in
  47856. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  47857. // completely stops working after triggering a few times... so, if native
  47858. // Promise is available, we will use it:
  47859. /* istanbul ignore next, $flow-disable-line */
  47860. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  47861. var p = Promise.resolve();
  47862. timerFunc = function () {
  47863. p.then(flushCallbacks);
  47864. // In problematic UIWebViews, Promise.then doesn't completely break, but
  47865. // it can get stuck in a weird state where callbacks are pushed into the
  47866. // microtask queue but the queue isn't being flushed, until the browser
  47867. // needs to do some other work, e.g. handle a timer. Therefore we can
  47868. // "force" the microtask queue to be flushed by adding an empty timer.
  47869. if (isIOS) { setTimeout(noop); }
  47870. };
  47871. isUsingMicroTask = true;
  47872. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  47873. isNative(MutationObserver) ||
  47874. // PhantomJS and iOS 7.x
  47875. MutationObserver.toString() === '[object MutationObserverConstructor]'
  47876. )) {
  47877. // Use MutationObserver where native Promise is not available,
  47878. // e.g. PhantomJS, iOS7, Android 4.4
  47879. // (#6466 MutationObserver is unreliable in IE11)
  47880. var counter = 1;
  47881. var observer = new MutationObserver(flushCallbacks);
  47882. var textNode = document.createTextNode(String(counter));
  47883. observer.observe(textNode, {
  47884. characterData: true
  47885. });
  47886. timerFunc = function () {
  47887. counter = (counter + 1) % 2;
  47888. textNode.data = String(counter);
  47889. };
  47890. isUsingMicroTask = true;
  47891. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  47892. // Fallback to setImmediate.
  47893. // Technically it leverages the (macro) task queue,
  47894. // but it is still a better choice than setTimeout.
  47895. timerFunc = function () {
  47896. setImmediate(flushCallbacks);
  47897. };
  47898. } else {
  47899. // Fallback to setTimeout.
  47900. timerFunc = function () {
  47901. setTimeout(flushCallbacks, 0);
  47902. };
  47903. }
  47904. function nextTick (cb, ctx) {
  47905. var _resolve;
  47906. callbacks.push(function () {
  47907. if (cb) {
  47908. try {
  47909. cb.call(ctx);
  47910. } catch (e) {
  47911. handleError(e, ctx, 'nextTick');
  47912. }
  47913. } else if (_resolve) {
  47914. _resolve(ctx);
  47915. }
  47916. });
  47917. if (!pending) {
  47918. pending = true;
  47919. timerFunc();
  47920. }
  47921. // $flow-disable-line
  47922. if (!cb && typeof Promise !== 'undefined') {
  47923. return new Promise(function (resolve) {
  47924. _resolve = resolve;
  47925. })
  47926. }
  47927. }
  47928. /* */
  47929. var mark;
  47930. var measure;
  47931. {
  47932. var perf = inBrowser && window.performance;
  47933. /* istanbul ignore if */
  47934. if (
  47935. perf &&
  47936. perf.mark &&
  47937. perf.measure &&
  47938. perf.clearMarks &&
  47939. perf.clearMeasures
  47940. ) {
  47941. mark = function (tag) { return perf.mark(tag); };
  47942. measure = function (name, startTag, endTag) {
  47943. perf.measure(name, startTag, endTag);
  47944. perf.clearMarks(startTag);
  47945. perf.clearMarks(endTag);
  47946. // perf.clearMeasures(name)
  47947. };
  47948. }
  47949. }
  47950. /* not type checking this file because flow doesn't play well with Proxy */
  47951. var initProxy;
  47952. {
  47953. var allowedGlobals = makeMap(
  47954. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  47955. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  47956. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  47957. 'require' // for Webpack/Browserify
  47958. );
  47959. var warnNonPresent = function (target, key) {
  47960. warn(
  47961. "Property or method \"" + key + "\" is not defined on the instance but " +
  47962. 'referenced during render. Make sure that this property is reactive, ' +
  47963. 'either in the data option, or for class-based components, by ' +
  47964. 'initializing the property. ' +
  47965. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  47966. target
  47967. );
  47968. };
  47969. var warnReservedPrefix = function (target, key) {
  47970. warn(
  47971. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  47972. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  47973. 'prevent conflicts with Vue internals. ' +
  47974. 'See: https://vuejs.org/v2/api/#data',
  47975. target
  47976. );
  47977. };
  47978. var hasProxy =
  47979. typeof Proxy !== 'undefined' && isNative(Proxy);
  47980. if (hasProxy) {
  47981. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  47982. config.keyCodes = new Proxy(config.keyCodes, {
  47983. set: function set (target, key, value) {
  47984. if (isBuiltInModifier(key)) {
  47985. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  47986. return false
  47987. } else {
  47988. target[key] = value;
  47989. return true
  47990. }
  47991. }
  47992. });
  47993. }
  47994. var hasHandler = {
  47995. has: function has (target, key) {
  47996. var has = key in target;
  47997. var isAllowed = allowedGlobals(key) ||
  47998. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  47999. if (!has && !isAllowed) {
  48000. if (key in target.$data) { warnReservedPrefix(target, key); }
  48001. else { warnNonPresent(target, key); }
  48002. }
  48003. return has || !isAllowed
  48004. }
  48005. };
  48006. var getHandler = {
  48007. get: function get (target, key) {
  48008. if (typeof key === 'string' && !(key in target)) {
  48009. if (key in target.$data) { warnReservedPrefix(target, key); }
  48010. else { warnNonPresent(target, key); }
  48011. }
  48012. return target[key]
  48013. }
  48014. };
  48015. initProxy = function initProxy (vm) {
  48016. if (hasProxy) {
  48017. // determine which proxy handler to use
  48018. var options = vm.$options;
  48019. var handlers = options.render && options.render._withStripped
  48020. ? getHandler
  48021. : hasHandler;
  48022. vm._renderProxy = new Proxy(vm, handlers);
  48023. } else {
  48024. vm._renderProxy = vm;
  48025. }
  48026. };
  48027. }
  48028. /* */
  48029. var seenObjects = new _Set();
  48030. /**
  48031. * Recursively traverse an object to evoke all converted
  48032. * getters, so that every nested property inside the object
  48033. * is collected as a "deep" dependency.
  48034. */
  48035. function traverse (val) {
  48036. _traverse(val, seenObjects);
  48037. seenObjects.clear();
  48038. }
  48039. function _traverse (val, seen) {
  48040. var i, keys;
  48041. var isA = Array.isArray(val);
  48042. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  48043. return
  48044. }
  48045. if (val.__ob__) {
  48046. var depId = val.__ob__.dep.id;
  48047. if (seen.has(depId)) {
  48048. return
  48049. }
  48050. seen.add(depId);
  48051. }
  48052. if (isA) {
  48053. i = val.length;
  48054. while (i--) { _traverse(val[i], seen); }
  48055. } else {
  48056. keys = Object.keys(val);
  48057. i = keys.length;
  48058. while (i--) { _traverse(val[keys[i]], seen); }
  48059. }
  48060. }
  48061. /* */
  48062. var normalizeEvent = cached(function (name) {
  48063. var passive = name.charAt(0) === '&';
  48064. name = passive ? name.slice(1) : name;
  48065. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  48066. name = once$$1 ? name.slice(1) : name;
  48067. var capture = name.charAt(0) === '!';
  48068. name = capture ? name.slice(1) : name;
  48069. return {
  48070. name: name,
  48071. once: once$$1,
  48072. capture: capture,
  48073. passive: passive
  48074. }
  48075. });
  48076. function createFnInvoker (fns, vm) {
  48077. function invoker () {
  48078. var arguments$1 = arguments;
  48079. var fns = invoker.fns;
  48080. if (Array.isArray(fns)) {
  48081. var cloned = fns.slice();
  48082. for (var i = 0; i < cloned.length; i++) {
  48083. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  48084. }
  48085. } else {
  48086. // return handler return value for single handlers
  48087. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  48088. }
  48089. }
  48090. invoker.fns = fns;
  48091. return invoker
  48092. }
  48093. function updateListeners (
  48094. on,
  48095. oldOn,
  48096. add,
  48097. remove$$1,
  48098. createOnceHandler,
  48099. vm
  48100. ) {
  48101. var name, def$$1, cur, old, event;
  48102. for (name in on) {
  48103. def$$1 = cur = on[name];
  48104. old = oldOn[name];
  48105. event = normalizeEvent(name);
  48106. if (isUndef(cur)) {
  48107. warn(
  48108. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  48109. vm
  48110. );
  48111. } else if (isUndef(old)) {
  48112. if (isUndef(cur.fns)) {
  48113. cur = on[name] = createFnInvoker(cur, vm);
  48114. }
  48115. if (isTrue(event.once)) {
  48116. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  48117. }
  48118. add(event.name, cur, event.capture, event.passive, event.params);
  48119. } else if (cur !== old) {
  48120. old.fns = cur;
  48121. on[name] = old;
  48122. }
  48123. }
  48124. for (name in oldOn) {
  48125. if (isUndef(on[name])) {
  48126. event = normalizeEvent(name);
  48127. remove$$1(event.name, oldOn[name], event.capture);
  48128. }
  48129. }
  48130. }
  48131. /* */
  48132. function mergeVNodeHook (def, hookKey, hook) {
  48133. if (def instanceof VNode) {
  48134. def = def.data.hook || (def.data.hook = {});
  48135. }
  48136. var invoker;
  48137. var oldHook = def[hookKey];
  48138. function wrappedHook () {
  48139. hook.apply(this, arguments);
  48140. // important: remove merged hook to ensure it's called only once
  48141. // and prevent memory leak
  48142. remove(invoker.fns, wrappedHook);
  48143. }
  48144. if (isUndef(oldHook)) {
  48145. // no existing hook
  48146. invoker = createFnInvoker([wrappedHook]);
  48147. } else {
  48148. /* istanbul ignore if */
  48149. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  48150. // already a merged invoker
  48151. invoker = oldHook;
  48152. invoker.fns.push(wrappedHook);
  48153. } else {
  48154. // existing plain hook
  48155. invoker = createFnInvoker([oldHook, wrappedHook]);
  48156. }
  48157. }
  48158. invoker.merged = true;
  48159. def[hookKey] = invoker;
  48160. }
  48161. /* */
  48162. function extractPropsFromVNodeData (
  48163. data,
  48164. Ctor,
  48165. tag
  48166. ) {
  48167. // we are only extracting raw values here.
  48168. // validation and default values are handled in the child
  48169. // component itself.
  48170. var propOptions = Ctor.options.props;
  48171. if (isUndef(propOptions)) {
  48172. return
  48173. }
  48174. var res = {};
  48175. var attrs = data.attrs;
  48176. var props = data.props;
  48177. if (isDef(attrs) || isDef(props)) {
  48178. for (var key in propOptions) {
  48179. var altKey = hyphenate(key);
  48180. {
  48181. var keyInLowerCase = key.toLowerCase();
  48182. if (
  48183. key !== keyInLowerCase &&
  48184. attrs && hasOwn(attrs, keyInLowerCase)
  48185. ) {
  48186. tip(
  48187. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  48188. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  48189. " \"" + key + "\". " +
  48190. "Note that HTML attributes are case-insensitive and camelCased " +
  48191. "props need to use their kebab-case equivalents when using in-DOM " +
  48192. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  48193. );
  48194. }
  48195. }
  48196. checkProp(res, props, key, altKey, true) ||
  48197. checkProp(res, attrs, key, altKey, false);
  48198. }
  48199. }
  48200. return res
  48201. }
  48202. function checkProp (
  48203. res,
  48204. hash,
  48205. key,
  48206. altKey,
  48207. preserve
  48208. ) {
  48209. if (isDef(hash)) {
  48210. if (hasOwn(hash, key)) {
  48211. res[key] = hash[key];
  48212. if (!preserve) {
  48213. delete hash[key];
  48214. }
  48215. return true
  48216. } else if (hasOwn(hash, altKey)) {
  48217. res[key] = hash[altKey];
  48218. if (!preserve) {
  48219. delete hash[altKey];
  48220. }
  48221. return true
  48222. }
  48223. }
  48224. return false
  48225. }
  48226. /* */
  48227. // The template compiler attempts to minimize the need for normalization by
  48228. // statically analyzing the template at compile time.
  48229. //
  48230. // For plain HTML markup, normalization can be completely skipped because the
  48231. // generated render function is guaranteed to return Array<VNode>. There are
  48232. // two cases where extra normalization is needed:
  48233. // 1. When the children contains components - because a functional component
  48234. // may return an Array instead of a single root. In this case, just a simple
  48235. // normalization is needed - if any child is an Array, we flatten the whole
  48236. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  48237. // because functional components already normalize their own children.
  48238. function simpleNormalizeChildren (children) {
  48239. for (var i = 0; i < children.length; i++) {
  48240. if (Array.isArray(children[i])) {
  48241. return Array.prototype.concat.apply([], children)
  48242. }
  48243. }
  48244. return children
  48245. }
  48246. // 2. When the children contains constructs that always generated nested Arrays,
  48247. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  48248. // with hand-written render functions / JSX. In such cases a full normalization
  48249. // is needed to cater to all possible types of children values.
  48250. function normalizeChildren (children) {
  48251. return isPrimitive(children)
  48252. ? [createTextVNode(children)]
  48253. : Array.isArray(children)
  48254. ? normalizeArrayChildren(children)
  48255. : undefined
  48256. }
  48257. function isTextNode (node) {
  48258. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  48259. }
  48260. function normalizeArrayChildren (children, nestedIndex) {
  48261. var res = [];
  48262. var i, c, lastIndex, last;
  48263. for (i = 0; i < children.length; i++) {
  48264. c = children[i];
  48265. if (isUndef(c) || typeof c === 'boolean') { continue }
  48266. lastIndex = res.length - 1;
  48267. last = res[lastIndex];
  48268. // nested
  48269. if (Array.isArray(c)) {
  48270. if (c.length > 0) {
  48271. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  48272. // merge adjacent text nodes
  48273. if (isTextNode(c[0]) && isTextNode(last)) {
  48274. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  48275. c.shift();
  48276. }
  48277. res.push.apply(res, c);
  48278. }
  48279. } else if (isPrimitive(c)) {
  48280. if (isTextNode(last)) {
  48281. // merge adjacent text nodes
  48282. // this is necessary for SSR hydration because text nodes are
  48283. // essentially merged when rendered to HTML strings
  48284. res[lastIndex] = createTextVNode(last.text + c);
  48285. } else if (c !== '') {
  48286. // convert primitive to vnode
  48287. res.push(createTextVNode(c));
  48288. }
  48289. } else {
  48290. if (isTextNode(c) && isTextNode(last)) {
  48291. // merge adjacent text nodes
  48292. res[lastIndex] = createTextVNode(last.text + c.text);
  48293. } else {
  48294. // default key for nested array children (likely generated by v-for)
  48295. if (isTrue(children._isVList) &&
  48296. isDef(c.tag) &&
  48297. isUndef(c.key) &&
  48298. isDef(nestedIndex)) {
  48299. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  48300. }
  48301. res.push(c);
  48302. }
  48303. }
  48304. }
  48305. return res
  48306. }
  48307. /* */
  48308. function initProvide (vm) {
  48309. var provide = vm.$options.provide;
  48310. if (provide) {
  48311. vm._provided = typeof provide === 'function'
  48312. ? provide.call(vm)
  48313. : provide;
  48314. }
  48315. }
  48316. function initInjections (vm) {
  48317. var result = resolveInject(vm.$options.inject, vm);
  48318. if (result) {
  48319. toggleObserving(false);
  48320. Object.keys(result).forEach(function (key) {
  48321. /* istanbul ignore else */
  48322. {
  48323. defineReactive$$1(vm, key, result[key], function () {
  48324. warn(
  48325. "Avoid mutating an injected value directly since the changes will be " +
  48326. "overwritten whenever the provided component re-renders. " +
  48327. "injection being mutated: \"" + key + "\"",
  48328. vm
  48329. );
  48330. });
  48331. }
  48332. });
  48333. toggleObserving(true);
  48334. }
  48335. }
  48336. function resolveInject (inject, vm) {
  48337. if (inject) {
  48338. // inject is :any because flow is not smart enough to figure out cached
  48339. var result = Object.create(null);
  48340. var keys = hasSymbol
  48341. ? Reflect.ownKeys(inject)
  48342. : Object.keys(inject);
  48343. for (var i = 0; i < keys.length; i++) {
  48344. var key = keys[i];
  48345. // #6574 in case the inject object is observed...
  48346. if (key === '__ob__') { continue }
  48347. var provideKey = inject[key].from;
  48348. var source = vm;
  48349. while (source) {
  48350. if (source._provided && hasOwn(source._provided, provideKey)) {
  48351. result[key] = source._provided[provideKey];
  48352. break
  48353. }
  48354. source = source.$parent;
  48355. }
  48356. if (!source) {
  48357. if ('default' in inject[key]) {
  48358. var provideDefault = inject[key].default;
  48359. result[key] = typeof provideDefault === 'function'
  48360. ? provideDefault.call(vm)
  48361. : provideDefault;
  48362. } else {
  48363. warn(("Injection \"" + key + "\" not found"), vm);
  48364. }
  48365. }
  48366. }
  48367. return result
  48368. }
  48369. }
  48370. /* */
  48371. /**
  48372. * Runtime helper for resolving raw children VNodes into a slot object.
  48373. */
  48374. function resolveSlots (
  48375. children,
  48376. context
  48377. ) {
  48378. if (!children || !children.length) {
  48379. return {}
  48380. }
  48381. var slots = {};
  48382. for (var i = 0, l = children.length; i < l; i++) {
  48383. var child = children[i];
  48384. var data = child.data;
  48385. // remove slot attribute if the node is resolved as a Vue slot node
  48386. if (data && data.attrs && data.attrs.slot) {
  48387. delete data.attrs.slot;
  48388. }
  48389. // named slots should only be respected if the vnode was rendered in the
  48390. // same context.
  48391. if ((child.context === context || child.fnContext === context) &&
  48392. data && data.slot != null
  48393. ) {
  48394. var name = data.slot;
  48395. var slot = (slots[name] || (slots[name] = []));
  48396. if (child.tag === 'template') {
  48397. slot.push.apply(slot, child.children || []);
  48398. } else {
  48399. slot.push(child);
  48400. }
  48401. } else {
  48402. (slots.default || (slots.default = [])).push(child);
  48403. }
  48404. }
  48405. // ignore slots that contains only whitespace
  48406. for (var name$1 in slots) {
  48407. if (slots[name$1].every(isWhitespace)) {
  48408. delete slots[name$1];
  48409. }
  48410. }
  48411. return slots
  48412. }
  48413. function isWhitespace (node) {
  48414. return (node.isComment && !node.asyncFactory) || node.text === ' '
  48415. }
  48416. /* */
  48417. function normalizeScopedSlots (
  48418. slots,
  48419. normalSlots,
  48420. prevSlots
  48421. ) {
  48422. var res;
  48423. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  48424. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  48425. var key = slots && slots.$key;
  48426. if (!slots) {
  48427. res = {};
  48428. } else if (slots._normalized) {
  48429. // fast path 1: child component re-render only, parent did not change
  48430. return slots._normalized
  48431. } else if (
  48432. isStable &&
  48433. prevSlots &&
  48434. prevSlots !== emptyObject &&
  48435. key === prevSlots.$key &&
  48436. !hasNormalSlots &&
  48437. !prevSlots.$hasNormal
  48438. ) {
  48439. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  48440. // only need to normalize once
  48441. return prevSlots
  48442. } else {
  48443. res = {};
  48444. for (var key$1 in slots) {
  48445. if (slots[key$1] && key$1[0] !== '$') {
  48446. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  48447. }
  48448. }
  48449. }
  48450. // expose normal slots on scopedSlots
  48451. for (var key$2 in normalSlots) {
  48452. if (!(key$2 in res)) {
  48453. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  48454. }
  48455. }
  48456. // avoriaz seems to mock a non-extensible $scopedSlots object
  48457. // and when that is passed down this would cause an error
  48458. if (slots && Object.isExtensible(slots)) {
  48459. (slots)._normalized = res;
  48460. }
  48461. def(res, '$stable', isStable);
  48462. def(res, '$key', key);
  48463. def(res, '$hasNormal', hasNormalSlots);
  48464. return res
  48465. }
  48466. function normalizeScopedSlot(normalSlots, key, fn) {
  48467. var normalized = function () {
  48468. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  48469. res = res && typeof res === 'object' && !Array.isArray(res)
  48470. ? [res] // single vnode
  48471. : normalizeChildren(res);
  48472. return res && (
  48473. res.length === 0 ||
  48474. (res.length === 1 && res[0].isComment) // #9658
  48475. ) ? undefined
  48476. : res
  48477. };
  48478. // this is a slot using the new v-slot syntax without scope. although it is
  48479. // compiled as a scoped slot, render fn users would expect it to be present
  48480. // on this.$slots because the usage is semantically a normal slot.
  48481. if (fn.proxy) {
  48482. Object.defineProperty(normalSlots, key, {
  48483. get: normalized,
  48484. enumerable: true,
  48485. configurable: true
  48486. });
  48487. }
  48488. return normalized
  48489. }
  48490. function proxyNormalSlot(slots, key) {
  48491. return function () { return slots[key]; }
  48492. }
  48493. /* */
  48494. /**
  48495. * Runtime helper for rendering v-for lists.
  48496. */
  48497. function renderList (
  48498. val,
  48499. render
  48500. ) {
  48501. var ret, i, l, keys, key;
  48502. if (Array.isArray(val) || typeof val === 'string') {
  48503. ret = new Array(val.length);
  48504. for (i = 0, l = val.length; i < l; i++) {
  48505. ret[i] = render(val[i], i);
  48506. }
  48507. } else if (typeof val === 'number') {
  48508. ret = new Array(val);
  48509. for (i = 0; i < val; i++) {
  48510. ret[i] = render(i + 1, i);
  48511. }
  48512. } else if (isObject(val)) {
  48513. if (hasSymbol && val[Symbol.iterator]) {
  48514. ret = [];
  48515. var iterator = val[Symbol.iterator]();
  48516. var result = iterator.next();
  48517. while (!result.done) {
  48518. ret.push(render(result.value, ret.length));
  48519. result = iterator.next();
  48520. }
  48521. } else {
  48522. keys = Object.keys(val);
  48523. ret = new Array(keys.length);
  48524. for (i = 0, l = keys.length; i < l; i++) {
  48525. key = keys[i];
  48526. ret[i] = render(val[key], key, i);
  48527. }
  48528. }
  48529. }
  48530. if (!isDef(ret)) {
  48531. ret = [];
  48532. }
  48533. (ret)._isVList = true;
  48534. return ret
  48535. }
  48536. /* */
  48537. /**
  48538. * Runtime helper for rendering <slot>
  48539. */
  48540. function renderSlot (
  48541. name,
  48542. fallback,
  48543. props,
  48544. bindObject
  48545. ) {
  48546. var scopedSlotFn = this.$scopedSlots[name];
  48547. var nodes;
  48548. if (scopedSlotFn) { // scoped slot
  48549. props = props || {};
  48550. if (bindObject) {
  48551. if (!isObject(bindObject)) {
  48552. warn(
  48553. 'slot v-bind without argument expects an Object',
  48554. this
  48555. );
  48556. }
  48557. props = extend(extend({}, bindObject), props);
  48558. }
  48559. nodes = scopedSlotFn(props) || fallback;
  48560. } else {
  48561. nodes = this.$slots[name] || fallback;
  48562. }
  48563. var target = props && props.slot;
  48564. if (target) {
  48565. return this.$createElement('template', { slot: target }, nodes)
  48566. } else {
  48567. return nodes
  48568. }
  48569. }
  48570. /* */
  48571. /**
  48572. * Runtime helper for resolving filters
  48573. */
  48574. function resolveFilter (id) {
  48575. return resolveAsset(this.$options, 'filters', id, true) || identity
  48576. }
  48577. /* */
  48578. function isKeyNotMatch (expect, actual) {
  48579. if (Array.isArray(expect)) {
  48580. return expect.indexOf(actual) === -1
  48581. } else {
  48582. return expect !== actual
  48583. }
  48584. }
  48585. /**
  48586. * Runtime helper for checking keyCodes from config.
  48587. * exposed as Vue.prototype._k
  48588. * passing in eventKeyName as last argument separately for backwards compat
  48589. */
  48590. function checkKeyCodes (
  48591. eventKeyCode,
  48592. key,
  48593. builtInKeyCode,
  48594. eventKeyName,
  48595. builtInKeyName
  48596. ) {
  48597. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  48598. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  48599. return isKeyNotMatch(builtInKeyName, eventKeyName)
  48600. } else if (mappedKeyCode) {
  48601. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  48602. } else if (eventKeyName) {
  48603. return hyphenate(eventKeyName) !== key
  48604. }
  48605. }
  48606. /* */
  48607. /**
  48608. * Runtime helper for merging v-bind="object" into a VNode's data.
  48609. */
  48610. function bindObjectProps (
  48611. data,
  48612. tag,
  48613. value,
  48614. asProp,
  48615. isSync
  48616. ) {
  48617. if (value) {
  48618. if (!isObject(value)) {
  48619. warn(
  48620. 'v-bind without argument expects an Object or Array value',
  48621. this
  48622. );
  48623. } else {
  48624. if (Array.isArray(value)) {
  48625. value = toObject(value);
  48626. }
  48627. var hash;
  48628. var loop = function ( key ) {
  48629. if (
  48630. key === 'class' ||
  48631. key === 'style' ||
  48632. isReservedAttribute(key)
  48633. ) {
  48634. hash = data;
  48635. } else {
  48636. var type = data.attrs && data.attrs.type;
  48637. hash = asProp || config.mustUseProp(tag, type, key)
  48638. ? data.domProps || (data.domProps = {})
  48639. : data.attrs || (data.attrs = {});
  48640. }
  48641. var camelizedKey = camelize(key);
  48642. var hyphenatedKey = hyphenate(key);
  48643. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  48644. hash[key] = value[key];
  48645. if (isSync) {
  48646. var on = data.on || (data.on = {});
  48647. on[("update:" + key)] = function ($event) {
  48648. value[key] = $event;
  48649. };
  48650. }
  48651. }
  48652. };
  48653. for (var key in value) loop( key );
  48654. }
  48655. }
  48656. return data
  48657. }
  48658. /* */
  48659. /**
  48660. * Runtime helper for rendering static trees.
  48661. */
  48662. function renderStatic (
  48663. index,
  48664. isInFor
  48665. ) {
  48666. var cached = this._staticTrees || (this._staticTrees = []);
  48667. var tree = cached[index];
  48668. // if has already-rendered static tree and not inside v-for,
  48669. // we can reuse the same tree.
  48670. if (tree && !isInFor) {
  48671. return tree
  48672. }
  48673. // otherwise, render a fresh tree.
  48674. tree = cached[index] = this.$options.staticRenderFns[index].call(
  48675. this._renderProxy,
  48676. null,
  48677. this // for render fns generated for functional component templates
  48678. );
  48679. markStatic(tree, ("__static__" + index), false);
  48680. return tree
  48681. }
  48682. /**
  48683. * Runtime helper for v-once.
  48684. * Effectively it means marking the node as static with a unique key.
  48685. */
  48686. function markOnce (
  48687. tree,
  48688. index,
  48689. key
  48690. ) {
  48691. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  48692. return tree
  48693. }
  48694. function markStatic (
  48695. tree,
  48696. key,
  48697. isOnce
  48698. ) {
  48699. if (Array.isArray(tree)) {
  48700. for (var i = 0; i < tree.length; i++) {
  48701. if (tree[i] && typeof tree[i] !== 'string') {
  48702. markStaticNode(tree[i], (key + "_" + i), isOnce);
  48703. }
  48704. }
  48705. } else {
  48706. markStaticNode(tree, key, isOnce);
  48707. }
  48708. }
  48709. function markStaticNode (node, key, isOnce) {
  48710. node.isStatic = true;
  48711. node.key = key;
  48712. node.isOnce = isOnce;
  48713. }
  48714. /* */
  48715. function bindObjectListeners (data, value) {
  48716. if (value) {
  48717. if (!isPlainObject(value)) {
  48718. warn(
  48719. 'v-on without argument expects an Object value',
  48720. this
  48721. );
  48722. } else {
  48723. var on = data.on = data.on ? extend({}, data.on) : {};
  48724. for (var key in value) {
  48725. var existing = on[key];
  48726. var ours = value[key];
  48727. on[key] = existing ? [].concat(existing, ours) : ours;
  48728. }
  48729. }
  48730. }
  48731. return data
  48732. }
  48733. /* */
  48734. function resolveScopedSlots (
  48735. fns, // see flow/vnode
  48736. res,
  48737. // the following are added in 2.6
  48738. hasDynamicKeys,
  48739. contentHashKey
  48740. ) {
  48741. res = res || { $stable: !hasDynamicKeys };
  48742. for (var i = 0; i < fns.length; i++) {
  48743. var slot = fns[i];
  48744. if (Array.isArray(slot)) {
  48745. resolveScopedSlots(slot, res, hasDynamicKeys);
  48746. } else if (slot) {
  48747. // marker for reverse proxying v-slot without scope on this.$slots
  48748. if (slot.proxy) {
  48749. slot.fn.proxy = true;
  48750. }
  48751. res[slot.key] = slot.fn;
  48752. }
  48753. }
  48754. if (contentHashKey) {
  48755. (res).$key = contentHashKey;
  48756. }
  48757. return res
  48758. }
  48759. /* */
  48760. function bindDynamicKeys (baseObj, values) {
  48761. for (var i = 0; i < values.length; i += 2) {
  48762. var key = values[i];
  48763. if (typeof key === 'string' && key) {
  48764. baseObj[values[i]] = values[i + 1];
  48765. } else if (key !== '' && key !== null) {
  48766. // null is a special value for explicitly removing a binding
  48767. warn(
  48768. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  48769. this
  48770. );
  48771. }
  48772. }
  48773. return baseObj
  48774. }
  48775. // helper to dynamically append modifier runtime markers to event names.
  48776. // ensure only append when value is already string, otherwise it will be cast
  48777. // to string and cause the type check to miss.
  48778. function prependModifier (value, symbol) {
  48779. return typeof value === 'string' ? symbol + value : value
  48780. }
  48781. /* */
  48782. function installRenderHelpers (target) {
  48783. target._o = markOnce;
  48784. target._n = toNumber;
  48785. target._s = toString;
  48786. target._l = renderList;
  48787. target._t = renderSlot;
  48788. target._q = looseEqual;
  48789. target._i = looseIndexOf;
  48790. target._m = renderStatic;
  48791. target._f = resolveFilter;
  48792. target._k = checkKeyCodes;
  48793. target._b = bindObjectProps;
  48794. target._v = createTextVNode;
  48795. target._e = createEmptyVNode;
  48796. target._u = resolveScopedSlots;
  48797. target._g = bindObjectListeners;
  48798. target._d = bindDynamicKeys;
  48799. target._p = prependModifier;
  48800. }
  48801. /* */
  48802. function FunctionalRenderContext (
  48803. data,
  48804. props,
  48805. children,
  48806. parent,
  48807. Ctor
  48808. ) {
  48809. var this$1 = this;
  48810. var options = Ctor.options;
  48811. // ensure the createElement function in functional components
  48812. // gets a unique context - this is necessary for correct named slot check
  48813. var contextVm;
  48814. if (hasOwn(parent, '_uid')) {
  48815. contextVm = Object.create(parent);
  48816. // $flow-disable-line
  48817. contextVm._original = parent;
  48818. } else {
  48819. // the context vm passed in is a functional context as well.
  48820. // in this case we want to make sure we are able to get a hold to the
  48821. // real context instance.
  48822. contextVm = parent;
  48823. // $flow-disable-line
  48824. parent = parent._original;
  48825. }
  48826. var isCompiled = isTrue(options._compiled);
  48827. var needNormalization = !isCompiled;
  48828. this.data = data;
  48829. this.props = props;
  48830. this.children = children;
  48831. this.parent = parent;
  48832. this.listeners = data.on || emptyObject;
  48833. this.injections = resolveInject(options.inject, parent);
  48834. this.slots = function () {
  48835. if (!this$1.$slots) {
  48836. normalizeScopedSlots(
  48837. data.scopedSlots,
  48838. this$1.$slots = resolveSlots(children, parent)
  48839. );
  48840. }
  48841. return this$1.$slots
  48842. };
  48843. Object.defineProperty(this, 'scopedSlots', ({
  48844. enumerable: true,
  48845. get: function get () {
  48846. return normalizeScopedSlots(data.scopedSlots, this.slots())
  48847. }
  48848. }));
  48849. // support for compiled functional template
  48850. if (isCompiled) {
  48851. // exposing $options for renderStatic()
  48852. this.$options = options;
  48853. // pre-resolve slots for renderSlot()
  48854. this.$slots = this.slots();
  48855. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  48856. }
  48857. if (options._scopeId) {
  48858. this._c = function (a, b, c, d) {
  48859. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  48860. if (vnode && !Array.isArray(vnode)) {
  48861. vnode.fnScopeId = options._scopeId;
  48862. vnode.fnContext = parent;
  48863. }
  48864. return vnode
  48865. };
  48866. } else {
  48867. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  48868. }
  48869. }
  48870. installRenderHelpers(FunctionalRenderContext.prototype);
  48871. function createFunctionalComponent (
  48872. Ctor,
  48873. propsData,
  48874. data,
  48875. contextVm,
  48876. children
  48877. ) {
  48878. var options = Ctor.options;
  48879. var props = {};
  48880. var propOptions = options.props;
  48881. if (isDef(propOptions)) {
  48882. for (var key in propOptions) {
  48883. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  48884. }
  48885. } else {
  48886. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  48887. if (isDef(data.props)) { mergeProps(props, data.props); }
  48888. }
  48889. var renderContext = new FunctionalRenderContext(
  48890. data,
  48891. props,
  48892. children,
  48893. contextVm,
  48894. Ctor
  48895. );
  48896. var vnode = options.render.call(null, renderContext._c, renderContext);
  48897. if (vnode instanceof VNode) {
  48898. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  48899. } else if (Array.isArray(vnode)) {
  48900. var vnodes = normalizeChildren(vnode) || [];
  48901. var res = new Array(vnodes.length);
  48902. for (var i = 0; i < vnodes.length; i++) {
  48903. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  48904. }
  48905. return res
  48906. }
  48907. }
  48908. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  48909. // #7817 clone node before setting fnContext, otherwise if the node is reused
  48910. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  48911. // that should not be matched to match.
  48912. var clone = cloneVNode(vnode);
  48913. clone.fnContext = contextVm;
  48914. clone.fnOptions = options;
  48915. {
  48916. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  48917. }
  48918. if (data.slot) {
  48919. (clone.data || (clone.data = {})).slot = data.slot;
  48920. }
  48921. return clone
  48922. }
  48923. function mergeProps (to, from) {
  48924. for (var key in from) {
  48925. to[camelize(key)] = from[key];
  48926. }
  48927. }
  48928. /* */
  48929. /* */
  48930. /* */
  48931. /* */
  48932. // inline hooks to be invoked on component VNodes during patch
  48933. var componentVNodeHooks = {
  48934. init: function init (vnode, hydrating) {
  48935. if (
  48936. vnode.componentInstance &&
  48937. !vnode.componentInstance._isDestroyed &&
  48938. vnode.data.keepAlive
  48939. ) {
  48940. // kept-alive components, treat as a patch
  48941. var mountedNode = vnode; // work around flow
  48942. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  48943. } else {
  48944. var child = vnode.componentInstance = createComponentInstanceForVnode(
  48945. vnode,
  48946. activeInstance
  48947. );
  48948. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  48949. }
  48950. },
  48951. prepatch: function prepatch (oldVnode, vnode) {
  48952. var options = vnode.componentOptions;
  48953. var child = vnode.componentInstance = oldVnode.componentInstance;
  48954. updateChildComponent(
  48955. child,
  48956. options.propsData, // updated props
  48957. options.listeners, // updated listeners
  48958. vnode, // new parent vnode
  48959. options.children // new children
  48960. );
  48961. },
  48962. insert: function insert (vnode) {
  48963. var context = vnode.context;
  48964. var componentInstance = vnode.componentInstance;
  48965. if (!componentInstance._isMounted) {
  48966. componentInstance._isMounted = true;
  48967. callHook(componentInstance, 'mounted');
  48968. }
  48969. if (vnode.data.keepAlive) {
  48970. if (context._isMounted) {
  48971. // vue-router#1212
  48972. // During updates, a kept-alive component's child components may
  48973. // change, so directly walking the tree here may call activated hooks
  48974. // on incorrect children. Instead we push them into a queue which will
  48975. // be processed after the whole patch process ended.
  48976. queueActivatedComponent(componentInstance);
  48977. } else {
  48978. activateChildComponent(componentInstance, true /* direct */);
  48979. }
  48980. }
  48981. },
  48982. destroy: function destroy (vnode) {
  48983. var componentInstance = vnode.componentInstance;
  48984. if (!componentInstance._isDestroyed) {
  48985. if (!vnode.data.keepAlive) {
  48986. componentInstance.$destroy();
  48987. } else {
  48988. deactivateChildComponent(componentInstance, true /* direct */);
  48989. }
  48990. }
  48991. }
  48992. };
  48993. var hooksToMerge = Object.keys(componentVNodeHooks);
  48994. function createComponent (
  48995. Ctor,
  48996. data,
  48997. context,
  48998. children,
  48999. tag
  49000. ) {
  49001. if (isUndef(Ctor)) {
  49002. return
  49003. }
  49004. var baseCtor = context.$options._base;
  49005. // plain options object: turn it into a constructor
  49006. if (isObject(Ctor)) {
  49007. Ctor = baseCtor.extend(Ctor);
  49008. }
  49009. // if at this stage it's not a constructor or an async component factory,
  49010. // reject.
  49011. if (typeof Ctor !== 'function') {
  49012. {
  49013. warn(("Invalid Component definition: " + (String(Ctor))), context);
  49014. }
  49015. return
  49016. }
  49017. // async component
  49018. var asyncFactory;
  49019. if (isUndef(Ctor.cid)) {
  49020. asyncFactory = Ctor;
  49021. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  49022. if (Ctor === undefined) {
  49023. // return a placeholder node for async component, which is rendered
  49024. // as a comment node but preserves all the raw information for the node.
  49025. // the information will be used for async server-rendering and hydration.
  49026. return createAsyncPlaceholder(
  49027. asyncFactory,
  49028. data,
  49029. context,
  49030. children,
  49031. tag
  49032. )
  49033. }
  49034. }
  49035. data = data || {};
  49036. // resolve constructor options in case global mixins are applied after
  49037. // component constructor creation
  49038. resolveConstructorOptions(Ctor);
  49039. // transform component v-model data into props & events
  49040. if (isDef(data.model)) {
  49041. transformModel(Ctor.options, data);
  49042. }
  49043. // extract props
  49044. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  49045. // functional component
  49046. if (isTrue(Ctor.options.functional)) {
  49047. return createFunctionalComponent(Ctor, propsData, data, context, children)
  49048. }
  49049. // extract listeners, since these needs to be treated as
  49050. // child component listeners instead of DOM listeners
  49051. var listeners = data.on;
  49052. // replace with listeners with .native modifier
  49053. // so it gets processed during parent component patch.
  49054. data.on = data.nativeOn;
  49055. if (isTrue(Ctor.options.abstract)) {
  49056. // abstract components do not keep anything
  49057. // other than props & listeners & slot
  49058. // work around flow
  49059. var slot = data.slot;
  49060. data = {};
  49061. if (slot) {
  49062. data.slot = slot;
  49063. }
  49064. }
  49065. // install component management hooks onto the placeholder node
  49066. installComponentHooks(data);
  49067. // return a placeholder vnode
  49068. var name = Ctor.options.name || tag;
  49069. var vnode = new VNode(
  49070. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  49071. data, undefined, undefined, undefined, context,
  49072. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  49073. asyncFactory
  49074. );
  49075. return vnode
  49076. }
  49077. function createComponentInstanceForVnode (
  49078. vnode, // we know it's MountedComponentVNode but flow doesn't
  49079. parent // activeInstance in lifecycle state
  49080. ) {
  49081. var options = {
  49082. _isComponent: true,
  49083. _parentVnode: vnode,
  49084. parent: parent
  49085. };
  49086. // check inline-template render functions
  49087. var inlineTemplate = vnode.data.inlineTemplate;
  49088. if (isDef(inlineTemplate)) {
  49089. options.render = inlineTemplate.render;
  49090. options.staticRenderFns = inlineTemplate.staticRenderFns;
  49091. }
  49092. return new vnode.componentOptions.Ctor(options)
  49093. }
  49094. function installComponentHooks (data) {
  49095. var hooks = data.hook || (data.hook = {});
  49096. for (var i = 0; i < hooksToMerge.length; i++) {
  49097. var key = hooksToMerge[i];
  49098. var existing = hooks[key];
  49099. var toMerge = componentVNodeHooks[key];
  49100. if (existing !== toMerge && !(existing && existing._merged)) {
  49101. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  49102. }
  49103. }
  49104. }
  49105. function mergeHook$1 (f1, f2) {
  49106. var merged = function (a, b) {
  49107. // flow complains about extra args which is why we use any
  49108. f1(a, b);
  49109. f2(a, b);
  49110. };
  49111. merged._merged = true;
  49112. return merged
  49113. }
  49114. // transform component v-model info (value and callback) into
  49115. // prop and event handler respectively.
  49116. function transformModel (options, data) {
  49117. var prop = (options.model && options.model.prop) || 'value';
  49118. var event = (options.model && options.model.event) || 'input'
  49119. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  49120. var on = data.on || (data.on = {});
  49121. var existing = on[event];
  49122. var callback = data.model.callback;
  49123. if (isDef(existing)) {
  49124. if (
  49125. Array.isArray(existing)
  49126. ? existing.indexOf(callback) === -1
  49127. : existing !== callback
  49128. ) {
  49129. on[event] = [callback].concat(existing);
  49130. }
  49131. } else {
  49132. on[event] = callback;
  49133. }
  49134. }
  49135. /* */
  49136. var SIMPLE_NORMALIZE = 1;
  49137. var ALWAYS_NORMALIZE = 2;
  49138. // wrapper function for providing a more flexible interface
  49139. // without getting yelled at by flow
  49140. function createElement (
  49141. context,
  49142. tag,
  49143. data,
  49144. children,
  49145. normalizationType,
  49146. alwaysNormalize
  49147. ) {
  49148. if (Array.isArray(data) || isPrimitive(data)) {
  49149. normalizationType = children;
  49150. children = data;
  49151. data = undefined;
  49152. }
  49153. if (isTrue(alwaysNormalize)) {
  49154. normalizationType = ALWAYS_NORMALIZE;
  49155. }
  49156. return _createElement(context, tag, data, children, normalizationType)
  49157. }
  49158. function _createElement (
  49159. context,
  49160. tag,
  49161. data,
  49162. children,
  49163. normalizationType
  49164. ) {
  49165. if (isDef(data) && isDef((data).__ob__)) {
  49166. warn(
  49167. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  49168. 'Always create fresh vnode data objects in each render!',
  49169. context
  49170. );
  49171. return createEmptyVNode()
  49172. }
  49173. // object syntax in v-bind
  49174. if (isDef(data) && isDef(data.is)) {
  49175. tag = data.is;
  49176. }
  49177. if (!tag) {
  49178. // in case of component :is set to falsy value
  49179. return createEmptyVNode()
  49180. }
  49181. // warn against non-primitive key
  49182. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  49183. ) {
  49184. {
  49185. warn(
  49186. 'Avoid using non-primitive value as key, ' +
  49187. 'use string/number value instead.',
  49188. context
  49189. );
  49190. }
  49191. }
  49192. // support single function children as default scoped slot
  49193. if (Array.isArray(children) &&
  49194. typeof children[0] === 'function'
  49195. ) {
  49196. data = data || {};
  49197. data.scopedSlots = { default: children[0] };
  49198. children.length = 0;
  49199. }
  49200. if (normalizationType === ALWAYS_NORMALIZE) {
  49201. children = normalizeChildren(children);
  49202. } else if (normalizationType === SIMPLE_NORMALIZE) {
  49203. children = simpleNormalizeChildren(children);
  49204. }
  49205. var vnode, ns;
  49206. if (typeof tag === 'string') {
  49207. var Ctor;
  49208. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  49209. if (config.isReservedTag(tag)) {
  49210. // platform built-in elements
  49211. if (isDef(data) && isDef(data.nativeOn)) {
  49212. warn(
  49213. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  49214. context
  49215. );
  49216. }
  49217. vnode = new VNode(
  49218. config.parsePlatformTagName(tag), data, children,
  49219. undefined, undefined, context
  49220. );
  49221. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  49222. // component
  49223. vnode = createComponent(Ctor, data, context, children, tag);
  49224. } else {
  49225. // unknown or unlisted namespaced elements
  49226. // check at runtime because it may get assigned a namespace when its
  49227. // parent normalizes children
  49228. vnode = new VNode(
  49229. tag, data, children,
  49230. undefined, undefined, context
  49231. );
  49232. }
  49233. } else {
  49234. // direct component options / constructor
  49235. vnode = createComponent(tag, data, context, children);
  49236. }
  49237. if (Array.isArray(vnode)) {
  49238. return vnode
  49239. } else if (isDef(vnode)) {
  49240. if (isDef(ns)) { applyNS(vnode, ns); }
  49241. if (isDef(data)) { registerDeepBindings(data); }
  49242. return vnode
  49243. } else {
  49244. return createEmptyVNode()
  49245. }
  49246. }
  49247. function applyNS (vnode, ns, force) {
  49248. vnode.ns = ns;
  49249. if (vnode.tag === 'foreignObject') {
  49250. // use default namespace inside foreignObject
  49251. ns = undefined;
  49252. force = true;
  49253. }
  49254. if (isDef(vnode.children)) {
  49255. for (var i = 0, l = vnode.children.length; i < l; i++) {
  49256. var child = vnode.children[i];
  49257. if (isDef(child.tag) && (
  49258. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  49259. applyNS(child, ns, force);
  49260. }
  49261. }
  49262. }
  49263. }
  49264. // ref #5318
  49265. // necessary to ensure parent re-render when deep bindings like :style and
  49266. // :class are used on slot nodes
  49267. function registerDeepBindings (data) {
  49268. if (isObject(data.style)) {
  49269. traverse(data.style);
  49270. }
  49271. if (isObject(data.class)) {
  49272. traverse(data.class);
  49273. }
  49274. }
  49275. /* */
  49276. function initRender (vm) {
  49277. vm._vnode = null; // the root of the child tree
  49278. vm._staticTrees = null; // v-once cached trees
  49279. var options = vm.$options;
  49280. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  49281. var renderContext = parentVnode && parentVnode.context;
  49282. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  49283. vm.$scopedSlots = emptyObject;
  49284. // bind the createElement fn to this instance
  49285. // so that we get proper render context inside it.
  49286. // args order: tag, data, children, normalizationType, alwaysNormalize
  49287. // internal version is used by render functions compiled from templates
  49288. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  49289. // normalization is always applied for the public version, used in
  49290. // user-written render functions.
  49291. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  49292. // $attrs & $listeners are exposed for easier HOC creation.
  49293. // they need to be reactive so that HOCs using them are always updated
  49294. var parentData = parentVnode && parentVnode.data;
  49295. /* istanbul ignore else */
  49296. {
  49297. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  49298. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  49299. }, true);
  49300. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  49301. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  49302. }, true);
  49303. }
  49304. }
  49305. var currentRenderingInstance = null;
  49306. function renderMixin (Vue) {
  49307. // install runtime convenience helpers
  49308. installRenderHelpers(Vue.prototype);
  49309. Vue.prototype.$nextTick = function (fn) {
  49310. return nextTick(fn, this)
  49311. };
  49312. Vue.prototype._render = function () {
  49313. var vm = this;
  49314. var ref = vm.$options;
  49315. var render = ref.render;
  49316. var _parentVnode = ref._parentVnode;
  49317. if (_parentVnode) {
  49318. vm.$scopedSlots = normalizeScopedSlots(
  49319. _parentVnode.data.scopedSlots,
  49320. vm.$slots,
  49321. vm.$scopedSlots
  49322. );
  49323. }
  49324. // set parent vnode. this allows render functions to have access
  49325. // to the data on the placeholder node.
  49326. vm.$vnode = _parentVnode;
  49327. // render self
  49328. var vnode;
  49329. try {
  49330. // There's no need to maintain a stack because all render fns are called
  49331. // separately from one another. Nested component's render fns are called
  49332. // when parent component is patched.
  49333. currentRenderingInstance = vm;
  49334. vnode = render.call(vm._renderProxy, vm.$createElement);
  49335. } catch (e) {
  49336. handleError(e, vm, "render");
  49337. // return error render result,
  49338. // or previous vnode to prevent render error causing blank component
  49339. /* istanbul ignore else */
  49340. if (vm.$options.renderError) {
  49341. try {
  49342. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  49343. } catch (e) {
  49344. handleError(e, vm, "renderError");
  49345. vnode = vm._vnode;
  49346. }
  49347. } else {
  49348. vnode = vm._vnode;
  49349. }
  49350. } finally {
  49351. currentRenderingInstance = null;
  49352. }
  49353. // if the returned array contains only a single node, allow it
  49354. if (Array.isArray(vnode) && vnode.length === 1) {
  49355. vnode = vnode[0];
  49356. }
  49357. // return empty vnode in case the render function errored out
  49358. if (!(vnode instanceof VNode)) {
  49359. if (Array.isArray(vnode)) {
  49360. warn(
  49361. 'Multiple root nodes returned from render function. Render function ' +
  49362. 'should return a single root node.',
  49363. vm
  49364. );
  49365. }
  49366. vnode = createEmptyVNode();
  49367. }
  49368. // set parent
  49369. vnode.parent = _parentVnode;
  49370. return vnode
  49371. };
  49372. }
  49373. /* */
  49374. function ensureCtor (comp, base) {
  49375. if (
  49376. comp.__esModule ||
  49377. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  49378. ) {
  49379. comp = comp.default;
  49380. }
  49381. return isObject(comp)
  49382. ? base.extend(comp)
  49383. : comp
  49384. }
  49385. function createAsyncPlaceholder (
  49386. factory,
  49387. data,
  49388. context,
  49389. children,
  49390. tag
  49391. ) {
  49392. var node = createEmptyVNode();
  49393. node.asyncFactory = factory;
  49394. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  49395. return node
  49396. }
  49397. function resolveAsyncComponent (
  49398. factory,
  49399. baseCtor
  49400. ) {
  49401. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  49402. return factory.errorComp
  49403. }
  49404. if (isDef(factory.resolved)) {
  49405. return factory.resolved
  49406. }
  49407. var owner = currentRenderingInstance;
  49408. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  49409. // already pending
  49410. factory.owners.push(owner);
  49411. }
  49412. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  49413. return factory.loadingComp
  49414. }
  49415. if (owner && !isDef(factory.owners)) {
  49416. var owners = factory.owners = [owner];
  49417. var sync = true;
  49418. var timerLoading = null;
  49419. var timerTimeout = null
  49420. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  49421. var forceRender = function (renderCompleted) {
  49422. for (var i = 0, l = owners.length; i < l; i++) {
  49423. (owners[i]).$forceUpdate();
  49424. }
  49425. if (renderCompleted) {
  49426. owners.length = 0;
  49427. if (timerLoading !== null) {
  49428. clearTimeout(timerLoading);
  49429. timerLoading = null;
  49430. }
  49431. if (timerTimeout !== null) {
  49432. clearTimeout(timerTimeout);
  49433. timerTimeout = null;
  49434. }
  49435. }
  49436. };
  49437. var resolve = once(function (res) {
  49438. // cache resolved
  49439. factory.resolved = ensureCtor(res, baseCtor);
  49440. // invoke callbacks only if this is not a synchronous resolve
  49441. // (async resolves are shimmed as synchronous during SSR)
  49442. if (!sync) {
  49443. forceRender(true);
  49444. } else {
  49445. owners.length = 0;
  49446. }
  49447. });
  49448. var reject = once(function (reason) {
  49449. warn(
  49450. "Failed to resolve async component: " + (String(factory)) +
  49451. (reason ? ("\nReason: " + reason) : '')
  49452. );
  49453. if (isDef(factory.errorComp)) {
  49454. factory.error = true;
  49455. forceRender(true);
  49456. }
  49457. });
  49458. var res = factory(resolve, reject);
  49459. if (isObject(res)) {
  49460. if (isPromise(res)) {
  49461. // () => Promise
  49462. if (isUndef(factory.resolved)) {
  49463. res.then(resolve, reject);
  49464. }
  49465. } else if (isPromise(res.component)) {
  49466. res.component.then(resolve, reject);
  49467. if (isDef(res.error)) {
  49468. factory.errorComp = ensureCtor(res.error, baseCtor);
  49469. }
  49470. if (isDef(res.loading)) {
  49471. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  49472. if (res.delay === 0) {
  49473. factory.loading = true;
  49474. } else {
  49475. timerLoading = setTimeout(function () {
  49476. timerLoading = null;
  49477. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  49478. factory.loading = true;
  49479. forceRender(false);
  49480. }
  49481. }, res.delay || 200);
  49482. }
  49483. }
  49484. if (isDef(res.timeout)) {
  49485. timerTimeout = setTimeout(function () {
  49486. timerTimeout = null;
  49487. if (isUndef(factory.resolved)) {
  49488. reject(
  49489. "timeout (" + (res.timeout) + "ms)"
  49490. );
  49491. }
  49492. }, res.timeout);
  49493. }
  49494. }
  49495. }
  49496. sync = false;
  49497. // return in case resolved synchronously
  49498. return factory.loading
  49499. ? factory.loadingComp
  49500. : factory.resolved
  49501. }
  49502. }
  49503. /* */
  49504. function isAsyncPlaceholder (node) {
  49505. return node.isComment && node.asyncFactory
  49506. }
  49507. /* */
  49508. function getFirstComponentChild (children) {
  49509. if (Array.isArray(children)) {
  49510. for (var i = 0; i < children.length; i++) {
  49511. var c = children[i];
  49512. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  49513. return c
  49514. }
  49515. }
  49516. }
  49517. }
  49518. /* */
  49519. /* */
  49520. function initEvents (vm) {
  49521. vm._events = Object.create(null);
  49522. vm._hasHookEvent = false;
  49523. // init parent attached events
  49524. var listeners = vm.$options._parentListeners;
  49525. if (listeners) {
  49526. updateComponentListeners(vm, listeners);
  49527. }
  49528. }
  49529. var target;
  49530. function add (event, fn) {
  49531. target.$on(event, fn);
  49532. }
  49533. function remove$1 (event, fn) {
  49534. target.$off(event, fn);
  49535. }
  49536. function createOnceHandler (event, fn) {
  49537. var _target = target;
  49538. return function onceHandler () {
  49539. var res = fn.apply(null, arguments);
  49540. if (res !== null) {
  49541. _target.$off(event, onceHandler);
  49542. }
  49543. }
  49544. }
  49545. function updateComponentListeners (
  49546. vm,
  49547. listeners,
  49548. oldListeners
  49549. ) {
  49550. target = vm;
  49551. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  49552. target = undefined;
  49553. }
  49554. function eventsMixin (Vue) {
  49555. var hookRE = /^hook:/;
  49556. Vue.prototype.$on = function (event, fn) {
  49557. var vm = this;
  49558. if (Array.isArray(event)) {
  49559. for (var i = 0, l = event.length; i < l; i++) {
  49560. vm.$on(event[i], fn);
  49561. }
  49562. } else {
  49563. (vm._events[event] || (vm._events[event] = [])).push(fn);
  49564. // optimize hook:event cost by using a boolean flag marked at registration
  49565. // instead of a hash lookup
  49566. if (hookRE.test(event)) {
  49567. vm._hasHookEvent = true;
  49568. }
  49569. }
  49570. return vm
  49571. };
  49572. Vue.prototype.$once = function (event, fn) {
  49573. var vm = this;
  49574. function on () {
  49575. vm.$off(event, on);
  49576. fn.apply(vm, arguments);
  49577. }
  49578. on.fn = fn;
  49579. vm.$on(event, on);
  49580. return vm
  49581. };
  49582. Vue.prototype.$off = function (event, fn) {
  49583. var vm = this;
  49584. // all
  49585. if (!arguments.length) {
  49586. vm._events = Object.create(null);
  49587. return vm
  49588. }
  49589. // array of events
  49590. if (Array.isArray(event)) {
  49591. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  49592. vm.$off(event[i$1], fn);
  49593. }
  49594. return vm
  49595. }
  49596. // specific event
  49597. var cbs = vm._events[event];
  49598. if (!cbs) {
  49599. return vm
  49600. }
  49601. if (!fn) {
  49602. vm._events[event] = null;
  49603. return vm
  49604. }
  49605. // specific handler
  49606. var cb;
  49607. var i = cbs.length;
  49608. while (i--) {
  49609. cb = cbs[i];
  49610. if (cb === fn || cb.fn === fn) {
  49611. cbs.splice(i, 1);
  49612. break
  49613. }
  49614. }
  49615. return vm
  49616. };
  49617. Vue.prototype.$emit = function (event) {
  49618. var vm = this;
  49619. {
  49620. var lowerCaseEvent = event.toLowerCase();
  49621. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  49622. tip(
  49623. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  49624. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  49625. "Note that HTML attributes are case-insensitive and you cannot use " +
  49626. "v-on to listen to camelCase events when using in-DOM templates. " +
  49627. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  49628. );
  49629. }
  49630. }
  49631. var cbs = vm._events[event];
  49632. if (cbs) {
  49633. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  49634. var args = toArray(arguments, 1);
  49635. var info = "event handler for \"" + event + "\"";
  49636. for (var i = 0, l = cbs.length; i < l; i++) {
  49637. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  49638. }
  49639. }
  49640. return vm
  49641. };
  49642. }
  49643. /* */
  49644. var activeInstance = null;
  49645. var isUpdatingChildComponent = false;
  49646. function setActiveInstance(vm) {
  49647. var prevActiveInstance = activeInstance;
  49648. activeInstance = vm;
  49649. return function () {
  49650. activeInstance = prevActiveInstance;
  49651. }
  49652. }
  49653. function initLifecycle (vm) {
  49654. var options = vm.$options;
  49655. // locate first non-abstract parent
  49656. var parent = options.parent;
  49657. if (parent && !options.abstract) {
  49658. while (parent.$options.abstract && parent.$parent) {
  49659. parent = parent.$parent;
  49660. }
  49661. parent.$children.push(vm);
  49662. }
  49663. vm.$parent = parent;
  49664. vm.$root = parent ? parent.$root : vm;
  49665. vm.$children = [];
  49666. vm.$refs = {};
  49667. vm._watcher = null;
  49668. vm._inactive = null;
  49669. vm._directInactive = false;
  49670. vm._isMounted = false;
  49671. vm._isDestroyed = false;
  49672. vm._isBeingDestroyed = false;
  49673. }
  49674. function lifecycleMixin (Vue) {
  49675. Vue.prototype._update = function (vnode, hydrating) {
  49676. var vm = this;
  49677. var prevEl = vm.$el;
  49678. var prevVnode = vm._vnode;
  49679. var restoreActiveInstance = setActiveInstance(vm);
  49680. vm._vnode = vnode;
  49681. // Vue.prototype.__patch__ is injected in entry points
  49682. // based on the rendering backend used.
  49683. if (!prevVnode) {
  49684. // initial render
  49685. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  49686. } else {
  49687. // updates
  49688. vm.$el = vm.__patch__(prevVnode, vnode);
  49689. }
  49690. restoreActiveInstance();
  49691. // update __vue__ reference
  49692. if (prevEl) {
  49693. prevEl.__vue__ = null;
  49694. }
  49695. if (vm.$el) {
  49696. vm.$el.__vue__ = vm;
  49697. }
  49698. // if parent is an HOC, update its $el as well
  49699. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  49700. vm.$parent.$el = vm.$el;
  49701. }
  49702. // updated hook is called by the scheduler to ensure that children are
  49703. // updated in a parent's updated hook.
  49704. };
  49705. Vue.prototype.$forceUpdate = function () {
  49706. var vm = this;
  49707. if (vm._watcher) {
  49708. vm._watcher.update();
  49709. }
  49710. };
  49711. Vue.prototype.$destroy = function () {
  49712. var vm = this;
  49713. if (vm._isBeingDestroyed) {
  49714. return
  49715. }
  49716. callHook(vm, 'beforeDestroy');
  49717. vm._isBeingDestroyed = true;
  49718. // remove self from parent
  49719. var parent = vm.$parent;
  49720. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  49721. remove(parent.$children, vm);
  49722. }
  49723. // teardown watchers
  49724. if (vm._watcher) {
  49725. vm._watcher.teardown();
  49726. }
  49727. var i = vm._watchers.length;
  49728. while (i--) {
  49729. vm._watchers[i].teardown();
  49730. }
  49731. // remove reference from data ob
  49732. // frozen object may not have observer.
  49733. if (vm._data.__ob__) {
  49734. vm._data.__ob__.vmCount--;
  49735. }
  49736. // call the last hook...
  49737. vm._isDestroyed = true;
  49738. // invoke destroy hooks on current rendered tree
  49739. vm.__patch__(vm._vnode, null);
  49740. // fire destroyed hook
  49741. callHook(vm, 'destroyed');
  49742. // turn off all instance listeners.
  49743. vm.$off();
  49744. // remove __vue__ reference
  49745. if (vm.$el) {
  49746. vm.$el.__vue__ = null;
  49747. }
  49748. // release circular reference (#6759)
  49749. if (vm.$vnode) {
  49750. vm.$vnode.parent = null;
  49751. }
  49752. };
  49753. }
  49754. function mountComponent (
  49755. vm,
  49756. el,
  49757. hydrating
  49758. ) {
  49759. vm.$el = el;
  49760. if (!vm.$options.render) {
  49761. vm.$options.render = createEmptyVNode;
  49762. {
  49763. /* istanbul ignore if */
  49764. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  49765. vm.$options.el || el) {
  49766. warn(
  49767. 'You are using the runtime-only build of Vue where the template ' +
  49768. 'compiler is not available. Either pre-compile the templates into ' +
  49769. 'render functions, or use the compiler-included build.',
  49770. vm
  49771. );
  49772. } else {
  49773. warn(
  49774. 'Failed to mount component: template or render function not defined.',
  49775. vm
  49776. );
  49777. }
  49778. }
  49779. }
  49780. callHook(vm, 'beforeMount');
  49781. var updateComponent;
  49782. /* istanbul ignore if */
  49783. if (config.performance && mark) {
  49784. updateComponent = function () {
  49785. var name = vm._name;
  49786. var id = vm._uid;
  49787. var startTag = "vue-perf-start:" + id;
  49788. var endTag = "vue-perf-end:" + id;
  49789. mark(startTag);
  49790. var vnode = vm._render();
  49791. mark(endTag);
  49792. measure(("vue " + name + " render"), startTag, endTag);
  49793. mark(startTag);
  49794. vm._update(vnode, hydrating);
  49795. mark(endTag);
  49796. measure(("vue " + name + " patch"), startTag, endTag);
  49797. };
  49798. } else {
  49799. updateComponent = function () {
  49800. vm._update(vm._render(), hydrating);
  49801. };
  49802. }
  49803. // we set this to vm._watcher inside the watcher's constructor
  49804. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  49805. // component's mounted hook), which relies on vm._watcher being already defined
  49806. new Watcher(vm, updateComponent, noop, {
  49807. before: function before () {
  49808. if (vm._isMounted && !vm._isDestroyed) {
  49809. callHook(vm, 'beforeUpdate');
  49810. }
  49811. }
  49812. }, true /* isRenderWatcher */);
  49813. hydrating = false;
  49814. // manually mounted instance, call mounted on self
  49815. // mounted is called for render-created child components in its inserted hook
  49816. if (vm.$vnode == null) {
  49817. vm._isMounted = true;
  49818. callHook(vm, 'mounted');
  49819. }
  49820. return vm
  49821. }
  49822. function updateChildComponent (
  49823. vm,
  49824. propsData,
  49825. listeners,
  49826. parentVnode,
  49827. renderChildren
  49828. ) {
  49829. {
  49830. isUpdatingChildComponent = true;
  49831. }
  49832. // determine whether component has slot children
  49833. // we need to do this before overwriting $options._renderChildren.
  49834. // check if there are dynamic scopedSlots (hand-written or compiled but with
  49835. // dynamic slot names). Static scoped slots compiled from template has the
  49836. // "$stable" marker.
  49837. var newScopedSlots = parentVnode.data.scopedSlots;
  49838. var oldScopedSlots = vm.$scopedSlots;
  49839. var hasDynamicScopedSlot = !!(
  49840. (newScopedSlots && !newScopedSlots.$stable) ||
  49841. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  49842. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  49843. );
  49844. // Any static slot children from the parent may have changed during parent's
  49845. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  49846. // update is necessary to ensure correctness.
  49847. var needsForceUpdate = !!(
  49848. renderChildren || // has new static slots
  49849. vm.$options._renderChildren || // has old static slots
  49850. hasDynamicScopedSlot
  49851. );
  49852. vm.$options._parentVnode = parentVnode;
  49853. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  49854. if (vm._vnode) { // update child tree's parent
  49855. vm._vnode.parent = parentVnode;
  49856. }
  49857. vm.$options._renderChildren = renderChildren;
  49858. // update $attrs and $listeners hash
  49859. // these are also reactive so they may trigger child update if the child
  49860. // used them during render
  49861. vm.$attrs = parentVnode.data.attrs || emptyObject;
  49862. vm.$listeners = listeners || emptyObject;
  49863. // update props
  49864. if (propsData && vm.$options.props) {
  49865. toggleObserving(false);
  49866. var props = vm._props;
  49867. var propKeys = vm.$options._propKeys || [];
  49868. for (var i = 0; i < propKeys.length; i++) {
  49869. var key = propKeys[i];
  49870. var propOptions = vm.$options.props; // wtf flow?
  49871. props[key] = validateProp(key, propOptions, propsData, vm);
  49872. }
  49873. toggleObserving(true);
  49874. // keep a copy of raw propsData
  49875. vm.$options.propsData = propsData;
  49876. }
  49877. // update listeners
  49878. listeners = listeners || emptyObject;
  49879. var oldListeners = vm.$options._parentListeners;
  49880. vm.$options._parentListeners = listeners;
  49881. updateComponentListeners(vm, listeners, oldListeners);
  49882. // resolve slots + force update if has children
  49883. if (needsForceUpdate) {
  49884. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  49885. vm.$forceUpdate();
  49886. }
  49887. {
  49888. isUpdatingChildComponent = false;
  49889. }
  49890. }
  49891. function isInInactiveTree (vm) {
  49892. while (vm && (vm = vm.$parent)) {
  49893. if (vm._inactive) { return true }
  49894. }
  49895. return false
  49896. }
  49897. function activateChildComponent (vm, direct) {
  49898. if (direct) {
  49899. vm._directInactive = false;
  49900. if (isInInactiveTree(vm)) {
  49901. return
  49902. }
  49903. } else if (vm._directInactive) {
  49904. return
  49905. }
  49906. if (vm._inactive || vm._inactive === null) {
  49907. vm._inactive = false;
  49908. for (var i = 0; i < vm.$children.length; i++) {
  49909. activateChildComponent(vm.$children[i]);
  49910. }
  49911. callHook(vm, 'activated');
  49912. }
  49913. }
  49914. function deactivateChildComponent (vm, direct) {
  49915. if (direct) {
  49916. vm._directInactive = true;
  49917. if (isInInactiveTree(vm)) {
  49918. return
  49919. }
  49920. }
  49921. if (!vm._inactive) {
  49922. vm._inactive = true;
  49923. for (var i = 0; i < vm.$children.length; i++) {
  49924. deactivateChildComponent(vm.$children[i]);
  49925. }
  49926. callHook(vm, 'deactivated');
  49927. }
  49928. }
  49929. function callHook (vm, hook) {
  49930. // #7573 disable dep collection when invoking lifecycle hooks
  49931. pushTarget();
  49932. var handlers = vm.$options[hook];
  49933. var info = hook + " hook";
  49934. if (handlers) {
  49935. for (var i = 0, j = handlers.length; i < j; i++) {
  49936. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  49937. }
  49938. }
  49939. if (vm._hasHookEvent) {
  49940. vm.$emit('hook:' + hook);
  49941. }
  49942. popTarget();
  49943. }
  49944. /* */
  49945. var MAX_UPDATE_COUNT = 100;
  49946. var queue = [];
  49947. var activatedChildren = [];
  49948. var has = {};
  49949. var circular = {};
  49950. var waiting = false;
  49951. var flushing = false;
  49952. var index = 0;
  49953. /**
  49954. * Reset the scheduler's state.
  49955. */
  49956. function resetSchedulerState () {
  49957. index = queue.length = activatedChildren.length = 0;
  49958. has = {};
  49959. {
  49960. circular = {};
  49961. }
  49962. waiting = flushing = false;
  49963. }
  49964. // Async edge case #6566 requires saving the timestamp when event listeners are
  49965. // attached. However, calling performance.now() has a perf overhead especially
  49966. // if the page has thousands of event listeners. Instead, we take a timestamp
  49967. // every time the scheduler flushes and use that for all event listeners
  49968. // attached during that flush.
  49969. var currentFlushTimestamp = 0;
  49970. // Async edge case fix requires storing an event listener's attach timestamp.
  49971. var getNow = Date.now;
  49972. // Determine what event timestamp the browser is using. Annoyingly, the
  49973. // timestamp can either be hi-res (relative to page load) or low-res
  49974. // (relative to UNIX epoch), so in order to compare time we have to use the
  49975. // same timestamp type when saving the flush timestamp.
  49976. // All IE versions use low-res event timestamps, and have problematic clock
  49977. // implementations (#9632)
  49978. if (inBrowser && !isIE) {
  49979. var performance = window.performance;
  49980. if (
  49981. performance &&
  49982. typeof performance.now === 'function' &&
  49983. getNow() > document.createEvent('Event').timeStamp
  49984. ) {
  49985. // if the event timestamp, although evaluated AFTER the Date.now(), is
  49986. // smaller than it, it means the event is using a hi-res timestamp,
  49987. // and we need to use the hi-res version for event listener timestamps as
  49988. // well.
  49989. getNow = function () { return performance.now(); };
  49990. }
  49991. }
  49992. /**
  49993. * Flush both queues and run the watchers.
  49994. */
  49995. function flushSchedulerQueue () {
  49996. currentFlushTimestamp = getNow();
  49997. flushing = true;
  49998. var watcher, id;
  49999. // Sort queue before flush.
  50000. // This ensures that:
  50001. // 1. Components are updated from parent to child. (because parent is always
  50002. // created before the child)
  50003. // 2. A component's user watchers are run before its render watcher (because
  50004. // user watchers are created before the render watcher)
  50005. // 3. If a component is destroyed during a parent component's watcher run,
  50006. // its watchers can be skipped.
  50007. queue.sort(function (a, b) { return a.id - b.id; });
  50008. // do not cache length because more watchers might be pushed
  50009. // as we run existing watchers
  50010. for (index = 0; index < queue.length; index++) {
  50011. watcher = queue[index];
  50012. if (watcher.before) {
  50013. watcher.before();
  50014. }
  50015. id = watcher.id;
  50016. has[id] = null;
  50017. watcher.run();
  50018. // in dev build, check and stop circular updates.
  50019. if (has[id] != null) {
  50020. circular[id] = (circular[id] || 0) + 1;
  50021. if (circular[id] > MAX_UPDATE_COUNT) {
  50022. warn(
  50023. 'You may have an infinite update loop ' + (
  50024. watcher.user
  50025. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  50026. : "in a component render function."
  50027. ),
  50028. watcher.vm
  50029. );
  50030. break
  50031. }
  50032. }
  50033. }
  50034. // keep copies of post queues before resetting state
  50035. var activatedQueue = activatedChildren.slice();
  50036. var updatedQueue = queue.slice();
  50037. resetSchedulerState();
  50038. // call component updated and activated hooks
  50039. callActivatedHooks(activatedQueue);
  50040. callUpdatedHooks(updatedQueue);
  50041. // devtool hook
  50042. /* istanbul ignore if */
  50043. if (devtools && config.devtools) {
  50044. devtools.emit('flush');
  50045. }
  50046. }
  50047. function callUpdatedHooks (queue) {
  50048. var i = queue.length;
  50049. while (i--) {
  50050. var watcher = queue[i];
  50051. var vm = watcher.vm;
  50052. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  50053. callHook(vm, 'updated');
  50054. }
  50055. }
  50056. }
  50057. /**
  50058. * Queue a kept-alive component that was activated during patch.
  50059. * The queue will be processed after the entire tree has been patched.
  50060. */
  50061. function queueActivatedComponent (vm) {
  50062. // setting _inactive to false here so that a render function can
  50063. // rely on checking whether it's in an inactive tree (e.g. router-view)
  50064. vm._inactive = false;
  50065. activatedChildren.push(vm);
  50066. }
  50067. function callActivatedHooks (queue) {
  50068. for (var i = 0; i < queue.length; i++) {
  50069. queue[i]._inactive = true;
  50070. activateChildComponent(queue[i], true /* true */);
  50071. }
  50072. }
  50073. /**
  50074. * Push a watcher into the watcher queue.
  50075. * Jobs with duplicate IDs will be skipped unless it's
  50076. * pushed when the queue is being flushed.
  50077. */
  50078. function queueWatcher (watcher) {
  50079. var id = watcher.id;
  50080. if (has[id] == null) {
  50081. has[id] = true;
  50082. if (!flushing) {
  50083. queue.push(watcher);
  50084. } else {
  50085. // if already flushing, splice the watcher based on its id
  50086. // if already past its id, it will be run next immediately.
  50087. var i = queue.length - 1;
  50088. while (i > index && queue[i].id > watcher.id) {
  50089. i--;
  50090. }
  50091. queue.splice(i + 1, 0, watcher);
  50092. }
  50093. // queue the flush
  50094. if (!waiting) {
  50095. waiting = true;
  50096. if (!config.async) {
  50097. flushSchedulerQueue();
  50098. return
  50099. }
  50100. nextTick(flushSchedulerQueue);
  50101. }
  50102. }
  50103. }
  50104. /* */
  50105. var uid$2 = 0;
  50106. /**
  50107. * A watcher parses an expression, collects dependencies,
  50108. * and fires callback when the expression value changes.
  50109. * This is used for both the $watch() api and directives.
  50110. */
  50111. var Watcher = function Watcher (
  50112. vm,
  50113. expOrFn,
  50114. cb,
  50115. options,
  50116. isRenderWatcher
  50117. ) {
  50118. this.vm = vm;
  50119. if (isRenderWatcher) {
  50120. vm._watcher = this;
  50121. }
  50122. vm._watchers.push(this);
  50123. // options
  50124. if (options) {
  50125. this.deep = !!options.deep;
  50126. this.user = !!options.user;
  50127. this.lazy = !!options.lazy;
  50128. this.sync = !!options.sync;
  50129. this.before = options.before;
  50130. } else {
  50131. this.deep = this.user = this.lazy = this.sync = false;
  50132. }
  50133. this.cb = cb;
  50134. this.id = ++uid$2; // uid for batching
  50135. this.active = true;
  50136. this.dirty = this.lazy; // for lazy watchers
  50137. this.deps = [];
  50138. this.newDeps = [];
  50139. this.depIds = new _Set();
  50140. this.newDepIds = new _Set();
  50141. this.expression = expOrFn.toString();
  50142. // parse expression for getter
  50143. if (typeof expOrFn === 'function') {
  50144. this.getter = expOrFn;
  50145. } else {
  50146. this.getter = parsePath(expOrFn);
  50147. if (!this.getter) {
  50148. this.getter = noop;
  50149. warn(
  50150. "Failed watching path: \"" + expOrFn + "\" " +
  50151. 'Watcher only accepts simple dot-delimited paths. ' +
  50152. 'For full control, use a function instead.',
  50153. vm
  50154. );
  50155. }
  50156. }
  50157. this.value = this.lazy
  50158. ? undefined
  50159. : this.get();
  50160. };
  50161. /**
  50162. * Evaluate the getter, and re-collect dependencies.
  50163. */
  50164. Watcher.prototype.get = function get () {
  50165. pushTarget(this);
  50166. var value;
  50167. var vm = this.vm;
  50168. try {
  50169. value = this.getter.call(vm, vm);
  50170. } catch (e) {
  50171. if (this.user) {
  50172. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  50173. } else {
  50174. throw e
  50175. }
  50176. } finally {
  50177. // "touch" every property so they are all tracked as
  50178. // dependencies for deep watching
  50179. if (this.deep) {
  50180. traverse(value);
  50181. }
  50182. popTarget();
  50183. this.cleanupDeps();
  50184. }
  50185. return value
  50186. };
  50187. /**
  50188. * Add a dependency to this directive.
  50189. */
  50190. Watcher.prototype.addDep = function addDep (dep) {
  50191. var id = dep.id;
  50192. if (!this.newDepIds.has(id)) {
  50193. this.newDepIds.add(id);
  50194. this.newDeps.push(dep);
  50195. if (!this.depIds.has(id)) {
  50196. dep.addSub(this);
  50197. }
  50198. }
  50199. };
  50200. /**
  50201. * Clean up for dependency collection.
  50202. */
  50203. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  50204. var i = this.deps.length;
  50205. while (i--) {
  50206. var dep = this.deps[i];
  50207. if (!this.newDepIds.has(dep.id)) {
  50208. dep.removeSub(this);
  50209. }
  50210. }
  50211. var tmp = this.depIds;
  50212. this.depIds = this.newDepIds;
  50213. this.newDepIds = tmp;
  50214. this.newDepIds.clear();
  50215. tmp = this.deps;
  50216. this.deps = this.newDeps;
  50217. this.newDeps = tmp;
  50218. this.newDeps.length = 0;
  50219. };
  50220. /**
  50221. * Subscriber interface.
  50222. * Will be called when a dependency changes.
  50223. */
  50224. Watcher.prototype.update = function update () {
  50225. /* istanbul ignore else */
  50226. if (this.lazy) {
  50227. this.dirty = true;
  50228. } else if (this.sync) {
  50229. this.run();
  50230. } else {
  50231. queueWatcher(this);
  50232. }
  50233. };
  50234. /**
  50235. * Scheduler job interface.
  50236. * Will be called by the scheduler.
  50237. */
  50238. Watcher.prototype.run = function run () {
  50239. if (this.active) {
  50240. var value = this.get();
  50241. if (
  50242. value !== this.value ||
  50243. // Deep watchers and watchers on Object/Arrays should fire even
  50244. // when the value is the same, because the value may
  50245. // have mutated.
  50246. isObject(value) ||
  50247. this.deep
  50248. ) {
  50249. // set new value
  50250. var oldValue = this.value;
  50251. this.value = value;
  50252. if (this.user) {
  50253. try {
  50254. this.cb.call(this.vm, value, oldValue);
  50255. } catch (e) {
  50256. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  50257. }
  50258. } else {
  50259. this.cb.call(this.vm, value, oldValue);
  50260. }
  50261. }
  50262. }
  50263. };
  50264. /**
  50265. * Evaluate the value of the watcher.
  50266. * This only gets called for lazy watchers.
  50267. */
  50268. Watcher.prototype.evaluate = function evaluate () {
  50269. this.value = this.get();
  50270. this.dirty = false;
  50271. };
  50272. /**
  50273. * Depend on all deps collected by this watcher.
  50274. */
  50275. Watcher.prototype.depend = function depend () {
  50276. var i = this.deps.length;
  50277. while (i--) {
  50278. this.deps[i].depend();
  50279. }
  50280. };
  50281. /**
  50282. * Remove self from all dependencies' subscriber list.
  50283. */
  50284. Watcher.prototype.teardown = function teardown () {
  50285. if (this.active) {
  50286. // remove self from vm's watcher list
  50287. // this is a somewhat expensive operation so we skip it
  50288. // if the vm is being destroyed.
  50289. if (!this.vm._isBeingDestroyed) {
  50290. remove(this.vm._watchers, this);
  50291. }
  50292. var i = this.deps.length;
  50293. while (i--) {
  50294. this.deps[i].removeSub(this);
  50295. }
  50296. this.active = false;
  50297. }
  50298. };
  50299. /* */
  50300. var sharedPropertyDefinition = {
  50301. enumerable: true,
  50302. configurable: true,
  50303. get: noop,
  50304. set: noop
  50305. };
  50306. function proxy (target, sourceKey, key) {
  50307. sharedPropertyDefinition.get = function proxyGetter () {
  50308. return this[sourceKey][key]
  50309. };
  50310. sharedPropertyDefinition.set = function proxySetter (val) {
  50311. this[sourceKey][key] = val;
  50312. };
  50313. Object.defineProperty(target, key, sharedPropertyDefinition);
  50314. }
  50315. function initState (vm) {
  50316. vm._watchers = [];
  50317. var opts = vm.$options;
  50318. if (opts.props) { initProps(vm, opts.props); }
  50319. if (opts.methods) { initMethods(vm, opts.methods); }
  50320. if (opts.data) {
  50321. initData(vm);
  50322. } else {
  50323. observe(vm._data = {}, true /* asRootData */);
  50324. }
  50325. if (opts.computed) { initComputed(vm, opts.computed); }
  50326. if (opts.watch && opts.watch !== nativeWatch) {
  50327. initWatch(vm, opts.watch);
  50328. }
  50329. }
  50330. function initProps (vm, propsOptions) {
  50331. var propsData = vm.$options.propsData || {};
  50332. var props = vm._props = {};
  50333. // cache prop keys so that future props updates can iterate using Array
  50334. // instead of dynamic object key enumeration.
  50335. var keys = vm.$options._propKeys = [];
  50336. var isRoot = !vm.$parent;
  50337. // root instance props should be converted
  50338. if (!isRoot) {
  50339. toggleObserving(false);
  50340. }
  50341. var loop = function ( key ) {
  50342. keys.push(key);
  50343. var value = validateProp(key, propsOptions, propsData, vm);
  50344. /* istanbul ignore else */
  50345. {
  50346. var hyphenatedKey = hyphenate(key);
  50347. if (isReservedAttribute(hyphenatedKey) ||
  50348. config.isReservedAttr(hyphenatedKey)) {
  50349. warn(
  50350. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  50351. vm
  50352. );
  50353. }
  50354. defineReactive$$1(props, key, value, function () {
  50355. if (!isRoot && !isUpdatingChildComponent) {
  50356. warn(
  50357. "Avoid mutating a prop directly since the value will be " +
  50358. "overwritten whenever the parent component re-renders. " +
  50359. "Instead, use a data or computed property based on the prop's " +
  50360. "value. Prop being mutated: \"" + key + "\"",
  50361. vm
  50362. );
  50363. }
  50364. });
  50365. }
  50366. // static props are already proxied on the component's prototype
  50367. // during Vue.extend(). We only need to proxy props defined at
  50368. // instantiation here.
  50369. if (!(key in vm)) {
  50370. proxy(vm, "_props", key);
  50371. }
  50372. };
  50373. for (var key in propsOptions) loop( key );
  50374. toggleObserving(true);
  50375. }
  50376. function initData (vm) {
  50377. var data = vm.$options.data;
  50378. data = vm._data = typeof data === 'function'
  50379. ? getData(data, vm)
  50380. : data || {};
  50381. if (!isPlainObject(data)) {
  50382. data = {};
  50383. warn(
  50384. 'data functions should return an object:\n' +
  50385. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  50386. vm
  50387. );
  50388. }
  50389. // proxy data on instance
  50390. var keys = Object.keys(data);
  50391. var props = vm.$options.props;
  50392. var methods = vm.$options.methods;
  50393. var i = keys.length;
  50394. while (i--) {
  50395. var key = keys[i];
  50396. {
  50397. if (methods && hasOwn(methods, key)) {
  50398. warn(
  50399. ("Method \"" + key + "\" has already been defined as a data property."),
  50400. vm
  50401. );
  50402. }
  50403. }
  50404. if (props && hasOwn(props, key)) {
  50405. warn(
  50406. "The data property \"" + key + "\" is already declared as a prop. " +
  50407. "Use prop default value instead.",
  50408. vm
  50409. );
  50410. } else if (!isReserved(key)) {
  50411. proxy(vm, "_data", key);
  50412. }
  50413. }
  50414. // observe data
  50415. observe(data, true /* asRootData */);
  50416. }
  50417. function getData (data, vm) {
  50418. // #7573 disable dep collection when invoking data getters
  50419. pushTarget();
  50420. try {
  50421. return data.call(vm, vm)
  50422. } catch (e) {
  50423. handleError(e, vm, "data()");
  50424. return {}
  50425. } finally {
  50426. popTarget();
  50427. }
  50428. }
  50429. var computedWatcherOptions = { lazy: true };
  50430. function initComputed (vm, computed) {
  50431. // $flow-disable-line
  50432. var watchers = vm._computedWatchers = Object.create(null);
  50433. // computed properties are just getters during SSR
  50434. var isSSR = isServerRendering();
  50435. for (var key in computed) {
  50436. var userDef = computed[key];
  50437. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  50438. if (getter == null) {
  50439. warn(
  50440. ("Getter is missing for computed property \"" + key + "\"."),
  50441. vm
  50442. );
  50443. }
  50444. if (!isSSR) {
  50445. // create internal watcher for the computed property.
  50446. watchers[key] = new Watcher(
  50447. vm,
  50448. getter || noop,
  50449. noop,
  50450. computedWatcherOptions
  50451. );
  50452. }
  50453. // component-defined computed properties are already defined on the
  50454. // component prototype. We only need to define computed properties defined
  50455. // at instantiation here.
  50456. if (!(key in vm)) {
  50457. defineComputed(vm, key, userDef);
  50458. } else {
  50459. if (key in vm.$data) {
  50460. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  50461. } else if (vm.$options.props && key in vm.$options.props) {
  50462. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  50463. }
  50464. }
  50465. }
  50466. }
  50467. function defineComputed (
  50468. target,
  50469. key,
  50470. userDef
  50471. ) {
  50472. var shouldCache = !isServerRendering();
  50473. if (typeof userDef === 'function') {
  50474. sharedPropertyDefinition.get = shouldCache
  50475. ? createComputedGetter(key)
  50476. : createGetterInvoker(userDef);
  50477. sharedPropertyDefinition.set = noop;
  50478. } else {
  50479. sharedPropertyDefinition.get = userDef.get
  50480. ? shouldCache && userDef.cache !== false
  50481. ? createComputedGetter(key)
  50482. : createGetterInvoker(userDef.get)
  50483. : noop;
  50484. sharedPropertyDefinition.set = userDef.set || noop;
  50485. }
  50486. if (sharedPropertyDefinition.set === noop) {
  50487. sharedPropertyDefinition.set = function () {
  50488. warn(
  50489. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  50490. this
  50491. );
  50492. };
  50493. }
  50494. Object.defineProperty(target, key, sharedPropertyDefinition);
  50495. }
  50496. function createComputedGetter (key) {
  50497. return function computedGetter () {
  50498. var watcher = this._computedWatchers && this._computedWatchers[key];
  50499. if (watcher) {
  50500. if (watcher.dirty) {
  50501. watcher.evaluate();
  50502. }
  50503. if (Dep.target) {
  50504. watcher.depend();
  50505. }
  50506. return watcher.value
  50507. }
  50508. }
  50509. }
  50510. function createGetterInvoker(fn) {
  50511. return function computedGetter () {
  50512. return fn.call(this, this)
  50513. }
  50514. }
  50515. function initMethods (vm, methods) {
  50516. var props = vm.$options.props;
  50517. for (var key in methods) {
  50518. {
  50519. if (typeof methods[key] !== 'function') {
  50520. warn(
  50521. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  50522. "Did you reference the function correctly?",
  50523. vm
  50524. );
  50525. }
  50526. if (props && hasOwn(props, key)) {
  50527. warn(
  50528. ("Method \"" + key + "\" has already been defined as a prop."),
  50529. vm
  50530. );
  50531. }
  50532. if ((key in vm) && isReserved(key)) {
  50533. warn(
  50534. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  50535. "Avoid defining component methods that start with _ or $."
  50536. );
  50537. }
  50538. }
  50539. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  50540. }
  50541. }
  50542. function initWatch (vm, watch) {
  50543. for (var key in watch) {
  50544. var handler = watch[key];
  50545. if (Array.isArray(handler)) {
  50546. for (var i = 0; i < handler.length; i++) {
  50547. createWatcher(vm, key, handler[i]);
  50548. }
  50549. } else {
  50550. createWatcher(vm, key, handler);
  50551. }
  50552. }
  50553. }
  50554. function createWatcher (
  50555. vm,
  50556. expOrFn,
  50557. handler,
  50558. options
  50559. ) {
  50560. if (isPlainObject(handler)) {
  50561. options = handler;
  50562. handler = handler.handler;
  50563. }
  50564. if (typeof handler === 'string') {
  50565. handler = vm[handler];
  50566. }
  50567. return vm.$watch(expOrFn, handler, options)
  50568. }
  50569. function stateMixin (Vue) {
  50570. // flow somehow has problems with directly declared definition object
  50571. // when using Object.defineProperty, so we have to procedurally build up
  50572. // the object here.
  50573. var dataDef = {};
  50574. dataDef.get = function () { return this._data };
  50575. var propsDef = {};
  50576. propsDef.get = function () { return this._props };
  50577. {
  50578. dataDef.set = function () {
  50579. warn(
  50580. 'Avoid replacing instance root $data. ' +
  50581. 'Use nested data properties instead.',
  50582. this
  50583. );
  50584. };
  50585. propsDef.set = function () {
  50586. warn("$props is readonly.", this);
  50587. };
  50588. }
  50589. Object.defineProperty(Vue.prototype, '$data', dataDef);
  50590. Object.defineProperty(Vue.prototype, '$props', propsDef);
  50591. Vue.prototype.$set = set;
  50592. Vue.prototype.$delete = del;
  50593. Vue.prototype.$watch = function (
  50594. expOrFn,
  50595. cb,
  50596. options
  50597. ) {
  50598. var vm = this;
  50599. if (isPlainObject(cb)) {
  50600. return createWatcher(vm, expOrFn, cb, options)
  50601. }
  50602. options = options || {};
  50603. options.user = true;
  50604. var watcher = new Watcher(vm, expOrFn, cb, options);
  50605. if (options.immediate) {
  50606. try {
  50607. cb.call(vm, watcher.value);
  50608. } catch (error) {
  50609. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  50610. }
  50611. }
  50612. return function unwatchFn () {
  50613. watcher.teardown();
  50614. }
  50615. };
  50616. }
  50617. /* */
  50618. var uid$3 = 0;
  50619. function initMixin (Vue) {
  50620. Vue.prototype._init = function (options) {
  50621. var vm = this;
  50622. // a uid
  50623. vm._uid = uid$3++;
  50624. var startTag, endTag;
  50625. /* istanbul ignore if */
  50626. if (config.performance && mark) {
  50627. startTag = "vue-perf-start:" + (vm._uid);
  50628. endTag = "vue-perf-end:" + (vm._uid);
  50629. mark(startTag);
  50630. }
  50631. // a flag to avoid this being observed
  50632. vm._isVue = true;
  50633. // merge options
  50634. if (options && options._isComponent) {
  50635. // optimize internal component instantiation
  50636. // since dynamic options merging is pretty slow, and none of the
  50637. // internal component options needs special treatment.
  50638. initInternalComponent(vm, options);
  50639. } else {
  50640. vm.$options = mergeOptions(
  50641. resolveConstructorOptions(vm.constructor),
  50642. options || {},
  50643. vm
  50644. );
  50645. }
  50646. /* istanbul ignore else */
  50647. {
  50648. initProxy(vm);
  50649. }
  50650. // expose real self
  50651. vm._self = vm;
  50652. initLifecycle(vm);
  50653. initEvents(vm);
  50654. initRender(vm);
  50655. callHook(vm, 'beforeCreate');
  50656. initInjections(vm); // resolve injections before data/props
  50657. initState(vm);
  50658. initProvide(vm); // resolve provide after data/props
  50659. callHook(vm, 'created');
  50660. /* istanbul ignore if */
  50661. if (config.performance && mark) {
  50662. vm._name = formatComponentName(vm, false);
  50663. mark(endTag);
  50664. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  50665. }
  50666. if (vm.$options.el) {
  50667. vm.$mount(vm.$options.el);
  50668. }
  50669. };
  50670. }
  50671. function initInternalComponent (vm, options) {
  50672. var opts = vm.$options = Object.create(vm.constructor.options);
  50673. // doing this because it's faster than dynamic enumeration.
  50674. var parentVnode = options._parentVnode;
  50675. opts.parent = options.parent;
  50676. opts._parentVnode = parentVnode;
  50677. var vnodeComponentOptions = parentVnode.componentOptions;
  50678. opts.propsData = vnodeComponentOptions.propsData;
  50679. opts._parentListeners = vnodeComponentOptions.listeners;
  50680. opts._renderChildren = vnodeComponentOptions.children;
  50681. opts._componentTag = vnodeComponentOptions.tag;
  50682. if (options.render) {
  50683. opts.render = options.render;
  50684. opts.staticRenderFns = options.staticRenderFns;
  50685. }
  50686. }
  50687. function resolveConstructorOptions (Ctor) {
  50688. var options = Ctor.options;
  50689. if (Ctor.super) {
  50690. var superOptions = resolveConstructorOptions(Ctor.super);
  50691. var cachedSuperOptions = Ctor.superOptions;
  50692. if (superOptions !== cachedSuperOptions) {
  50693. // super option changed,
  50694. // need to resolve new options.
  50695. Ctor.superOptions = superOptions;
  50696. // check if there are any late-modified/attached options (#4976)
  50697. var modifiedOptions = resolveModifiedOptions(Ctor);
  50698. // update base extend options
  50699. if (modifiedOptions) {
  50700. extend(Ctor.extendOptions, modifiedOptions);
  50701. }
  50702. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  50703. if (options.name) {
  50704. options.components[options.name] = Ctor;
  50705. }
  50706. }
  50707. }
  50708. return options
  50709. }
  50710. function resolveModifiedOptions (Ctor) {
  50711. var modified;
  50712. var latest = Ctor.options;
  50713. var sealed = Ctor.sealedOptions;
  50714. for (var key in latest) {
  50715. if (latest[key] !== sealed[key]) {
  50716. if (!modified) { modified = {}; }
  50717. modified[key] = latest[key];
  50718. }
  50719. }
  50720. return modified
  50721. }
  50722. function Vue (options) {
  50723. if (!(this instanceof Vue)
  50724. ) {
  50725. warn('Vue is a constructor and should be called with the `new` keyword');
  50726. }
  50727. this._init(options);
  50728. }
  50729. initMixin(Vue);
  50730. stateMixin(Vue);
  50731. eventsMixin(Vue);
  50732. lifecycleMixin(Vue);
  50733. renderMixin(Vue);
  50734. /* */
  50735. function initUse (Vue) {
  50736. Vue.use = function (plugin) {
  50737. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  50738. if (installedPlugins.indexOf(plugin) > -1) {
  50739. return this
  50740. }
  50741. // additional parameters
  50742. var args = toArray(arguments, 1);
  50743. args.unshift(this);
  50744. if (typeof plugin.install === 'function') {
  50745. plugin.install.apply(plugin, args);
  50746. } else if (typeof plugin === 'function') {
  50747. plugin.apply(null, args);
  50748. }
  50749. installedPlugins.push(plugin);
  50750. return this
  50751. };
  50752. }
  50753. /* */
  50754. function initMixin$1 (Vue) {
  50755. Vue.mixin = function (mixin) {
  50756. this.options = mergeOptions(this.options, mixin);
  50757. return this
  50758. };
  50759. }
  50760. /* */
  50761. function initExtend (Vue) {
  50762. /**
  50763. * Each instance constructor, including Vue, has a unique
  50764. * cid. This enables us to create wrapped "child
  50765. * constructors" for prototypal inheritance and cache them.
  50766. */
  50767. Vue.cid = 0;
  50768. var cid = 1;
  50769. /**
  50770. * Class inheritance
  50771. */
  50772. Vue.extend = function (extendOptions) {
  50773. extendOptions = extendOptions || {};
  50774. var Super = this;
  50775. var SuperId = Super.cid;
  50776. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  50777. if (cachedCtors[SuperId]) {
  50778. return cachedCtors[SuperId]
  50779. }
  50780. var name = extendOptions.name || Super.options.name;
  50781. if (name) {
  50782. validateComponentName(name);
  50783. }
  50784. var Sub = function VueComponent (options) {
  50785. this._init(options);
  50786. };
  50787. Sub.prototype = Object.create(Super.prototype);
  50788. Sub.prototype.constructor = Sub;
  50789. Sub.cid = cid++;
  50790. Sub.options = mergeOptions(
  50791. Super.options,
  50792. extendOptions
  50793. );
  50794. Sub['super'] = Super;
  50795. // For props and computed properties, we define the proxy getters on
  50796. // the Vue instances at extension time, on the extended prototype. This
  50797. // avoids Object.defineProperty calls for each instance created.
  50798. if (Sub.options.props) {
  50799. initProps$1(Sub);
  50800. }
  50801. if (Sub.options.computed) {
  50802. initComputed$1(Sub);
  50803. }
  50804. // allow further extension/mixin/plugin usage
  50805. Sub.extend = Super.extend;
  50806. Sub.mixin = Super.mixin;
  50807. Sub.use = Super.use;
  50808. // create asset registers, so extended classes
  50809. // can have their private assets too.
  50810. ASSET_TYPES.forEach(function (type) {
  50811. Sub[type] = Super[type];
  50812. });
  50813. // enable recursive self-lookup
  50814. if (name) {
  50815. Sub.options.components[name] = Sub;
  50816. }
  50817. // keep a reference to the super options at extension time.
  50818. // later at instantiation we can check if Super's options have
  50819. // been updated.
  50820. Sub.superOptions = Super.options;
  50821. Sub.extendOptions = extendOptions;
  50822. Sub.sealedOptions = extend({}, Sub.options);
  50823. // cache constructor
  50824. cachedCtors[SuperId] = Sub;
  50825. return Sub
  50826. };
  50827. }
  50828. function initProps$1 (Comp) {
  50829. var props = Comp.options.props;
  50830. for (var key in props) {
  50831. proxy(Comp.prototype, "_props", key);
  50832. }
  50833. }
  50834. function initComputed$1 (Comp) {
  50835. var computed = Comp.options.computed;
  50836. for (var key in computed) {
  50837. defineComputed(Comp.prototype, key, computed[key]);
  50838. }
  50839. }
  50840. /* */
  50841. function initAssetRegisters (Vue) {
  50842. /**
  50843. * Create asset registration methods.
  50844. */
  50845. ASSET_TYPES.forEach(function (type) {
  50846. Vue[type] = function (
  50847. id,
  50848. definition
  50849. ) {
  50850. if (!definition) {
  50851. return this.options[type + 's'][id]
  50852. } else {
  50853. /* istanbul ignore if */
  50854. if (type === 'component') {
  50855. validateComponentName(id);
  50856. }
  50857. if (type === 'component' && isPlainObject(definition)) {
  50858. definition.name = definition.name || id;
  50859. definition = this.options._base.extend(definition);
  50860. }
  50861. if (type === 'directive' && typeof definition === 'function') {
  50862. definition = { bind: definition, update: definition };
  50863. }
  50864. this.options[type + 's'][id] = definition;
  50865. return definition
  50866. }
  50867. };
  50868. });
  50869. }
  50870. /* */
  50871. function getComponentName (opts) {
  50872. return opts && (opts.Ctor.options.name || opts.tag)
  50873. }
  50874. function matches (pattern, name) {
  50875. if (Array.isArray(pattern)) {
  50876. return pattern.indexOf(name) > -1
  50877. } else if (typeof pattern === 'string') {
  50878. return pattern.split(',').indexOf(name) > -1
  50879. } else if (isRegExp(pattern)) {
  50880. return pattern.test(name)
  50881. }
  50882. /* istanbul ignore next */
  50883. return false
  50884. }
  50885. function pruneCache (keepAliveInstance, filter) {
  50886. var cache = keepAliveInstance.cache;
  50887. var keys = keepAliveInstance.keys;
  50888. var _vnode = keepAliveInstance._vnode;
  50889. for (var key in cache) {
  50890. var cachedNode = cache[key];
  50891. if (cachedNode) {
  50892. var name = getComponentName(cachedNode.componentOptions);
  50893. if (name && !filter(name)) {
  50894. pruneCacheEntry(cache, key, keys, _vnode);
  50895. }
  50896. }
  50897. }
  50898. }
  50899. function pruneCacheEntry (
  50900. cache,
  50901. key,
  50902. keys,
  50903. current
  50904. ) {
  50905. var cached$$1 = cache[key];
  50906. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  50907. cached$$1.componentInstance.$destroy();
  50908. }
  50909. cache[key] = null;
  50910. remove(keys, key);
  50911. }
  50912. var patternTypes = [String, RegExp, Array];
  50913. var KeepAlive = {
  50914. name: 'keep-alive',
  50915. abstract: true,
  50916. props: {
  50917. include: patternTypes,
  50918. exclude: patternTypes,
  50919. max: [String, Number]
  50920. },
  50921. created: function created () {
  50922. this.cache = Object.create(null);
  50923. this.keys = [];
  50924. },
  50925. destroyed: function destroyed () {
  50926. for (var key in this.cache) {
  50927. pruneCacheEntry(this.cache, key, this.keys);
  50928. }
  50929. },
  50930. mounted: function mounted () {
  50931. var this$1 = this;
  50932. this.$watch('include', function (val) {
  50933. pruneCache(this$1, function (name) { return matches(val, name); });
  50934. });
  50935. this.$watch('exclude', function (val) {
  50936. pruneCache(this$1, function (name) { return !matches(val, name); });
  50937. });
  50938. },
  50939. render: function render () {
  50940. var slot = this.$slots.default;
  50941. var vnode = getFirstComponentChild(slot);
  50942. var componentOptions = vnode && vnode.componentOptions;
  50943. if (componentOptions) {
  50944. // check pattern
  50945. var name = getComponentName(componentOptions);
  50946. var ref = this;
  50947. var include = ref.include;
  50948. var exclude = ref.exclude;
  50949. if (
  50950. // not included
  50951. (include && (!name || !matches(include, name))) ||
  50952. // excluded
  50953. (exclude && name && matches(exclude, name))
  50954. ) {
  50955. return vnode
  50956. }
  50957. var ref$1 = this;
  50958. var cache = ref$1.cache;
  50959. var keys = ref$1.keys;
  50960. var key = vnode.key == null
  50961. // same constructor may get registered as different local components
  50962. // so cid alone is not enough (#3269)
  50963. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  50964. : vnode.key;
  50965. if (cache[key]) {
  50966. vnode.componentInstance = cache[key].componentInstance;
  50967. // make current key freshest
  50968. remove(keys, key);
  50969. keys.push(key);
  50970. } else {
  50971. cache[key] = vnode;
  50972. keys.push(key);
  50973. // prune oldest entry
  50974. if (this.max && keys.length > parseInt(this.max)) {
  50975. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  50976. }
  50977. }
  50978. vnode.data.keepAlive = true;
  50979. }
  50980. return vnode || (slot && slot[0])
  50981. }
  50982. };
  50983. var builtInComponents = {
  50984. KeepAlive: KeepAlive
  50985. };
  50986. /* */
  50987. function initGlobalAPI (Vue) {
  50988. // config
  50989. var configDef = {};
  50990. configDef.get = function () { return config; };
  50991. {
  50992. configDef.set = function () {
  50993. warn(
  50994. 'Do not replace the Vue.config object, set individual fields instead.'
  50995. );
  50996. };
  50997. }
  50998. Object.defineProperty(Vue, 'config', configDef);
  50999. // exposed util methods.
  51000. // NOTE: these are not considered part of the public API - avoid relying on
  51001. // them unless you are aware of the risk.
  51002. Vue.util = {
  51003. warn: warn,
  51004. extend: extend,
  51005. mergeOptions: mergeOptions,
  51006. defineReactive: defineReactive$$1
  51007. };
  51008. Vue.set = set;
  51009. Vue.delete = del;
  51010. Vue.nextTick = nextTick;
  51011. // 2.6 explicit observable API
  51012. Vue.observable = function (obj) {
  51013. observe(obj);
  51014. return obj
  51015. };
  51016. Vue.options = Object.create(null);
  51017. ASSET_TYPES.forEach(function (type) {
  51018. Vue.options[type + 's'] = Object.create(null);
  51019. });
  51020. // this is used to identify the "base" constructor to extend all plain-object
  51021. // components with in Weex's multi-instance scenarios.
  51022. Vue.options._base = Vue;
  51023. extend(Vue.options.components, builtInComponents);
  51024. initUse(Vue);
  51025. initMixin$1(Vue);
  51026. initExtend(Vue);
  51027. initAssetRegisters(Vue);
  51028. }
  51029. initGlobalAPI(Vue);
  51030. Object.defineProperty(Vue.prototype, '$isServer', {
  51031. get: isServerRendering
  51032. });
  51033. Object.defineProperty(Vue.prototype, '$ssrContext', {
  51034. get: function get () {
  51035. /* istanbul ignore next */
  51036. return this.$vnode && this.$vnode.ssrContext
  51037. }
  51038. });
  51039. // expose FunctionalRenderContext for ssr runtime helper installation
  51040. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  51041. value: FunctionalRenderContext
  51042. });
  51043. Vue.version = '2.6.11';
  51044. /* */
  51045. // these are reserved for web because they are directly compiled away
  51046. // during template compilation
  51047. var isReservedAttr = makeMap('style,class');
  51048. // attributes that should be using props for binding
  51049. var acceptValue = makeMap('input,textarea,option,select,progress');
  51050. var mustUseProp = function (tag, type, attr) {
  51051. return (
  51052. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  51053. (attr === 'selected' && tag === 'option') ||
  51054. (attr === 'checked' && tag === 'input') ||
  51055. (attr === 'muted' && tag === 'video')
  51056. )
  51057. };
  51058. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  51059. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  51060. var convertEnumeratedValue = function (key, value) {
  51061. return isFalsyAttrValue(value) || value === 'false'
  51062. ? 'false'
  51063. // allow arbitrary string value for contenteditable
  51064. : key === 'contenteditable' && isValidContentEditableValue(value)
  51065. ? value
  51066. : 'true'
  51067. };
  51068. var isBooleanAttr = makeMap(
  51069. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  51070. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  51071. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  51072. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  51073. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  51074. 'truespeed,typemustmatch,visible'
  51075. );
  51076. var xlinkNS = 'http://www.w3.org/1999/xlink';
  51077. var isXlink = function (name) {
  51078. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  51079. };
  51080. var getXlinkProp = function (name) {
  51081. return isXlink(name) ? name.slice(6, name.length) : ''
  51082. };
  51083. var isFalsyAttrValue = function (val) {
  51084. return val == null || val === false
  51085. };
  51086. /* */
  51087. function genClassForVnode (vnode) {
  51088. var data = vnode.data;
  51089. var parentNode = vnode;
  51090. var childNode = vnode;
  51091. while (isDef(childNode.componentInstance)) {
  51092. childNode = childNode.componentInstance._vnode;
  51093. if (childNode && childNode.data) {
  51094. data = mergeClassData(childNode.data, data);
  51095. }
  51096. }
  51097. while (isDef(parentNode = parentNode.parent)) {
  51098. if (parentNode && parentNode.data) {
  51099. data = mergeClassData(data, parentNode.data);
  51100. }
  51101. }
  51102. return renderClass(data.staticClass, data.class)
  51103. }
  51104. function mergeClassData (child, parent) {
  51105. return {
  51106. staticClass: concat(child.staticClass, parent.staticClass),
  51107. class: isDef(child.class)
  51108. ? [child.class, parent.class]
  51109. : parent.class
  51110. }
  51111. }
  51112. function renderClass (
  51113. staticClass,
  51114. dynamicClass
  51115. ) {
  51116. if (isDef(staticClass) || isDef(dynamicClass)) {
  51117. return concat(staticClass, stringifyClass(dynamicClass))
  51118. }
  51119. /* istanbul ignore next */
  51120. return ''
  51121. }
  51122. function concat (a, b) {
  51123. return a ? b ? (a + ' ' + b) : a : (b || '')
  51124. }
  51125. function stringifyClass (value) {
  51126. if (Array.isArray(value)) {
  51127. return stringifyArray(value)
  51128. }
  51129. if (isObject(value)) {
  51130. return stringifyObject(value)
  51131. }
  51132. if (typeof value === 'string') {
  51133. return value
  51134. }
  51135. /* istanbul ignore next */
  51136. return ''
  51137. }
  51138. function stringifyArray (value) {
  51139. var res = '';
  51140. var stringified;
  51141. for (var i = 0, l = value.length; i < l; i++) {
  51142. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  51143. if (res) { res += ' '; }
  51144. res += stringified;
  51145. }
  51146. }
  51147. return res
  51148. }
  51149. function stringifyObject (value) {
  51150. var res = '';
  51151. for (var key in value) {
  51152. if (value[key]) {
  51153. if (res) { res += ' '; }
  51154. res += key;
  51155. }
  51156. }
  51157. return res
  51158. }
  51159. /* */
  51160. var namespaceMap = {
  51161. svg: 'http://www.w3.org/2000/svg',
  51162. math: 'http://www.w3.org/1998/Math/MathML'
  51163. };
  51164. var isHTMLTag = makeMap(
  51165. 'html,body,base,head,link,meta,style,title,' +
  51166. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  51167. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  51168. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  51169. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  51170. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  51171. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  51172. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  51173. 'output,progress,select,textarea,' +
  51174. 'details,dialog,menu,menuitem,summary,' +
  51175. 'content,element,shadow,template,blockquote,iframe,tfoot'
  51176. );
  51177. // this map is intentionally selective, only covering SVG elements that may
  51178. // contain child elements.
  51179. var isSVG = makeMap(
  51180. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  51181. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  51182. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  51183. true
  51184. );
  51185. var isPreTag = function (tag) { return tag === 'pre'; };
  51186. var isReservedTag = function (tag) {
  51187. return isHTMLTag(tag) || isSVG(tag)
  51188. };
  51189. function getTagNamespace (tag) {
  51190. if (isSVG(tag)) {
  51191. return 'svg'
  51192. }
  51193. // basic support for MathML
  51194. // note it doesn't support other MathML elements being component roots
  51195. if (tag === 'math') {
  51196. return 'math'
  51197. }
  51198. }
  51199. var unknownElementCache = Object.create(null);
  51200. function isUnknownElement (tag) {
  51201. /* istanbul ignore if */
  51202. if (!inBrowser) {
  51203. return true
  51204. }
  51205. if (isReservedTag(tag)) {
  51206. return false
  51207. }
  51208. tag = tag.toLowerCase();
  51209. /* istanbul ignore if */
  51210. if (unknownElementCache[tag] != null) {
  51211. return unknownElementCache[tag]
  51212. }
  51213. var el = document.createElement(tag);
  51214. if (tag.indexOf('-') > -1) {
  51215. // http://stackoverflow.com/a/28210364/1070244
  51216. return (unknownElementCache[tag] = (
  51217. el.constructor === window.HTMLUnknownElement ||
  51218. el.constructor === window.HTMLElement
  51219. ))
  51220. } else {
  51221. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  51222. }
  51223. }
  51224. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  51225. /* */
  51226. /**
  51227. * Query an element selector if it's not an element already.
  51228. */
  51229. function query (el) {
  51230. if (typeof el === 'string') {
  51231. var selected = document.querySelector(el);
  51232. if (!selected) {
  51233. warn(
  51234. 'Cannot find element: ' + el
  51235. );
  51236. return document.createElement('div')
  51237. }
  51238. return selected
  51239. } else {
  51240. return el
  51241. }
  51242. }
  51243. /* */
  51244. function createElement$1 (tagName, vnode) {
  51245. var elm = document.createElement(tagName);
  51246. if (tagName !== 'select') {
  51247. return elm
  51248. }
  51249. // false or null will remove the attribute but undefined will not
  51250. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  51251. elm.setAttribute('multiple', 'multiple');
  51252. }
  51253. return elm
  51254. }
  51255. function createElementNS (namespace, tagName) {
  51256. return document.createElementNS(namespaceMap[namespace], tagName)
  51257. }
  51258. function createTextNode (text) {
  51259. return document.createTextNode(text)
  51260. }
  51261. function createComment (text) {
  51262. return document.createComment(text)
  51263. }
  51264. function insertBefore (parentNode, newNode, referenceNode) {
  51265. parentNode.insertBefore(newNode, referenceNode);
  51266. }
  51267. function removeChild (node, child) {
  51268. node.removeChild(child);
  51269. }
  51270. function appendChild (node, child) {
  51271. node.appendChild(child);
  51272. }
  51273. function parentNode (node) {
  51274. return node.parentNode
  51275. }
  51276. function nextSibling (node) {
  51277. return node.nextSibling
  51278. }
  51279. function tagName (node) {
  51280. return node.tagName
  51281. }
  51282. function setTextContent (node, text) {
  51283. node.textContent = text;
  51284. }
  51285. function setStyleScope (node, scopeId) {
  51286. node.setAttribute(scopeId, '');
  51287. }
  51288. var nodeOps = /*#__PURE__*/Object.freeze({
  51289. createElement: createElement$1,
  51290. createElementNS: createElementNS,
  51291. createTextNode: createTextNode,
  51292. createComment: createComment,
  51293. insertBefore: insertBefore,
  51294. removeChild: removeChild,
  51295. appendChild: appendChild,
  51296. parentNode: parentNode,
  51297. nextSibling: nextSibling,
  51298. tagName: tagName,
  51299. setTextContent: setTextContent,
  51300. setStyleScope: setStyleScope
  51301. });
  51302. /* */
  51303. var ref = {
  51304. create: function create (_, vnode) {
  51305. registerRef(vnode);
  51306. },
  51307. update: function update (oldVnode, vnode) {
  51308. if (oldVnode.data.ref !== vnode.data.ref) {
  51309. registerRef(oldVnode, true);
  51310. registerRef(vnode);
  51311. }
  51312. },
  51313. destroy: function destroy (vnode) {
  51314. registerRef(vnode, true);
  51315. }
  51316. };
  51317. function registerRef (vnode, isRemoval) {
  51318. var key = vnode.data.ref;
  51319. if (!isDef(key)) { return }
  51320. var vm = vnode.context;
  51321. var ref = vnode.componentInstance || vnode.elm;
  51322. var refs = vm.$refs;
  51323. if (isRemoval) {
  51324. if (Array.isArray(refs[key])) {
  51325. remove(refs[key], ref);
  51326. } else if (refs[key] === ref) {
  51327. refs[key] = undefined;
  51328. }
  51329. } else {
  51330. if (vnode.data.refInFor) {
  51331. if (!Array.isArray(refs[key])) {
  51332. refs[key] = [ref];
  51333. } else if (refs[key].indexOf(ref) < 0) {
  51334. // $flow-disable-line
  51335. refs[key].push(ref);
  51336. }
  51337. } else {
  51338. refs[key] = ref;
  51339. }
  51340. }
  51341. }
  51342. /**
  51343. * Virtual DOM patching algorithm based on Snabbdom by
  51344. * Simon Friis Vindum (@paldepind)
  51345. * Licensed under the MIT License
  51346. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  51347. *
  51348. * modified by Evan You (@yyx990803)
  51349. *
  51350. * Not type-checking this because this file is perf-critical and the cost
  51351. * of making flow understand it is not worth it.
  51352. */
  51353. var emptyNode = new VNode('', {}, []);
  51354. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  51355. function sameVnode (a, b) {
  51356. return (
  51357. a.key === b.key && (
  51358. (
  51359. a.tag === b.tag &&
  51360. a.isComment === b.isComment &&
  51361. isDef(a.data) === isDef(b.data) &&
  51362. sameInputType(a, b)
  51363. ) || (
  51364. isTrue(a.isAsyncPlaceholder) &&
  51365. a.asyncFactory === b.asyncFactory &&
  51366. isUndef(b.asyncFactory.error)
  51367. )
  51368. )
  51369. )
  51370. }
  51371. function sameInputType (a, b) {
  51372. if (a.tag !== 'input') { return true }
  51373. var i;
  51374. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  51375. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  51376. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  51377. }
  51378. function createKeyToOldIdx (children, beginIdx, endIdx) {
  51379. var i, key;
  51380. var map = {};
  51381. for (i = beginIdx; i <= endIdx; ++i) {
  51382. key = children[i].key;
  51383. if (isDef(key)) { map[key] = i; }
  51384. }
  51385. return map
  51386. }
  51387. function createPatchFunction (backend) {
  51388. var i, j;
  51389. var cbs = {};
  51390. var modules = backend.modules;
  51391. var nodeOps = backend.nodeOps;
  51392. for (i = 0; i < hooks.length; ++i) {
  51393. cbs[hooks[i]] = [];
  51394. for (j = 0; j < modules.length; ++j) {
  51395. if (isDef(modules[j][hooks[i]])) {
  51396. cbs[hooks[i]].push(modules[j][hooks[i]]);
  51397. }
  51398. }
  51399. }
  51400. function emptyNodeAt (elm) {
  51401. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  51402. }
  51403. function createRmCb (childElm, listeners) {
  51404. function remove$$1 () {
  51405. if (--remove$$1.listeners === 0) {
  51406. removeNode(childElm);
  51407. }
  51408. }
  51409. remove$$1.listeners = listeners;
  51410. return remove$$1
  51411. }
  51412. function removeNode (el) {
  51413. var parent = nodeOps.parentNode(el);
  51414. // element may have already been removed due to v-html / v-text
  51415. if (isDef(parent)) {
  51416. nodeOps.removeChild(parent, el);
  51417. }
  51418. }
  51419. function isUnknownElement$$1 (vnode, inVPre) {
  51420. return (
  51421. !inVPre &&
  51422. !vnode.ns &&
  51423. !(
  51424. config.ignoredElements.length &&
  51425. config.ignoredElements.some(function (ignore) {
  51426. return isRegExp(ignore)
  51427. ? ignore.test(vnode.tag)
  51428. : ignore === vnode.tag
  51429. })
  51430. ) &&
  51431. config.isUnknownElement(vnode.tag)
  51432. )
  51433. }
  51434. var creatingElmInVPre = 0;
  51435. function createElm (
  51436. vnode,
  51437. insertedVnodeQueue,
  51438. parentElm,
  51439. refElm,
  51440. nested,
  51441. ownerArray,
  51442. index
  51443. ) {
  51444. if (isDef(vnode.elm) && isDef(ownerArray)) {
  51445. // This vnode was used in a previous render!
  51446. // now it's used as a new node, overwriting its elm would cause
  51447. // potential patch errors down the road when it's used as an insertion
  51448. // reference node. Instead, we clone the node on-demand before creating
  51449. // associated DOM element for it.
  51450. vnode = ownerArray[index] = cloneVNode(vnode);
  51451. }
  51452. vnode.isRootInsert = !nested; // for transition enter check
  51453. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  51454. return
  51455. }
  51456. var data = vnode.data;
  51457. var children = vnode.children;
  51458. var tag = vnode.tag;
  51459. if (isDef(tag)) {
  51460. {
  51461. if (data && data.pre) {
  51462. creatingElmInVPre++;
  51463. }
  51464. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  51465. warn(
  51466. 'Unknown custom element: <' + tag + '> - did you ' +
  51467. 'register the component correctly? For recursive components, ' +
  51468. 'make sure to provide the "name" option.',
  51469. vnode.context
  51470. );
  51471. }
  51472. }
  51473. vnode.elm = vnode.ns
  51474. ? nodeOps.createElementNS(vnode.ns, tag)
  51475. : nodeOps.createElement(tag, vnode);
  51476. setScope(vnode);
  51477. /* istanbul ignore if */
  51478. {
  51479. createChildren(vnode, children, insertedVnodeQueue);
  51480. if (isDef(data)) {
  51481. invokeCreateHooks(vnode, insertedVnodeQueue);
  51482. }
  51483. insert(parentElm, vnode.elm, refElm);
  51484. }
  51485. if (data && data.pre) {
  51486. creatingElmInVPre--;
  51487. }
  51488. } else if (isTrue(vnode.isComment)) {
  51489. vnode.elm = nodeOps.createComment(vnode.text);
  51490. insert(parentElm, vnode.elm, refElm);
  51491. } else {
  51492. vnode.elm = nodeOps.createTextNode(vnode.text);
  51493. insert(parentElm, vnode.elm, refElm);
  51494. }
  51495. }
  51496. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  51497. var i = vnode.data;
  51498. if (isDef(i)) {
  51499. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  51500. if (isDef(i = i.hook) && isDef(i = i.init)) {
  51501. i(vnode, false /* hydrating */);
  51502. }
  51503. // after calling the init hook, if the vnode is a child component
  51504. // it should've created a child instance and mounted it. the child
  51505. // component also has set the placeholder vnode's elm.
  51506. // in that case we can just return the element and be done.
  51507. if (isDef(vnode.componentInstance)) {
  51508. initComponent(vnode, insertedVnodeQueue);
  51509. insert(parentElm, vnode.elm, refElm);
  51510. if (isTrue(isReactivated)) {
  51511. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  51512. }
  51513. return true
  51514. }
  51515. }
  51516. }
  51517. function initComponent (vnode, insertedVnodeQueue) {
  51518. if (isDef(vnode.data.pendingInsert)) {
  51519. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  51520. vnode.data.pendingInsert = null;
  51521. }
  51522. vnode.elm = vnode.componentInstance.$el;
  51523. if (isPatchable(vnode)) {
  51524. invokeCreateHooks(vnode, insertedVnodeQueue);
  51525. setScope(vnode);
  51526. } else {
  51527. // empty component root.
  51528. // skip all element-related modules except for ref (#3455)
  51529. registerRef(vnode);
  51530. // make sure to invoke the insert hook
  51531. insertedVnodeQueue.push(vnode);
  51532. }
  51533. }
  51534. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  51535. var i;
  51536. // hack for #4339: a reactivated component with inner transition
  51537. // does not trigger because the inner node's created hooks are not called
  51538. // again. It's not ideal to involve module-specific logic in here but
  51539. // there doesn't seem to be a better way to do it.
  51540. var innerNode = vnode;
  51541. while (innerNode.componentInstance) {
  51542. innerNode = innerNode.componentInstance._vnode;
  51543. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  51544. for (i = 0; i < cbs.activate.length; ++i) {
  51545. cbs.activate[i](emptyNode, innerNode);
  51546. }
  51547. insertedVnodeQueue.push(innerNode);
  51548. break
  51549. }
  51550. }
  51551. // unlike a newly created component,
  51552. // a reactivated keep-alive component doesn't insert itself
  51553. insert(parentElm, vnode.elm, refElm);
  51554. }
  51555. function insert (parent, elm, ref$$1) {
  51556. if (isDef(parent)) {
  51557. if (isDef(ref$$1)) {
  51558. if (nodeOps.parentNode(ref$$1) === parent) {
  51559. nodeOps.insertBefore(parent, elm, ref$$1);
  51560. }
  51561. } else {
  51562. nodeOps.appendChild(parent, elm);
  51563. }
  51564. }
  51565. }
  51566. function createChildren (vnode, children, insertedVnodeQueue) {
  51567. if (Array.isArray(children)) {
  51568. {
  51569. checkDuplicateKeys(children);
  51570. }
  51571. for (var i = 0; i < children.length; ++i) {
  51572. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  51573. }
  51574. } else if (isPrimitive(vnode.text)) {
  51575. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  51576. }
  51577. }
  51578. function isPatchable (vnode) {
  51579. while (vnode.componentInstance) {
  51580. vnode = vnode.componentInstance._vnode;
  51581. }
  51582. return isDef(vnode.tag)
  51583. }
  51584. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  51585. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  51586. cbs.create[i$1](emptyNode, vnode);
  51587. }
  51588. i = vnode.data.hook; // Reuse variable
  51589. if (isDef(i)) {
  51590. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  51591. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  51592. }
  51593. }
  51594. // set scope id attribute for scoped CSS.
  51595. // this is implemented as a special case to avoid the overhead
  51596. // of going through the normal attribute patching process.
  51597. function setScope (vnode) {
  51598. var i;
  51599. if (isDef(i = vnode.fnScopeId)) {
  51600. nodeOps.setStyleScope(vnode.elm, i);
  51601. } else {
  51602. var ancestor = vnode;
  51603. while (ancestor) {
  51604. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  51605. nodeOps.setStyleScope(vnode.elm, i);
  51606. }
  51607. ancestor = ancestor.parent;
  51608. }
  51609. }
  51610. // for slot content they should also get the scopeId from the host instance.
  51611. if (isDef(i = activeInstance) &&
  51612. i !== vnode.context &&
  51613. i !== vnode.fnContext &&
  51614. isDef(i = i.$options._scopeId)
  51615. ) {
  51616. nodeOps.setStyleScope(vnode.elm, i);
  51617. }
  51618. }
  51619. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  51620. for (; startIdx <= endIdx; ++startIdx) {
  51621. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  51622. }
  51623. }
  51624. function invokeDestroyHook (vnode) {
  51625. var i, j;
  51626. var data = vnode.data;
  51627. if (isDef(data)) {
  51628. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  51629. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  51630. }
  51631. if (isDef(i = vnode.children)) {
  51632. for (j = 0; j < vnode.children.length; ++j) {
  51633. invokeDestroyHook(vnode.children[j]);
  51634. }
  51635. }
  51636. }
  51637. function removeVnodes (vnodes, startIdx, endIdx) {
  51638. for (; startIdx <= endIdx; ++startIdx) {
  51639. var ch = vnodes[startIdx];
  51640. if (isDef(ch)) {
  51641. if (isDef(ch.tag)) {
  51642. removeAndInvokeRemoveHook(ch);
  51643. invokeDestroyHook(ch);
  51644. } else { // Text node
  51645. removeNode(ch.elm);
  51646. }
  51647. }
  51648. }
  51649. }
  51650. function removeAndInvokeRemoveHook (vnode, rm) {
  51651. if (isDef(rm) || isDef(vnode.data)) {
  51652. var i;
  51653. var listeners = cbs.remove.length + 1;
  51654. if (isDef(rm)) {
  51655. // we have a recursively passed down rm callback
  51656. // increase the listeners count
  51657. rm.listeners += listeners;
  51658. } else {
  51659. // directly removing
  51660. rm = createRmCb(vnode.elm, listeners);
  51661. }
  51662. // recursively invoke hooks on child component root node
  51663. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  51664. removeAndInvokeRemoveHook(i, rm);
  51665. }
  51666. for (i = 0; i < cbs.remove.length; ++i) {
  51667. cbs.remove[i](vnode, rm);
  51668. }
  51669. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  51670. i(vnode, rm);
  51671. } else {
  51672. rm();
  51673. }
  51674. } else {
  51675. removeNode(vnode.elm);
  51676. }
  51677. }
  51678. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  51679. var oldStartIdx = 0;
  51680. var newStartIdx = 0;
  51681. var oldEndIdx = oldCh.length - 1;
  51682. var oldStartVnode = oldCh[0];
  51683. var oldEndVnode = oldCh[oldEndIdx];
  51684. var newEndIdx = newCh.length - 1;
  51685. var newStartVnode = newCh[0];
  51686. var newEndVnode = newCh[newEndIdx];
  51687. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  51688. // removeOnly is a special flag used only by <transition-group>
  51689. // to ensure removed elements stay in correct relative positions
  51690. // during leaving transitions
  51691. var canMove = !removeOnly;
  51692. {
  51693. checkDuplicateKeys(newCh);
  51694. }
  51695. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  51696. if (isUndef(oldStartVnode)) {
  51697. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  51698. } else if (isUndef(oldEndVnode)) {
  51699. oldEndVnode = oldCh[--oldEndIdx];
  51700. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  51701. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  51702. oldStartVnode = oldCh[++oldStartIdx];
  51703. newStartVnode = newCh[++newStartIdx];
  51704. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  51705. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  51706. oldEndVnode = oldCh[--oldEndIdx];
  51707. newEndVnode = newCh[--newEndIdx];
  51708. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  51709. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  51710. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  51711. oldStartVnode = oldCh[++oldStartIdx];
  51712. newEndVnode = newCh[--newEndIdx];
  51713. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  51714. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  51715. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  51716. oldEndVnode = oldCh[--oldEndIdx];
  51717. newStartVnode = newCh[++newStartIdx];
  51718. } else {
  51719. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  51720. idxInOld = isDef(newStartVnode.key)
  51721. ? oldKeyToIdx[newStartVnode.key]
  51722. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  51723. if (isUndef(idxInOld)) { // New element
  51724. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  51725. } else {
  51726. vnodeToMove = oldCh[idxInOld];
  51727. if (sameVnode(vnodeToMove, newStartVnode)) {
  51728. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  51729. oldCh[idxInOld] = undefined;
  51730. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  51731. } else {
  51732. // same key but different element. treat as new element
  51733. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  51734. }
  51735. }
  51736. newStartVnode = newCh[++newStartIdx];
  51737. }
  51738. }
  51739. if (oldStartIdx > oldEndIdx) {
  51740. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  51741. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  51742. } else if (newStartIdx > newEndIdx) {
  51743. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  51744. }
  51745. }
  51746. function checkDuplicateKeys (children) {
  51747. var seenKeys = {};
  51748. for (var i = 0; i < children.length; i++) {
  51749. var vnode = children[i];
  51750. var key = vnode.key;
  51751. if (isDef(key)) {
  51752. if (seenKeys[key]) {
  51753. warn(
  51754. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  51755. vnode.context
  51756. );
  51757. } else {
  51758. seenKeys[key] = true;
  51759. }
  51760. }
  51761. }
  51762. }
  51763. function findIdxInOld (node, oldCh, start, end) {
  51764. for (var i = start; i < end; i++) {
  51765. var c = oldCh[i];
  51766. if (isDef(c) && sameVnode(node, c)) { return i }
  51767. }
  51768. }
  51769. function patchVnode (
  51770. oldVnode,
  51771. vnode,
  51772. insertedVnodeQueue,
  51773. ownerArray,
  51774. index,
  51775. removeOnly
  51776. ) {
  51777. if (oldVnode === vnode) {
  51778. return
  51779. }
  51780. if (isDef(vnode.elm) && isDef(ownerArray)) {
  51781. // clone reused vnode
  51782. vnode = ownerArray[index] = cloneVNode(vnode);
  51783. }
  51784. var elm = vnode.elm = oldVnode.elm;
  51785. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  51786. if (isDef(vnode.asyncFactory.resolved)) {
  51787. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  51788. } else {
  51789. vnode.isAsyncPlaceholder = true;
  51790. }
  51791. return
  51792. }
  51793. // reuse element for static trees.
  51794. // note we only do this if the vnode is cloned -
  51795. // if the new node is not cloned it means the render functions have been
  51796. // reset by the hot-reload-api and we need to do a proper re-render.
  51797. if (isTrue(vnode.isStatic) &&
  51798. isTrue(oldVnode.isStatic) &&
  51799. vnode.key === oldVnode.key &&
  51800. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  51801. ) {
  51802. vnode.componentInstance = oldVnode.componentInstance;
  51803. return
  51804. }
  51805. var i;
  51806. var data = vnode.data;
  51807. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  51808. i(oldVnode, vnode);
  51809. }
  51810. var oldCh = oldVnode.children;
  51811. var ch = vnode.children;
  51812. if (isDef(data) && isPatchable(vnode)) {
  51813. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  51814. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  51815. }
  51816. if (isUndef(vnode.text)) {
  51817. if (isDef(oldCh) && isDef(ch)) {
  51818. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  51819. } else if (isDef(ch)) {
  51820. {
  51821. checkDuplicateKeys(ch);
  51822. }
  51823. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  51824. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  51825. } else if (isDef(oldCh)) {
  51826. removeVnodes(oldCh, 0, oldCh.length - 1);
  51827. } else if (isDef(oldVnode.text)) {
  51828. nodeOps.setTextContent(elm, '');
  51829. }
  51830. } else if (oldVnode.text !== vnode.text) {
  51831. nodeOps.setTextContent(elm, vnode.text);
  51832. }
  51833. if (isDef(data)) {
  51834. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  51835. }
  51836. }
  51837. function invokeInsertHook (vnode, queue, initial) {
  51838. // delay insert hooks for component root nodes, invoke them after the
  51839. // element is really inserted
  51840. if (isTrue(initial) && isDef(vnode.parent)) {
  51841. vnode.parent.data.pendingInsert = queue;
  51842. } else {
  51843. for (var i = 0; i < queue.length; ++i) {
  51844. queue[i].data.hook.insert(queue[i]);
  51845. }
  51846. }
  51847. }
  51848. var hydrationBailed = false;
  51849. // list of modules that can skip create hook during hydration because they
  51850. // are already rendered on the client or has no need for initialization
  51851. // Note: style is excluded because it relies on initial clone for future
  51852. // deep updates (#7063).
  51853. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  51854. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  51855. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  51856. var i;
  51857. var tag = vnode.tag;
  51858. var data = vnode.data;
  51859. var children = vnode.children;
  51860. inVPre = inVPre || (data && data.pre);
  51861. vnode.elm = elm;
  51862. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  51863. vnode.isAsyncPlaceholder = true;
  51864. return true
  51865. }
  51866. // assert node match
  51867. {
  51868. if (!assertNodeMatch(elm, vnode, inVPre)) {
  51869. return false
  51870. }
  51871. }
  51872. if (isDef(data)) {
  51873. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  51874. if (isDef(i = vnode.componentInstance)) {
  51875. // child component. it should have hydrated its own tree.
  51876. initComponent(vnode, insertedVnodeQueue);
  51877. return true
  51878. }
  51879. }
  51880. if (isDef(tag)) {
  51881. if (isDef(children)) {
  51882. // empty element, allow client to pick up and populate children
  51883. if (!elm.hasChildNodes()) {
  51884. createChildren(vnode, children, insertedVnodeQueue);
  51885. } else {
  51886. // v-html and domProps: innerHTML
  51887. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  51888. if (i !== elm.innerHTML) {
  51889. /* istanbul ignore if */
  51890. if (typeof console !== 'undefined' &&
  51891. !hydrationBailed
  51892. ) {
  51893. hydrationBailed = true;
  51894. console.warn('Parent: ', elm);
  51895. console.warn('server innerHTML: ', i);
  51896. console.warn('client innerHTML: ', elm.innerHTML);
  51897. }
  51898. return false
  51899. }
  51900. } else {
  51901. // iterate and compare children lists
  51902. var childrenMatch = true;
  51903. var childNode = elm.firstChild;
  51904. for (var i$1 = 0; i$1 < children.length; i$1++) {
  51905. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  51906. childrenMatch = false;
  51907. break
  51908. }
  51909. childNode = childNode.nextSibling;
  51910. }
  51911. // if childNode is not null, it means the actual childNodes list is
  51912. // longer than the virtual children list.
  51913. if (!childrenMatch || childNode) {
  51914. /* istanbul ignore if */
  51915. if (typeof console !== 'undefined' &&
  51916. !hydrationBailed
  51917. ) {
  51918. hydrationBailed = true;
  51919. console.warn('Parent: ', elm);
  51920. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  51921. }
  51922. return false
  51923. }
  51924. }
  51925. }
  51926. }
  51927. if (isDef(data)) {
  51928. var fullInvoke = false;
  51929. for (var key in data) {
  51930. if (!isRenderedModule(key)) {
  51931. fullInvoke = true;
  51932. invokeCreateHooks(vnode, insertedVnodeQueue);
  51933. break
  51934. }
  51935. }
  51936. if (!fullInvoke && data['class']) {
  51937. // ensure collecting deps for deep class bindings for future updates
  51938. traverse(data['class']);
  51939. }
  51940. }
  51941. } else if (elm.data !== vnode.text) {
  51942. elm.data = vnode.text;
  51943. }
  51944. return true
  51945. }
  51946. function assertNodeMatch (node, vnode, inVPre) {
  51947. if (isDef(vnode.tag)) {
  51948. return vnode.tag.indexOf('vue-component') === 0 || (
  51949. !isUnknownElement$$1(vnode, inVPre) &&
  51950. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  51951. )
  51952. } else {
  51953. return node.nodeType === (vnode.isComment ? 8 : 3)
  51954. }
  51955. }
  51956. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  51957. if (isUndef(vnode)) {
  51958. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  51959. return
  51960. }
  51961. var isInitialPatch = false;
  51962. var insertedVnodeQueue = [];
  51963. if (isUndef(oldVnode)) {
  51964. // empty mount (likely as component), create new root element
  51965. isInitialPatch = true;
  51966. createElm(vnode, insertedVnodeQueue);
  51967. } else {
  51968. var isRealElement = isDef(oldVnode.nodeType);
  51969. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  51970. // patch existing root node
  51971. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  51972. } else {
  51973. if (isRealElement) {
  51974. // mounting to a real element
  51975. // check if this is server-rendered content and if we can perform
  51976. // a successful hydration.
  51977. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  51978. oldVnode.removeAttribute(SSR_ATTR);
  51979. hydrating = true;
  51980. }
  51981. if (isTrue(hydrating)) {
  51982. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  51983. invokeInsertHook(vnode, insertedVnodeQueue, true);
  51984. return oldVnode
  51985. } else {
  51986. warn(
  51987. 'The client-side rendered virtual DOM tree is not matching ' +
  51988. 'server-rendered content. This is likely caused by incorrect ' +
  51989. 'HTML markup, for example nesting block-level elements inside ' +
  51990. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  51991. 'full client-side render.'
  51992. );
  51993. }
  51994. }
  51995. // either not server-rendered, or hydration failed.
  51996. // create an empty node and replace it
  51997. oldVnode = emptyNodeAt(oldVnode);
  51998. }
  51999. // replacing existing element
  52000. var oldElm = oldVnode.elm;
  52001. var parentElm = nodeOps.parentNode(oldElm);
  52002. // create new node
  52003. createElm(
  52004. vnode,
  52005. insertedVnodeQueue,
  52006. // extremely rare edge case: do not insert if old element is in a
  52007. // leaving transition. Only happens when combining transition +
  52008. // keep-alive + HOCs. (#4590)
  52009. oldElm._leaveCb ? null : parentElm,
  52010. nodeOps.nextSibling(oldElm)
  52011. );
  52012. // update parent placeholder node element, recursively
  52013. if (isDef(vnode.parent)) {
  52014. var ancestor = vnode.parent;
  52015. var patchable = isPatchable(vnode);
  52016. while (ancestor) {
  52017. for (var i = 0; i < cbs.destroy.length; ++i) {
  52018. cbs.destroy[i](ancestor);
  52019. }
  52020. ancestor.elm = vnode.elm;
  52021. if (patchable) {
  52022. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  52023. cbs.create[i$1](emptyNode, ancestor);
  52024. }
  52025. // #6513
  52026. // invoke insert hooks that may have been merged by create hooks.
  52027. // e.g. for directives that uses the "inserted" hook.
  52028. var insert = ancestor.data.hook.insert;
  52029. if (insert.merged) {
  52030. // start at index 1 to avoid re-invoking component mounted hook
  52031. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  52032. insert.fns[i$2]();
  52033. }
  52034. }
  52035. } else {
  52036. registerRef(ancestor);
  52037. }
  52038. ancestor = ancestor.parent;
  52039. }
  52040. }
  52041. // destroy old node
  52042. if (isDef(parentElm)) {
  52043. removeVnodes([oldVnode], 0, 0);
  52044. } else if (isDef(oldVnode.tag)) {
  52045. invokeDestroyHook(oldVnode);
  52046. }
  52047. }
  52048. }
  52049. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  52050. return vnode.elm
  52051. }
  52052. }
  52053. /* */
  52054. var directives = {
  52055. create: updateDirectives,
  52056. update: updateDirectives,
  52057. destroy: function unbindDirectives (vnode) {
  52058. updateDirectives(vnode, emptyNode);
  52059. }
  52060. };
  52061. function updateDirectives (oldVnode, vnode) {
  52062. if (oldVnode.data.directives || vnode.data.directives) {
  52063. _update(oldVnode, vnode);
  52064. }
  52065. }
  52066. function _update (oldVnode, vnode) {
  52067. var isCreate = oldVnode === emptyNode;
  52068. var isDestroy = vnode === emptyNode;
  52069. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  52070. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  52071. var dirsWithInsert = [];
  52072. var dirsWithPostpatch = [];
  52073. var key, oldDir, dir;
  52074. for (key in newDirs) {
  52075. oldDir = oldDirs[key];
  52076. dir = newDirs[key];
  52077. if (!oldDir) {
  52078. // new directive, bind
  52079. callHook$1(dir, 'bind', vnode, oldVnode);
  52080. if (dir.def && dir.def.inserted) {
  52081. dirsWithInsert.push(dir);
  52082. }
  52083. } else {
  52084. // existing directive, update
  52085. dir.oldValue = oldDir.value;
  52086. dir.oldArg = oldDir.arg;
  52087. callHook$1(dir, 'update', vnode, oldVnode);
  52088. if (dir.def && dir.def.componentUpdated) {
  52089. dirsWithPostpatch.push(dir);
  52090. }
  52091. }
  52092. }
  52093. if (dirsWithInsert.length) {
  52094. var callInsert = function () {
  52095. for (var i = 0; i < dirsWithInsert.length; i++) {
  52096. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  52097. }
  52098. };
  52099. if (isCreate) {
  52100. mergeVNodeHook(vnode, 'insert', callInsert);
  52101. } else {
  52102. callInsert();
  52103. }
  52104. }
  52105. if (dirsWithPostpatch.length) {
  52106. mergeVNodeHook(vnode, 'postpatch', function () {
  52107. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  52108. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  52109. }
  52110. });
  52111. }
  52112. if (!isCreate) {
  52113. for (key in oldDirs) {
  52114. if (!newDirs[key]) {
  52115. // no longer present, unbind
  52116. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  52117. }
  52118. }
  52119. }
  52120. }
  52121. var emptyModifiers = Object.create(null);
  52122. function normalizeDirectives$1 (
  52123. dirs,
  52124. vm
  52125. ) {
  52126. var res = Object.create(null);
  52127. if (!dirs) {
  52128. // $flow-disable-line
  52129. return res
  52130. }
  52131. var i, dir;
  52132. for (i = 0; i < dirs.length; i++) {
  52133. dir = dirs[i];
  52134. if (!dir.modifiers) {
  52135. // $flow-disable-line
  52136. dir.modifiers = emptyModifiers;
  52137. }
  52138. res[getRawDirName(dir)] = dir;
  52139. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  52140. }
  52141. // $flow-disable-line
  52142. return res
  52143. }
  52144. function getRawDirName (dir) {
  52145. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  52146. }
  52147. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  52148. var fn = dir.def && dir.def[hook];
  52149. if (fn) {
  52150. try {
  52151. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  52152. } catch (e) {
  52153. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  52154. }
  52155. }
  52156. }
  52157. var baseModules = [
  52158. ref,
  52159. directives
  52160. ];
  52161. /* */
  52162. function updateAttrs (oldVnode, vnode) {
  52163. var opts = vnode.componentOptions;
  52164. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  52165. return
  52166. }
  52167. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  52168. return
  52169. }
  52170. var key, cur, old;
  52171. var elm = vnode.elm;
  52172. var oldAttrs = oldVnode.data.attrs || {};
  52173. var attrs = vnode.data.attrs || {};
  52174. // clone observed objects, as the user probably wants to mutate it
  52175. if (isDef(attrs.__ob__)) {
  52176. attrs = vnode.data.attrs = extend({}, attrs);
  52177. }
  52178. for (key in attrs) {
  52179. cur = attrs[key];
  52180. old = oldAttrs[key];
  52181. if (old !== cur) {
  52182. setAttr(elm, key, cur);
  52183. }
  52184. }
  52185. // #4391: in IE9, setting type can reset value for input[type=radio]
  52186. // #6666: IE/Edge forces progress value down to 1 before setting a max
  52187. /* istanbul ignore if */
  52188. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  52189. setAttr(elm, 'value', attrs.value);
  52190. }
  52191. for (key in oldAttrs) {
  52192. if (isUndef(attrs[key])) {
  52193. if (isXlink(key)) {
  52194. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  52195. } else if (!isEnumeratedAttr(key)) {
  52196. elm.removeAttribute(key);
  52197. }
  52198. }
  52199. }
  52200. }
  52201. function setAttr (el, key, value) {
  52202. if (el.tagName.indexOf('-') > -1) {
  52203. baseSetAttr(el, key, value);
  52204. } else if (isBooleanAttr(key)) {
  52205. // set attribute for blank value
  52206. // e.g. <option disabled>Select one</option>
  52207. if (isFalsyAttrValue(value)) {
  52208. el.removeAttribute(key);
  52209. } else {
  52210. // technically allowfullscreen is a boolean attribute for <iframe>,
  52211. // but Flash expects a value of "true" when used on <embed> tag
  52212. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  52213. ? 'true'
  52214. : key;
  52215. el.setAttribute(key, value);
  52216. }
  52217. } else if (isEnumeratedAttr(key)) {
  52218. el.setAttribute(key, convertEnumeratedValue(key, value));
  52219. } else if (isXlink(key)) {
  52220. if (isFalsyAttrValue(value)) {
  52221. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  52222. } else {
  52223. el.setAttributeNS(xlinkNS, key, value);
  52224. }
  52225. } else {
  52226. baseSetAttr(el, key, value);
  52227. }
  52228. }
  52229. function baseSetAttr (el, key, value) {
  52230. if (isFalsyAttrValue(value)) {
  52231. el.removeAttribute(key);
  52232. } else {
  52233. // #7138: IE10 & 11 fires input event when setting placeholder on
  52234. // <textarea>... block the first input event and remove the blocker
  52235. // immediately.
  52236. /* istanbul ignore if */
  52237. if (
  52238. isIE && !isIE9 &&
  52239. el.tagName === 'TEXTAREA' &&
  52240. key === 'placeholder' && value !== '' && !el.__ieph
  52241. ) {
  52242. var blocker = function (e) {
  52243. e.stopImmediatePropagation();
  52244. el.removeEventListener('input', blocker);
  52245. };
  52246. el.addEventListener('input', blocker);
  52247. // $flow-disable-line
  52248. el.__ieph = true; /* IE placeholder patched */
  52249. }
  52250. el.setAttribute(key, value);
  52251. }
  52252. }
  52253. var attrs = {
  52254. create: updateAttrs,
  52255. update: updateAttrs
  52256. };
  52257. /* */
  52258. function updateClass (oldVnode, vnode) {
  52259. var el = vnode.elm;
  52260. var data = vnode.data;
  52261. var oldData = oldVnode.data;
  52262. if (
  52263. isUndef(data.staticClass) &&
  52264. isUndef(data.class) && (
  52265. isUndef(oldData) || (
  52266. isUndef(oldData.staticClass) &&
  52267. isUndef(oldData.class)
  52268. )
  52269. )
  52270. ) {
  52271. return
  52272. }
  52273. var cls = genClassForVnode(vnode);
  52274. // handle transition classes
  52275. var transitionClass = el._transitionClasses;
  52276. if (isDef(transitionClass)) {
  52277. cls = concat(cls, stringifyClass(transitionClass));
  52278. }
  52279. // set the class
  52280. if (cls !== el._prevClass) {
  52281. el.setAttribute('class', cls);
  52282. el._prevClass = cls;
  52283. }
  52284. }
  52285. var klass = {
  52286. create: updateClass,
  52287. update: updateClass
  52288. };
  52289. /* */
  52290. var validDivisionCharRE = /[\w).+\-_$\]]/;
  52291. function parseFilters (exp) {
  52292. var inSingle = false;
  52293. var inDouble = false;
  52294. var inTemplateString = false;
  52295. var inRegex = false;
  52296. var curly = 0;
  52297. var square = 0;
  52298. var paren = 0;
  52299. var lastFilterIndex = 0;
  52300. var c, prev, i, expression, filters;
  52301. for (i = 0; i < exp.length; i++) {
  52302. prev = c;
  52303. c = exp.charCodeAt(i);
  52304. if (inSingle) {
  52305. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  52306. } else if (inDouble) {
  52307. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  52308. } else if (inTemplateString) {
  52309. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  52310. } else if (inRegex) {
  52311. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  52312. } else if (
  52313. c === 0x7C && // pipe
  52314. exp.charCodeAt(i + 1) !== 0x7C &&
  52315. exp.charCodeAt(i - 1) !== 0x7C &&
  52316. !curly && !square && !paren
  52317. ) {
  52318. if (expression === undefined) {
  52319. // first filter, end of expression
  52320. lastFilterIndex = i + 1;
  52321. expression = exp.slice(0, i).trim();
  52322. } else {
  52323. pushFilter();
  52324. }
  52325. } else {
  52326. switch (c) {
  52327. case 0x22: inDouble = true; break // "
  52328. case 0x27: inSingle = true; break // '
  52329. case 0x60: inTemplateString = true; break // `
  52330. case 0x28: paren++; break // (
  52331. case 0x29: paren--; break // )
  52332. case 0x5B: square++; break // [
  52333. case 0x5D: square--; break // ]
  52334. case 0x7B: curly++; break // {
  52335. case 0x7D: curly--; break // }
  52336. }
  52337. if (c === 0x2f) { // /
  52338. var j = i - 1;
  52339. var p = (void 0);
  52340. // find first non-whitespace prev char
  52341. for (; j >= 0; j--) {
  52342. p = exp.charAt(j);
  52343. if (p !== ' ') { break }
  52344. }
  52345. if (!p || !validDivisionCharRE.test(p)) {
  52346. inRegex = true;
  52347. }
  52348. }
  52349. }
  52350. }
  52351. if (expression === undefined) {
  52352. expression = exp.slice(0, i).trim();
  52353. } else if (lastFilterIndex !== 0) {
  52354. pushFilter();
  52355. }
  52356. function pushFilter () {
  52357. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  52358. lastFilterIndex = i + 1;
  52359. }
  52360. if (filters) {
  52361. for (i = 0; i < filters.length; i++) {
  52362. expression = wrapFilter(expression, filters[i]);
  52363. }
  52364. }
  52365. return expression
  52366. }
  52367. function wrapFilter (exp, filter) {
  52368. var i = filter.indexOf('(');
  52369. if (i < 0) {
  52370. // _f: resolveFilter
  52371. return ("_f(\"" + filter + "\")(" + exp + ")")
  52372. } else {
  52373. var name = filter.slice(0, i);
  52374. var args = filter.slice(i + 1);
  52375. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  52376. }
  52377. }
  52378. /* */
  52379. /* eslint-disable no-unused-vars */
  52380. function baseWarn (msg, range) {
  52381. console.error(("[Vue compiler]: " + msg));
  52382. }
  52383. /* eslint-enable no-unused-vars */
  52384. function pluckModuleFunction (
  52385. modules,
  52386. key
  52387. ) {
  52388. return modules
  52389. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  52390. : []
  52391. }
  52392. function addProp (el, name, value, range, dynamic) {
  52393. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  52394. el.plain = false;
  52395. }
  52396. function addAttr (el, name, value, range, dynamic) {
  52397. var attrs = dynamic
  52398. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  52399. : (el.attrs || (el.attrs = []));
  52400. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  52401. el.plain = false;
  52402. }
  52403. // add a raw attr (use this in preTransforms)
  52404. function addRawAttr (el, name, value, range) {
  52405. el.attrsMap[name] = value;
  52406. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  52407. }
  52408. function addDirective (
  52409. el,
  52410. name,
  52411. rawName,
  52412. value,
  52413. arg,
  52414. isDynamicArg,
  52415. modifiers,
  52416. range
  52417. ) {
  52418. (el.directives || (el.directives = [])).push(rangeSetItem({
  52419. name: name,
  52420. rawName: rawName,
  52421. value: value,
  52422. arg: arg,
  52423. isDynamicArg: isDynamicArg,
  52424. modifiers: modifiers
  52425. }, range));
  52426. el.plain = false;
  52427. }
  52428. function prependModifierMarker (symbol, name, dynamic) {
  52429. return dynamic
  52430. ? ("_p(" + name + ",\"" + symbol + "\")")
  52431. : symbol + name // mark the event as captured
  52432. }
  52433. function addHandler (
  52434. el,
  52435. name,
  52436. value,
  52437. modifiers,
  52438. important,
  52439. warn,
  52440. range,
  52441. dynamic
  52442. ) {
  52443. modifiers = modifiers || emptyObject;
  52444. // warn prevent and passive modifier
  52445. /* istanbul ignore if */
  52446. if (
  52447. warn &&
  52448. modifiers.prevent && modifiers.passive
  52449. ) {
  52450. warn(
  52451. 'passive and prevent can\'t be used together. ' +
  52452. 'Passive handler can\'t prevent default event.',
  52453. range
  52454. );
  52455. }
  52456. // normalize click.right and click.middle since they don't actually fire
  52457. // this is technically browser-specific, but at least for now browsers are
  52458. // the only target envs that have right/middle clicks.
  52459. if (modifiers.right) {
  52460. if (dynamic) {
  52461. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  52462. } else if (name === 'click') {
  52463. name = 'contextmenu';
  52464. delete modifiers.right;
  52465. }
  52466. } else if (modifiers.middle) {
  52467. if (dynamic) {
  52468. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  52469. } else if (name === 'click') {
  52470. name = 'mouseup';
  52471. }
  52472. }
  52473. // check capture modifier
  52474. if (modifiers.capture) {
  52475. delete modifiers.capture;
  52476. name = prependModifierMarker('!', name, dynamic);
  52477. }
  52478. if (modifiers.once) {
  52479. delete modifiers.once;
  52480. name = prependModifierMarker('~', name, dynamic);
  52481. }
  52482. /* istanbul ignore if */
  52483. if (modifiers.passive) {
  52484. delete modifiers.passive;
  52485. name = prependModifierMarker('&', name, dynamic);
  52486. }
  52487. var events;
  52488. if (modifiers.native) {
  52489. delete modifiers.native;
  52490. events = el.nativeEvents || (el.nativeEvents = {});
  52491. } else {
  52492. events = el.events || (el.events = {});
  52493. }
  52494. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  52495. if (modifiers !== emptyObject) {
  52496. newHandler.modifiers = modifiers;
  52497. }
  52498. var handlers = events[name];
  52499. /* istanbul ignore if */
  52500. if (Array.isArray(handlers)) {
  52501. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  52502. } else if (handlers) {
  52503. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  52504. } else {
  52505. events[name] = newHandler;
  52506. }
  52507. el.plain = false;
  52508. }
  52509. function getRawBindingAttr (
  52510. el,
  52511. name
  52512. ) {
  52513. return el.rawAttrsMap[':' + name] ||
  52514. el.rawAttrsMap['v-bind:' + name] ||
  52515. el.rawAttrsMap[name]
  52516. }
  52517. function getBindingAttr (
  52518. el,
  52519. name,
  52520. getStatic
  52521. ) {
  52522. var dynamicValue =
  52523. getAndRemoveAttr(el, ':' + name) ||
  52524. getAndRemoveAttr(el, 'v-bind:' + name);
  52525. if (dynamicValue != null) {
  52526. return parseFilters(dynamicValue)
  52527. } else if (getStatic !== false) {
  52528. var staticValue = getAndRemoveAttr(el, name);
  52529. if (staticValue != null) {
  52530. return JSON.stringify(staticValue)
  52531. }
  52532. }
  52533. }
  52534. // note: this only removes the attr from the Array (attrsList) so that it
  52535. // doesn't get processed by processAttrs.
  52536. // By default it does NOT remove it from the map (attrsMap) because the map is
  52537. // needed during codegen.
  52538. function getAndRemoveAttr (
  52539. el,
  52540. name,
  52541. removeFromMap
  52542. ) {
  52543. var val;
  52544. if ((val = el.attrsMap[name]) != null) {
  52545. var list = el.attrsList;
  52546. for (var i = 0, l = list.length; i < l; i++) {
  52547. if (list[i].name === name) {
  52548. list.splice(i, 1);
  52549. break
  52550. }
  52551. }
  52552. }
  52553. if (removeFromMap) {
  52554. delete el.attrsMap[name];
  52555. }
  52556. return val
  52557. }
  52558. function getAndRemoveAttrByRegex (
  52559. el,
  52560. name
  52561. ) {
  52562. var list = el.attrsList;
  52563. for (var i = 0, l = list.length; i < l; i++) {
  52564. var attr = list[i];
  52565. if (name.test(attr.name)) {
  52566. list.splice(i, 1);
  52567. return attr
  52568. }
  52569. }
  52570. }
  52571. function rangeSetItem (
  52572. item,
  52573. range
  52574. ) {
  52575. if (range) {
  52576. if (range.start != null) {
  52577. item.start = range.start;
  52578. }
  52579. if (range.end != null) {
  52580. item.end = range.end;
  52581. }
  52582. }
  52583. return item
  52584. }
  52585. /* */
  52586. /**
  52587. * Cross-platform code generation for component v-model
  52588. */
  52589. function genComponentModel (
  52590. el,
  52591. value,
  52592. modifiers
  52593. ) {
  52594. var ref = modifiers || {};
  52595. var number = ref.number;
  52596. var trim = ref.trim;
  52597. var baseValueExpression = '$$v';
  52598. var valueExpression = baseValueExpression;
  52599. if (trim) {
  52600. valueExpression =
  52601. "(typeof " + baseValueExpression + " === 'string'" +
  52602. "? " + baseValueExpression + ".trim()" +
  52603. ": " + baseValueExpression + ")";
  52604. }
  52605. if (number) {
  52606. valueExpression = "_n(" + valueExpression + ")";
  52607. }
  52608. var assignment = genAssignmentCode(value, valueExpression);
  52609. el.model = {
  52610. value: ("(" + value + ")"),
  52611. expression: JSON.stringify(value),
  52612. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  52613. };
  52614. }
  52615. /**
  52616. * Cross-platform codegen helper for generating v-model value assignment code.
  52617. */
  52618. function genAssignmentCode (
  52619. value,
  52620. assignment
  52621. ) {
  52622. var res = parseModel(value);
  52623. if (res.key === null) {
  52624. return (value + "=" + assignment)
  52625. } else {
  52626. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  52627. }
  52628. }
  52629. /**
  52630. * Parse a v-model expression into a base path and a final key segment.
  52631. * Handles both dot-path and possible square brackets.
  52632. *
  52633. * Possible cases:
  52634. *
  52635. * - test
  52636. * - test[key]
  52637. * - test[test1[key]]
  52638. * - test["a"][key]
  52639. * - xxx.test[a[a].test1[key]]
  52640. * - test.xxx.a["asa"][test1[key]]
  52641. *
  52642. */
  52643. var len, str, chr, index$1, expressionPos, expressionEndPos;
  52644. function parseModel (val) {
  52645. // Fix https://github.com/vuejs/vue/pull/7730
  52646. // allow v-model="obj.val " (trailing whitespace)
  52647. val = val.trim();
  52648. len = val.length;
  52649. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  52650. index$1 = val.lastIndexOf('.');
  52651. if (index$1 > -1) {
  52652. return {
  52653. exp: val.slice(0, index$1),
  52654. key: '"' + val.slice(index$1 + 1) + '"'
  52655. }
  52656. } else {
  52657. return {
  52658. exp: val,
  52659. key: null
  52660. }
  52661. }
  52662. }
  52663. str = val;
  52664. index$1 = expressionPos = expressionEndPos = 0;
  52665. while (!eof()) {
  52666. chr = next();
  52667. /* istanbul ignore if */
  52668. if (isStringStart(chr)) {
  52669. parseString(chr);
  52670. } else if (chr === 0x5B) {
  52671. parseBracket(chr);
  52672. }
  52673. }
  52674. return {
  52675. exp: val.slice(0, expressionPos),
  52676. key: val.slice(expressionPos + 1, expressionEndPos)
  52677. }
  52678. }
  52679. function next () {
  52680. return str.charCodeAt(++index$1)
  52681. }
  52682. function eof () {
  52683. return index$1 >= len
  52684. }
  52685. function isStringStart (chr) {
  52686. return chr === 0x22 || chr === 0x27
  52687. }
  52688. function parseBracket (chr) {
  52689. var inBracket = 1;
  52690. expressionPos = index$1;
  52691. while (!eof()) {
  52692. chr = next();
  52693. if (isStringStart(chr)) {
  52694. parseString(chr);
  52695. continue
  52696. }
  52697. if (chr === 0x5B) { inBracket++; }
  52698. if (chr === 0x5D) { inBracket--; }
  52699. if (inBracket === 0) {
  52700. expressionEndPos = index$1;
  52701. break
  52702. }
  52703. }
  52704. }
  52705. function parseString (chr) {
  52706. var stringQuote = chr;
  52707. while (!eof()) {
  52708. chr = next();
  52709. if (chr === stringQuote) {
  52710. break
  52711. }
  52712. }
  52713. }
  52714. /* */
  52715. var warn$1;
  52716. // in some cases, the event used has to be determined at runtime
  52717. // so we used some reserved tokens during compile.
  52718. var RANGE_TOKEN = '__r';
  52719. var CHECKBOX_RADIO_TOKEN = '__c';
  52720. function model (
  52721. el,
  52722. dir,
  52723. _warn
  52724. ) {
  52725. warn$1 = _warn;
  52726. var value = dir.value;
  52727. var modifiers = dir.modifiers;
  52728. var tag = el.tag;
  52729. var type = el.attrsMap.type;
  52730. {
  52731. // inputs with type="file" are read only and setting the input's
  52732. // value will throw an error.
  52733. if (tag === 'input' && type === 'file') {
  52734. warn$1(
  52735. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  52736. "File inputs are read only. Use a v-on:change listener instead.",
  52737. el.rawAttrsMap['v-model']
  52738. );
  52739. }
  52740. }
  52741. if (el.component) {
  52742. genComponentModel(el, value, modifiers);
  52743. // component v-model doesn't need extra runtime
  52744. return false
  52745. } else if (tag === 'select') {
  52746. genSelect(el, value, modifiers);
  52747. } else if (tag === 'input' && type === 'checkbox') {
  52748. genCheckboxModel(el, value, modifiers);
  52749. } else if (tag === 'input' && type === 'radio') {
  52750. genRadioModel(el, value, modifiers);
  52751. } else if (tag === 'input' || tag === 'textarea') {
  52752. genDefaultModel(el, value, modifiers);
  52753. } else if (!config.isReservedTag(tag)) {
  52754. genComponentModel(el, value, modifiers);
  52755. // component v-model doesn't need extra runtime
  52756. return false
  52757. } else {
  52758. warn$1(
  52759. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  52760. "v-model is not supported on this element type. " +
  52761. 'If you are working with contenteditable, it\'s recommended to ' +
  52762. 'wrap a library dedicated for that purpose inside a custom component.',
  52763. el.rawAttrsMap['v-model']
  52764. );
  52765. }
  52766. // ensure runtime directive metadata
  52767. return true
  52768. }
  52769. function genCheckboxModel (
  52770. el,
  52771. value,
  52772. modifiers
  52773. ) {
  52774. var number = modifiers && modifiers.number;
  52775. var valueBinding = getBindingAttr(el, 'value') || 'null';
  52776. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  52777. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  52778. addProp(el, 'checked',
  52779. "Array.isArray(" + value + ")" +
  52780. "?_i(" + value + "," + valueBinding + ")>-1" + (
  52781. trueValueBinding === 'true'
  52782. ? (":(" + value + ")")
  52783. : (":_q(" + value + "," + trueValueBinding + ")")
  52784. )
  52785. );
  52786. addHandler(el, 'change',
  52787. "var $$a=" + value + "," +
  52788. '$$el=$event.target,' +
  52789. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  52790. 'if(Array.isArray($$a)){' +
  52791. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  52792. '$$i=_i($$a,$$v);' +
  52793. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  52794. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  52795. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  52796. null, true
  52797. );
  52798. }
  52799. function genRadioModel (
  52800. el,
  52801. value,
  52802. modifiers
  52803. ) {
  52804. var number = modifiers && modifiers.number;
  52805. var valueBinding = getBindingAttr(el, 'value') || 'null';
  52806. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  52807. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  52808. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  52809. }
  52810. function genSelect (
  52811. el,
  52812. value,
  52813. modifiers
  52814. ) {
  52815. var number = modifiers && modifiers.number;
  52816. var selectedVal = "Array.prototype.filter" +
  52817. ".call($event.target.options,function(o){return o.selected})" +
  52818. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  52819. "return " + (number ? '_n(val)' : 'val') + "})";
  52820. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  52821. var code = "var $$selectedVal = " + selectedVal + ";";
  52822. code = code + " " + (genAssignmentCode(value, assignment));
  52823. addHandler(el, 'change', code, null, true);
  52824. }
  52825. function genDefaultModel (
  52826. el,
  52827. value,
  52828. modifiers
  52829. ) {
  52830. var type = el.attrsMap.type;
  52831. // warn if v-bind:value conflicts with v-model
  52832. // except for inputs with v-bind:type
  52833. {
  52834. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  52835. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  52836. if (value$1 && !typeBinding) {
  52837. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  52838. warn$1(
  52839. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  52840. 'because the latter already expands to a value binding internally',
  52841. el.rawAttrsMap[binding]
  52842. );
  52843. }
  52844. }
  52845. var ref = modifiers || {};
  52846. var lazy = ref.lazy;
  52847. var number = ref.number;
  52848. var trim = ref.trim;
  52849. var needCompositionGuard = !lazy && type !== 'range';
  52850. var event = lazy
  52851. ? 'change'
  52852. : type === 'range'
  52853. ? RANGE_TOKEN
  52854. : 'input';
  52855. var valueExpression = '$event.target.value';
  52856. if (trim) {
  52857. valueExpression = "$event.target.value.trim()";
  52858. }
  52859. if (number) {
  52860. valueExpression = "_n(" + valueExpression + ")";
  52861. }
  52862. var code = genAssignmentCode(value, valueExpression);
  52863. if (needCompositionGuard) {
  52864. code = "if($event.target.composing)return;" + code;
  52865. }
  52866. addProp(el, 'value', ("(" + value + ")"));
  52867. addHandler(el, event, code, null, true);
  52868. if (trim || number) {
  52869. addHandler(el, 'blur', '$forceUpdate()');
  52870. }
  52871. }
  52872. /* */
  52873. // normalize v-model event tokens that can only be determined at runtime.
  52874. // it's important to place the event as the first in the array because
  52875. // the whole point is ensuring the v-model callback gets called before
  52876. // user-attached handlers.
  52877. function normalizeEvents (on) {
  52878. /* istanbul ignore if */
  52879. if (isDef(on[RANGE_TOKEN])) {
  52880. // IE input[type=range] only supports `change` event
  52881. var event = isIE ? 'change' : 'input';
  52882. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  52883. delete on[RANGE_TOKEN];
  52884. }
  52885. // This was originally intended to fix #4521 but no longer necessary
  52886. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  52887. /* istanbul ignore if */
  52888. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  52889. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  52890. delete on[CHECKBOX_RADIO_TOKEN];
  52891. }
  52892. }
  52893. var target$1;
  52894. function createOnceHandler$1 (event, handler, capture) {
  52895. var _target = target$1; // save current target element in closure
  52896. return function onceHandler () {
  52897. var res = handler.apply(null, arguments);
  52898. if (res !== null) {
  52899. remove$2(event, onceHandler, capture, _target);
  52900. }
  52901. }
  52902. }
  52903. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  52904. // implementation and does not fire microtasks in between event propagation, so
  52905. // safe to exclude.
  52906. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  52907. function add$1 (
  52908. name,
  52909. handler,
  52910. capture,
  52911. passive
  52912. ) {
  52913. // async edge case #6566: inner click event triggers patch, event handler
  52914. // attached to outer element during patch, and triggered again. This
  52915. // happens because browsers fire microtask ticks between event propagation.
  52916. // the solution is simple: we save the timestamp when a handler is attached,
  52917. // and the handler would only fire if the event passed to it was fired
  52918. // AFTER it was attached.
  52919. if (useMicrotaskFix) {
  52920. var attachedTimestamp = currentFlushTimestamp;
  52921. var original = handler;
  52922. handler = original._wrapper = function (e) {
  52923. if (
  52924. // no bubbling, should always fire.
  52925. // this is just a safety net in case event.timeStamp is unreliable in
  52926. // certain weird environments...
  52927. e.target === e.currentTarget ||
  52928. // event is fired after handler attachment
  52929. e.timeStamp >= attachedTimestamp ||
  52930. // bail for environments that have buggy event.timeStamp implementations
  52931. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  52932. // #9681 QtWebEngine event.timeStamp is negative value
  52933. e.timeStamp <= 0 ||
  52934. // #9448 bail if event is fired in another document in a multi-page
  52935. // electron/nw.js app, since event.timeStamp will be using a different
  52936. // starting reference
  52937. e.target.ownerDocument !== document
  52938. ) {
  52939. return original.apply(this, arguments)
  52940. }
  52941. };
  52942. }
  52943. target$1.addEventListener(
  52944. name,
  52945. handler,
  52946. supportsPassive
  52947. ? { capture: capture, passive: passive }
  52948. : capture
  52949. );
  52950. }
  52951. function remove$2 (
  52952. name,
  52953. handler,
  52954. capture,
  52955. _target
  52956. ) {
  52957. (_target || target$1).removeEventListener(
  52958. name,
  52959. handler._wrapper || handler,
  52960. capture
  52961. );
  52962. }
  52963. function updateDOMListeners (oldVnode, vnode) {
  52964. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  52965. return
  52966. }
  52967. var on = vnode.data.on || {};
  52968. var oldOn = oldVnode.data.on || {};
  52969. target$1 = vnode.elm;
  52970. normalizeEvents(on);
  52971. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  52972. target$1 = undefined;
  52973. }
  52974. var events = {
  52975. create: updateDOMListeners,
  52976. update: updateDOMListeners
  52977. };
  52978. /* */
  52979. var svgContainer;
  52980. function updateDOMProps (oldVnode, vnode) {
  52981. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  52982. return
  52983. }
  52984. var key, cur;
  52985. var elm = vnode.elm;
  52986. var oldProps = oldVnode.data.domProps || {};
  52987. var props = vnode.data.domProps || {};
  52988. // clone observed objects, as the user probably wants to mutate it
  52989. if (isDef(props.__ob__)) {
  52990. props = vnode.data.domProps = extend({}, props);
  52991. }
  52992. for (key in oldProps) {
  52993. if (!(key in props)) {
  52994. elm[key] = '';
  52995. }
  52996. }
  52997. for (key in props) {
  52998. cur = props[key];
  52999. // ignore children if the node has textContent or innerHTML,
  53000. // as these will throw away existing DOM nodes and cause removal errors
  53001. // on subsequent patches (#3360)
  53002. if (key === 'textContent' || key === 'innerHTML') {
  53003. if (vnode.children) { vnode.children.length = 0; }
  53004. if (cur === oldProps[key]) { continue }
  53005. // #6601 work around Chrome version <= 55 bug where single textNode
  53006. // replaced by innerHTML/textContent retains its parentNode property
  53007. if (elm.childNodes.length === 1) {
  53008. elm.removeChild(elm.childNodes[0]);
  53009. }
  53010. }
  53011. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  53012. // store value as _value as well since
  53013. // non-string values will be stringified
  53014. elm._value = cur;
  53015. // avoid resetting cursor position when value is the same
  53016. var strCur = isUndef(cur) ? '' : String(cur);
  53017. if (shouldUpdateValue(elm, strCur)) {
  53018. elm.value = strCur;
  53019. }
  53020. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  53021. // IE doesn't support innerHTML for SVG elements
  53022. svgContainer = svgContainer || document.createElement('div');
  53023. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  53024. var svg = svgContainer.firstChild;
  53025. while (elm.firstChild) {
  53026. elm.removeChild(elm.firstChild);
  53027. }
  53028. while (svg.firstChild) {
  53029. elm.appendChild(svg.firstChild);
  53030. }
  53031. } else if (
  53032. // skip the update if old and new VDOM state is the same.
  53033. // `value` is handled separately because the DOM value may be temporarily
  53034. // out of sync with VDOM state due to focus, composition and modifiers.
  53035. // This #4521 by skipping the unnecesarry `checked` update.
  53036. cur !== oldProps[key]
  53037. ) {
  53038. // some property updates can throw
  53039. // e.g. `value` on <progress> w/ non-finite value
  53040. try {
  53041. elm[key] = cur;
  53042. } catch (e) {}
  53043. }
  53044. }
  53045. }
  53046. // check platforms/web/util/attrs.js acceptValue
  53047. function shouldUpdateValue (elm, checkVal) {
  53048. return (!elm.composing && (
  53049. elm.tagName === 'OPTION' ||
  53050. isNotInFocusAndDirty(elm, checkVal) ||
  53051. isDirtyWithModifiers(elm, checkVal)
  53052. ))
  53053. }
  53054. function isNotInFocusAndDirty (elm, checkVal) {
  53055. // return true when textbox (.number and .trim) loses focus and its value is
  53056. // not equal to the updated value
  53057. var notInFocus = true;
  53058. // #6157
  53059. // work around IE bug when accessing document.activeElement in an iframe
  53060. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  53061. return notInFocus && elm.value !== checkVal
  53062. }
  53063. function isDirtyWithModifiers (elm, newVal) {
  53064. var value = elm.value;
  53065. var modifiers = elm._vModifiers; // injected by v-model runtime
  53066. if (isDef(modifiers)) {
  53067. if (modifiers.number) {
  53068. return toNumber(value) !== toNumber(newVal)
  53069. }
  53070. if (modifiers.trim) {
  53071. return value.trim() !== newVal.trim()
  53072. }
  53073. }
  53074. return value !== newVal
  53075. }
  53076. var domProps = {
  53077. create: updateDOMProps,
  53078. update: updateDOMProps
  53079. };
  53080. /* */
  53081. var parseStyleText = cached(function (cssText) {
  53082. var res = {};
  53083. var listDelimiter = /;(?![^(]*\))/g;
  53084. var propertyDelimiter = /:(.+)/;
  53085. cssText.split(listDelimiter).forEach(function (item) {
  53086. if (item) {
  53087. var tmp = item.split(propertyDelimiter);
  53088. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  53089. }
  53090. });
  53091. return res
  53092. });
  53093. // merge static and dynamic style data on the same vnode
  53094. function normalizeStyleData (data) {
  53095. var style = normalizeStyleBinding(data.style);
  53096. // static style is pre-processed into an object during compilation
  53097. // and is always a fresh object, so it's safe to merge into it
  53098. return data.staticStyle
  53099. ? extend(data.staticStyle, style)
  53100. : style
  53101. }
  53102. // normalize possible array / string values into Object
  53103. function normalizeStyleBinding (bindingStyle) {
  53104. if (Array.isArray(bindingStyle)) {
  53105. return toObject(bindingStyle)
  53106. }
  53107. if (typeof bindingStyle === 'string') {
  53108. return parseStyleText(bindingStyle)
  53109. }
  53110. return bindingStyle
  53111. }
  53112. /**
  53113. * parent component style should be after child's
  53114. * so that parent component's style could override it
  53115. */
  53116. function getStyle (vnode, checkChild) {
  53117. var res = {};
  53118. var styleData;
  53119. if (checkChild) {
  53120. var childNode = vnode;
  53121. while (childNode.componentInstance) {
  53122. childNode = childNode.componentInstance._vnode;
  53123. if (
  53124. childNode && childNode.data &&
  53125. (styleData = normalizeStyleData(childNode.data))
  53126. ) {
  53127. extend(res, styleData);
  53128. }
  53129. }
  53130. }
  53131. if ((styleData = normalizeStyleData(vnode.data))) {
  53132. extend(res, styleData);
  53133. }
  53134. var parentNode = vnode;
  53135. while ((parentNode = parentNode.parent)) {
  53136. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  53137. extend(res, styleData);
  53138. }
  53139. }
  53140. return res
  53141. }
  53142. /* */
  53143. var cssVarRE = /^--/;
  53144. var importantRE = /\s*!important$/;
  53145. var setProp = function (el, name, val) {
  53146. /* istanbul ignore if */
  53147. if (cssVarRE.test(name)) {
  53148. el.style.setProperty(name, val);
  53149. } else if (importantRE.test(val)) {
  53150. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  53151. } else {
  53152. var normalizedName = normalize(name);
  53153. if (Array.isArray(val)) {
  53154. // Support values array created by autoprefixer, e.g.
  53155. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  53156. // Set them one by one, and the browser will only set those it can recognize
  53157. for (var i = 0, len = val.length; i < len; i++) {
  53158. el.style[normalizedName] = val[i];
  53159. }
  53160. } else {
  53161. el.style[normalizedName] = val;
  53162. }
  53163. }
  53164. };
  53165. var vendorNames = ['Webkit', 'Moz', 'ms'];
  53166. var emptyStyle;
  53167. var normalize = cached(function (prop) {
  53168. emptyStyle = emptyStyle || document.createElement('div').style;
  53169. prop = camelize(prop);
  53170. if (prop !== 'filter' && (prop in emptyStyle)) {
  53171. return prop
  53172. }
  53173. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  53174. for (var i = 0; i < vendorNames.length; i++) {
  53175. var name = vendorNames[i] + capName;
  53176. if (name in emptyStyle) {
  53177. return name
  53178. }
  53179. }
  53180. });
  53181. function updateStyle (oldVnode, vnode) {
  53182. var data = vnode.data;
  53183. var oldData = oldVnode.data;
  53184. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  53185. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  53186. ) {
  53187. return
  53188. }
  53189. var cur, name;
  53190. var el = vnode.elm;
  53191. var oldStaticStyle = oldData.staticStyle;
  53192. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  53193. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  53194. var oldStyle = oldStaticStyle || oldStyleBinding;
  53195. var style = normalizeStyleBinding(vnode.data.style) || {};
  53196. // store normalized style under a different key for next diff
  53197. // make sure to clone it if it's reactive, since the user likely wants
  53198. // to mutate it.
  53199. vnode.data.normalizedStyle = isDef(style.__ob__)
  53200. ? extend({}, style)
  53201. : style;
  53202. var newStyle = getStyle(vnode, true);
  53203. for (name in oldStyle) {
  53204. if (isUndef(newStyle[name])) {
  53205. setProp(el, name, '');
  53206. }
  53207. }
  53208. for (name in newStyle) {
  53209. cur = newStyle[name];
  53210. if (cur !== oldStyle[name]) {
  53211. // ie9 setting to null has no effect, must use empty string
  53212. setProp(el, name, cur == null ? '' : cur);
  53213. }
  53214. }
  53215. }
  53216. var style = {
  53217. create: updateStyle,
  53218. update: updateStyle
  53219. };
  53220. /* */
  53221. var whitespaceRE = /\s+/;
  53222. /**
  53223. * Add class with compatibility for SVG since classList is not supported on
  53224. * SVG elements in IE
  53225. */
  53226. function addClass (el, cls) {
  53227. /* istanbul ignore if */
  53228. if (!cls || !(cls = cls.trim())) {
  53229. return
  53230. }
  53231. /* istanbul ignore else */
  53232. if (el.classList) {
  53233. if (cls.indexOf(' ') > -1) {
  53234. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  53235. } else {
  53236. el.classList.add(cls);
  53237. }
  53238. } else {
  53239. var cur = " " + (el.getAttribute('class') || '') + " ";
  53240. if (cur.indexOf(' ' + cls + ' ') < 0) {
  53241. el.setAttribute('class', (cur + cls).trim());
  53242. }
  53243. }
  53244. }
  53245. /**
  53246. * Remove class with compatibility for SVG since classList is not supported on
  53247. * SVG elements in IE
  53248. */
  53249. function removeClass (el, cls) {
  53250. /* istanbul ignore if */
  53251. if (!cls || !(cls = cls.trim())) {
  53252. return
  53253. }
  53254. /* istanbul ignore else */
  53255. if (el.classList) {
  53256. if (cls.indexOf(' ') > -1) {
  53257. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  53258. } else {
  53259. el.classList.remove(cls);
  53260. }
  53261. if (!el.classList.length) {
  53262. el.removeAttribute('class');
  53263. }
  53264. } else {
  53265. var cur = " " + (el.getAttribute('class') || '') + " ";
  53266. var tar = ' ' + cls + ' ';
  53267. while (cur.indexOf(tar) >= 0) {
  53268. cur = cur.replace(tar, ' ');
  53269. }
  53270. cur = cur.trim();
  53271. if (cur) {
  53272. el.setAttribute('class', cur);
  53273. } else {
  53274. el.removeAttribute('class');
  53275. }
  53276. }
  53277. }
  53278. /* */
  53279. function resolveTransition (def$$1) {
  53280. if (!def$$1) {
  53281. return
  53282. }
  53283. /* istanbul ignore else */
  53284. if (typeof def$$1 === 'object') {
  53285. var res = {};
  53286. if (def$$1.css !== false) {
  53287. extend(res, autoCssTransition(def$$1.name || 'v'));
  53288. }
  53289. extend(res, def$$1);
  53290. return res
  53291. } else if (typeof def$$1 === 'string') {
  53292. return autoCssTransition(def$$1)
  53293. }
  53294. }
  53295. var autoCssTransition = cached(function (name) {
  53296. return {
  53297. enterClass: (name + "-enter"),
  53298. enterToClass: (name + "-enter-to"),
  53299. enterActiveClass: (name + "-enter-active"),
  53300. leaveClass: (name + "-leave"),
  53301. leaveToClass: (name + "-leave-to"),
  53302. leaveActiveClass: (name + "-leave-active")
  53303. }
  53304. });
  53305. var hasTransition = inBrowser && !isIE9;
  53306. var TRANSITION = 'transition';
  53307. var ANIMATION = 'animation';
  53308. // Transition property/event sniffing
  53309. var transitionProp = 'transition';
  53310. var transitionEndEvent = 'transitionend';
  53311. var animationProp = 'animation';
  53312. var animationEndEvent = 'animationend';
  53313. if (hasTransition) {
  53314. /* istanbul ignore if */
  53315. if (window.ontransitionend === undefined &&
  53316. window.onwebkittransitionend !== undefined
  53317. ) {
  53318. transitionProp = 'WebkitTransition';
  53319. transitionEndEvent = 'webkitTransitionEnd';
  53320. }
  53321. if (window.onanimationend === undefined &&
  53322. window.onwebkitanimationend !== undefined
  53323. ) {
  53324. animationProp = 'WebkitAnimation';
  53325. animationEndEvent = 'webkitAnimationEnd';
  53326. }
  53327. }
  53328. // binding to window is necessary to make hot reload work in IE in strict mode
  53329. var raf = inBrowser
  53330. ? window.requestAnimationFrame
  53331. ? window.requestAnimationFrame.bind(window)
  53332. : setTimeout
  53333. : /* istanbul ignore next */ function (fn) { return fn(); };
  53334. function nextFrame (fn) {
  53335. raf(function () {
  53336. raf(fn);
  53337. });
  53338. }
  53339. function addTransitionClass (el, cls) {
  53340. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  53341. if (transitionClasses.indexOf(cls) < 0) {
  53342. transitionClasses.push(cls);
  53343. addClass(el, cls);
  53344. }
  53345. }
  53346. function removeTransitionClass (el, cls) {
  53347. if (el._transitionClasses) {
  53348. remove(el._transitionClasses, cls);
  53349. }
  53350. removeClass(el, cls);
  53351. }
  53352. function whenTransitionEnds (
  53353. el,
  53354. expectedType,
  53355. cb
  53356. ) {
  53357. var ref = getTransitionInfo(el, expectedType);
  53358. var type = ref.type;
  53359. var timeout = ref.timeout;
  53360. var propCount = ref.propCount;
  53361. if (!type) { return cb() }
  53362. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  53363. var ended = 0;
  53364. var end = function () {
  53365. el.removeEventListener(event, onEnd);
  53366. cb();
  53367. };
  53368. var onEnd = function (e) {
  53369. if (e.target === el) {
  53370. if (++ended >= propCount) {
  53371. end();
  53372. }
  53373. }
  53374. };
  53375. setTimeout(function () {
  53376. if (ended < propCount) {
  53377. end();
  53378. }
  53379. }, timeout + 1);
  53380. el.addEventListener(event, onEnd);
  53381. }
  53382. var transformRE = /\b(transform|all)(,|$)/;
  53383. function getTransitionInfo (el, expectedType) {
  53384. var styles = window.getComputedStyle(el);
  53385. // JSDOM may return undefined for transition properties
  53386. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  53387. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  53388. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  53389. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  53390. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  53391. var animationTimeout = getTimeout(animationDelays, animationDurations);
  53392. var type;
  53393. var timeout = 0;
  53394. var propCount = 0;
  53395. /* istanbul ignore if */
  53396. if (expectedType === TRANSITION) {
  53397. if (transitionTimeout > 0) {
  53398. type = TRANSITION;
  53399. timeout = transitionTimeout;
  53400. propCount = transitionDurations.length;
  53401. }
  53402. } else if (expectedType === ANIMATION) {
  53403. if (animationTimeout > 0) {
  53404. type = ANIMATION;
  53405. timeout = animationTimeout;
  53406. propCount = animationDurations.length;
  53407. }
  53408. } else {
  53409. timeout = Math.max(transitionTimeout, animationTimeout);
  53410. type = timeout > 0
  53411. ? transitionTimeout > animationTimeout
  53412. ? TRANSITION
  53413. : ANIMATION
  53414. : null;
  53415. propCount = type
  53416. ? type === TRANSITION
  53417. ? transitionDurations.length
  53418. : animationDurations.length
  53419. : 0;
  53420. }
  53421. var hasTransform =
  53422. type === TRANSITION &&
  53423. transformRE.test(styles[transitionProp + 'Property']);
  53424. return {
  53425. type: type,
  53426. timeout: timeout,
  53427. propCount: propCount,
  53428. hasTransform: hasTransform
  53429. }
  53430. }
  53431. function getTimeout (delays, durations) {
  53432. /* istanbul ignore next */
  53433. while (delays.length < durations.length) {
  53434. delays = delays.concat(delays);
  53435. }
  53436. return Math.max.apply(null, durations.map(function (d, i) {
  53437. return toMs(d) + toMs(delays[i])
  53438. }))
  53439. }
  53440. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  53441. // in a locale-dependent way, using a comma instead of a dot.
  53442. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  53443. // as a floor function) causing unexpected behaviors
  53444. function toMs (s) {
  53445. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  53446. }
  53447. /* */
  53448. function enter (vnode, toggleDisplay) {
  53449. var el = vnode.elm;
  53450. // call leave callback now
  53451. if (isDef(el._leaveCb)) {
  53452. el._leaveCb.cancelled = true;
  53453. el._leaveCb();
  53454. }
  53455. var data = resolveTransition(vnode.data.transition);
  53456. if (isUndef(data)) {
  53457. return
  53458. }
  53459. /* istanbul ignore if */
  53460. if (isDef(el._enterCb) || el.nodeType !== 1) {
  53461. return
  53462. }
  53463. var css = data.css;
  53464. var type = data.type;
  53465. var enterClass = data.enterClass;
  53466. var enterToClass = data.enterToClass;
  53467. var enterActiveClass = data.enterActiveClass;
  53468. var appearClass = data.appearClass;
  53469. var appearToClass = data.appearToClass;
  53470. var appearActiveClass = data.appearActiveClass;
  53471. var beforeEnter = data.beforeEnter;
  53472. var enter = data.enter;
  53473. var afterEnter = data.afterEnter;
  53474. var enterCancelled = data.enterCancelled;
  53475. var beforeAppear = data.beforeAppear;
  53476. var appear = data.appear;
  53477. var afterAppear = data.afterAppear;
  53478. var appearCancelled = data.appearCancelled;
  53479. var duration = data.duration;
  53480. // activeInstance will always be the <transition> component managing this
  53481. // transition. One edge case to check is when the <transition> is placed
  53482. // as the root node of a child component. In that case we need to check
  53483. // <transition>'s parent for appear check.
  53484. var context = activeInstance;
  53485. var transitionNode = activeInstance.$vnode;
  53486. while (transitionNode && transitionNode.parent) {
  53487. context = transitionNode.context;
  53488. transitionNode = transitionNode.parent;
  53489. }
  53490. var isAppear = !context._isMounted || !vnode.isRootInsert;
  53491. if (isAppear && !appear && appear !== '') {
  53492. return
  53493. }
  53494. var startClass = isAppear && appearClass
  53495. ? appearClass
  53496. : enterClass;
  53497. var activeClass = isAppear && appearActiveClass
  53498. ? appearActiveClass
  53499. : enterActiveClass;
  53500. var toClass = isAppear && appearToClass
  53501. ? appearToClass
  53502. : enterToClass;
  53503. var beforeEnterHook = isAppear
  53504. ? (beforeAppear || beforeEnter)
  53505. : beforeEnter;
  53506. var enterHook = isAppear
  53507. ? (typeof appear === 'function' ? appear : enter)
  53508. : enter;
  53509. var afterEnterHook = isAppear
  53510. ? (afterAppear || afterEnter)
  53511. : afterEnter;
  53512. var enterCancelledHook = isAppear
  53513. ? (appearCancelled || enterCancelled)
  53514. : enterCancelled;
  53515. var explicitEnterDuration = toNumber(
  53516. isObject(duration)
  53517. ? duration.enter
  53518. : duration
  53519. );
  53520. if (explicitEnterDuration != null) {
  53521. checkDuration(explicitEnterDuration, 'enter', vnode);
  53522. }
  53523. var expectsCSS = css !== false && !isIE9;
  53524. var userWantsControl = getHookArgumentsLength(enterHook);
  53525. var cb = el._enterCb = once(function () {
  53526. if (expectsCSS) {
  53527. removeTransitionClass(el, toClass);
  53528. removeTransitionClass(el, activeClass);
  53529. }
  53530. if (cb.cancelled) {
  53531. if (expectsCSS) {
  53532. removeTransitionClass(el, startClass);
  53533. }
  53534. enterCancelledHook && enterCancelledHook(el);
  53535. } else {
  53536. afterEnterHook && afterEnterHook(el);
  53537. }
  53538. el._enterCb = null;
  53539. });
  53540. if (!vnode.data.show) {
  53541. // remove pending leave element on enter by injecting an insert hook
  53542. mergeVNodeHook(vnode, 'insert', function () {
  53543. var parent = el.parentNode;
  53544. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  53545. if (pendingNode &&
  53546. pendingNode.tag === vnode.tag &&
  53547. pendingNode.elm._leaveCb
  53548. ) {
  53549. pendingNode.elm._leaveCb();
  53550. }
  53551. enterHook && enterHook(el, cb);
  53552. });
  53553. }
  53554. // start enter transition
  53555. beforeEnterHook && beforeEnterHook(el);
  53556. if (expectsCSS) {
  53557. addTransitionClass(el, startClass);
  53558. addTransitionClass(el, activeClass);
  53559. nextFrame(function () {
  53560. removeTransitionClass(el, startClass);
  53561. if (!cb.cancelled) {
  53562. addTransitionClass(el, toClass);
  53563. if (!userWantsControl) {
  53564. if (isValidDuration(explicitEnterDuration)) {
  53565. setTimeout(cb, explicitEnterDuration);
  53566. } else {
  53567. whenTransitionEnds(el, type, cb);
  53568. }
  53569. }
  53570. }
  53571. });
  53572. }
  53573. if (vnode.data.show) {
  53574. toggleDisplay && toggleDisplay();
  53575. enterHook && enterHook(el, cb);
  53576. }
  53577. if (!expectsCSS && !userWantsControl) {
  53578. cb();
  53579. }
  53580. }
  53581. function leave (vnode, rm) {
  53582. var el = vnode.elm;
  53583. // call enter callback now
  53584. if (isDef(el._enterCb)) {
  53585. el._enterCb.cancelled = true;
  53586. el._enterCb();
  53587. }
  53588. var data = resolveTransition(vnode.data.transition);
  53589. if (isUndef(data) || el.nodeType !== 1) {
  53590. return rm()
  53591. }
  53592. /* istanbul ignore if */
  53593. if (isDef(el._leaveCb)) {
  53594. return
  53595. }
  53596. var css = data.css;
  53597. var type = data.type;
  53598. var leaveClass = data.leaveClass;
  53599. var leaveToClass = data.leaveToClass;
  53600. var leaveActiveClass = data.leaveActiveClass;
  53601. var beforeLeave = data.beforeLeave;
  53602. var leave = data.leave;
  53603. var afterLeave = data.afterLeave;
  53604. var leaveCancelled = data.leaveCancelled;
  53605. var delayLeave = data.delayLeave;
  53606. var duration = data.duration;
  53607. var expectsCSS = css !== false && !isIE9;
  53608. var userWantsControl = getHookArgumentsLength(leave);
  53609. var explicitLeaveDuration = toNumber(
  53610. isObject(duration)
  53611. ? duration.leave
  53612. : duration
  53613. );
  53614. if (isDef(explicitLeaveDuration)) {
  53615. checkDuration(explicitLeaveDuration, 'leave', vnode);
  53616. }
  53617. var cb = el._leaveCb = once(function () {
  53618. if (el.parentNode && el.parentNode._pending) {
  53619. el.parentNode._pending[vnode.key] = null;
  53620. }
  53621. if (expectsCSS) {
  53622. removeTransitionClass(el, leaveToClass);
  53623. removeTransitionClass(el, leaveActiveClass);
  53624. }
  53625. if (cb.cancelled) {
  53626. if (expectsCSS) {
  53627. removeTransitionClass(el, leaveClass);
  53628. }
  53629. leaveCancelled && leaveCancelled(el);
  53630. } else {
  53631. rm();
  53632. afterLeave && afterLeave(el);
  53633. }
  53634. el._leaveCb = null;
  53635. });
  53636. if (delayLeave) {
  53637. delayLeave(performLeave);
  53638. } else {
  53639. performLeave();
  53640. }
  53641. function performLeave () {
  53642. // the delayed leave may have already been cancelled
  53643. if (cb.cancelled) {
  53644. return
  53645. }
  53646. // record leaving element
  53647. if (!vnode.data.show && el.parentNode) {
  53648. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  53649. }
  53650. beforeLeave && beforeLeave(el);
  53651. if (expectsCSS) {
  53652. addTransitionClass(el, leaveClass);
  53653. addTransitionClass(el, leaveActiveClass);
  53654. nextFrame(function () {
  53655. removeTransitionClass(el, leaveClass);
  53656. if (!cb.cancelled) {
  53657. addTransitionClass(el, leaveToClass);
  53658. if (!userWantsControl) {
  53659. if (isValidDuration(explicitLeaveDuration)) {
  53660. setTimeout(cb, explicitLeaveDuration);
  53661. } else {
  53662. whenTransitionEnds(el, type, cb);
  53663. }
  53664. }
  53665. }
  53666. });
  53667. }
  53668. leave && leave(el, cb);
  53669. if (!expectsCSS && !userWantsControl) {
  53670. cb();
  53671. }
  53672. }
  53673. }
  53674. // only used in dev mode
  53675. function checkDuration (val, name, vnode) {
  53676. if (typeof val !== 'number') {
  53677. warn(
  53678. "<transition> explicit " + name + " duration is not a valid number - " +
  53679. "got " + (JSON.stringify(val)) + ".",
  53680. vnode.context
  53681. );
  53682. } else if (isNaN(val)) {
  53683. warn(
  53684. "<transition> explicit " + name + " duration is NaN - " +
  53685. 'the duration expression might be incorrect.',
  53686. vnode.context
  53687. );
  53688. }
  53689. }
  53690. function isValidDuration (val) {
  53691. return typeof val === 'number' && !isNaN(val)
  53692. }
  53693. /**
  53694. * Normalize a transition hook's argument length. The hook may be:
  53695. * - a merged hook (invoker) with the original in .fns
  53696. * - a wrapped component method (check ._length)
  53697. * - a plain function (.length)
  53698. */
  53699. function getHookArgumentsLength (fn) {
  53700. if (isUndef(fn)) {
  53701. return false
  53702. }
  53703. var invokerFns = fn.fns;
  53704. if (isDef(invokerFns)) {
  53705. // invoker
  53706. return getHookArgumentsLength(
  53707. Array.isArray(invokerFns)
  53708. ? invokerFns[0]
  53709. : invokerFns
  53710. )
  53711. } else {
  53712. return (fn._length || fn.length) > 1
  53713. }
  53714. }
  53715. function _enter (_, vnode) {
  53716. if (vnode.data.show !== true) {
  53717. enter(vnode);
  53718. }
  53719. }
  53720. var transition = inBrowser ? {
  53721. create: _enter,
  53722. activate: _enter,
  53723. remove: function remove$$1 (vnode, rm) {
  53724. /* istanbul ignore else */
  53725. if (vnode.data.show !== true) {
  53726. leave(vnode, rm);
  53727. } else {
  53728. rm();
  53729. }
  53730. }
  53731. } : {};
  53732. var platformModules = [
  53733. attrs,
  53734. klass,
  53735. events,
  53736. domProps,
  53737. style,
  53738. transition
  53739. ];
  53740. /* */
  53741. // the directive module should be applied last, after all
  53742. // built-in modules have been applied.
  53743. var modules = platformModules.concat(baseModules);
  53744. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  53745. /**
  53746. * Not type checking this file because flow doesn't like attaching
  53747. * properties to Elements.
  53748. */
  53749. /* istanbul ignore if */
  53750. if (isIE9) {
  53751. // http://www.matts411.com/post/internet-explorer-9-oninput/
  53752. document.addEventListener('selectionchange', function () {
  53753. var el = document.activeElement;
  53754. if (el && el.vmodel) {
  53755. trigger(el, 'input');
  53756. }
  53757. });
  53758. }
  53759. var directive = {
  53760. inserted: function inserted (el, binding, vnode, oldVnode) {
  53761. if (vnode.tag === 'select') {
  53762. // #6903
  53763. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  53764. mergeVNodeHook(vnode, 'postpatch', function () {
  53765. directive.componentUpdated(el, binding, vnode);
  53766. });
  53767. } else {
  53768. setSelected(el, binding, vnode.context);
  53769. }
  53770. el._vOptions = [].map.call(el.options, getValue);
  53771. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  53772. el._vModifiers = binding.modifiers;
  53773. if (!binding.modifiers.lazy) {
  53774. el.addEventListener('compositionstart', onCompositionStart);
  53775. el.addEventListener('compositionend', onCompositionEnd);
  53776. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  53777. // switching focus before confirming composition choice
  53778. // this also fixes the issue where some browsers e.g. iOS Chrome
  53779. // fires "change" instead of "input" on autocomplete.
  53780. el.addEventListener('change', onCompositionEnd);
  53781. /* istanbul ignore if */
  53782. if (isIE9) {
  53783. el.vmodel = true;
  53784. }
  53785. }
  53786. }
  53787. },
  53788. componentUpdated: function componentUpdated (el, binding, vnode) {
  53789. if (vnode.tag === 'select') {
  53790. setSelected(el, binding, vnode.context);
  53791. // in case the options rendered by v-for have changed,
  53792. // it's possible that the value is out-of-sync with the rendered options.
  53793. // detect such cases and filter out values that no longer has a matching
  53794. // option in the DOM.
  53795. var prevOptions = el._vOptions;
  53796. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  53797. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  53798. // trigger change event if
  53799. // no matching option found for at least one value
  53800. var needReset = el.multiple
  53801. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  53802. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  53803. if (needReset) {
  53804. trigger(el, 'change');
  53805. }
  53806. }
  53807. }
  53808. }
  53809. };
  53810. function setSelected (el, binding, vm) {
  53811. actuallySetSelected(el, binding, vm);
  53812. /* istanbul ignore if */
  53813. if (isIE || isEdge) {
  53814. setTimeout(function () {
  53815. actuallySetSelected(el, binding, vm);
  53816. }, 0);
  53817. }
  53818. }
  53819. function actuallySetSelected (el, binding, vm) {
  53820. var value = binding.value;
  53821. var isMultiple = el.multiple;
  53822. if (isMultiple && !Array.isArray(value)) {
  53823. warn(
  53824. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  53825. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  53826. vm
  53827. );
  53828. return
  53829. }
  53830. var selected, option;
  53831. for (var i = 0, l = el.options.length; i < l; i++) {
  53832. option = el.options[i];
  53833. if (isMultiple) {
  53834. selected = looseIndexOf(value, getValue(option)) > -1;
  53835. if (option.selected !== selected) {
  53836. option.selected = selected;
  53837. }
  53838. } else {
  53839. if (looseEqual(getValue(option), value)) {
  53840. if (el.selectedIndex !== i) {
  53841. el.selectedIndex = i;
  53842. }
  53843. return
  53844. }
  53845. }
  53846. }
  53847. if (!isMultiple) {
  53848. el.selectedIndex = -1;
  53849. }
  53850. }
  53851. function hasNoMatchingOption (value, options) {
  53852. return options.every(function (o) { return !looseEqual(o, value); })
  53853. }
  53854. function getValue (option) {
  53855. return '_value' in option
  53856. ? option._value
  53857. : option.value
  53858. }
  53859. function onCompositionStart (e) {
  53860. e.target.composing = true;
  53861. }
  53862. function onCompositionEnd (e) {
  53863. // prevent triggering an input event for no reason
  53864. if (!e.target.composing) { return }
  53865. e.target.composing = false;
  53866. trigger(e.target, 'input');
  53867. }
  53868. function trigger (el, type) {
  53869. var e = document.createEvent('HTMLEvents');
  53870. e.initEvent(type, true, true);
  53871. el.dispatchEvent(e);
  53872. }
  53873. /* */
  53874. // recursively search for possible transition defined inside the component root
  53875. function locateNode (vnode) {
  53876. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  53877. ? locateNode(vnode.componentInstance._vnode)
  53878. : vnode
  53879. }
  53880. var show = {
  53881. bind: function bind (el, ref, vnode) {
  53882. var value = ref.value;
  53883. vnode = locateNode(vnode);
  53884. var transition$$1 = vnode.data && vnode.data.transition;
  53885. var originalDisplay = el.__vOriginalDisplay =
  53886. el.style.display === 'none' ? '' : el.style.display;
  53887. if (value && transition$$1) {
  53888. vnode.data.show = true;
  53889. enter(vnode, function () {
  53890. el.style.display = originalDisplay;
  53891. });
  53892. } else {
  53893. el.style.display = value ? originalDisplay : 'none';
  53894. }
  53895. },
  53896. update: function update (el, ref, vnode) {
  53897. var value = ref.value;
  53898. var oldValue = ref.oldValue;
  53899. /* istanbul ignore if */
  53900. if (!value === !oldValue) { return }
  53901. vnode = locateNode(vnode);
  53902. var transition$$1 = vnode.data && vnode.data.transition;
  53903. if (transition$$1) {
  53904. vnode.data.show = true;
  53905. if (value) {
  53906. enter(vnode, function () {
  53907. el.style.display = el.__vOriginalDisplay;
  53908. });
  53909. } else {
  53910. leave(vnode, function () {
  53911. el.style.display = 'none';
  53912. });
  53913. }
  53914. } else {
  53915. el.style.display = value ? el.__vOriginalDisplay : 'none';
  53916. }
  53917. },
  53918. unbind: function unbind (
  53919. el,
  53920. binding,
  53921. vnode,
  53922. oldVnode,
  53923. isDestroy
  53924. ) {
  53925. if (!isDestroy) {
  53926. el.style.display = el.__vOriginalDisplay;
  53927. }
  53928. }
  53929. };
  53930. var platformDirectives = {
  53931. model: directive,
  53932. show: show
  53933. };
  53934. /* */
  53935. var transitionProps = {
  53936. name: String,
  53937. appear: Boolean,
  53938. css: Boolean,
  53939. mode: String,
  53940. type: String,
  53941. enterClass: String,
  53942. leaveClass: String,
  53943. enterToClass: String,
  53944. leaveToClass: String,
  53945. enterActiveClass: String,
  53946. leaveActiveClass: String,
  53947. appearClass: String,
  53948. appearActiveClass: String,
  53949. appearToClass: String,
  53950. duration: [Number, String, Object]
  53951. };
  53952. // in case the child is also an abstract component, e.g. <keep-alive>
  53953. // we want to recursively retrieve the real component to be rendered
  53954. function getRealChild (vnode) {
  53955. var compOptions = vnode && vnode.componentOptions;
  53956. if (compOptions && compOptions.Ctor.options.abstract) {
  53957. return getRealChild(getFirstComponentChild(compOptions.children))
  53958. } else {
  53959. return vnode
  53960. }
  53961. }
  53962. function extractTransitionData (comp) {
  53963. var data = {};
  53964. var options = comp.$options;
  53965. // props
  53966. for (var key in options.propsData) {
  53967. data[key] = comp[key];
  53968. }
  53969. // events.
  53970. // extract listeners and pass them directly to the transition methods
  53971. var listeners = options._parentListeners;
  53972. for (var key$1 in listeners) {
  53973. data[camelize(key$1)] = listeners[key$1];
  53974. }
  53975. return data
  53976. }
  53977. function placeholder (h, rawChild) {
  53978. if (/\d-keep-alive$/.test(rawChild.tag)) {
  53979. return h('keep-alive', {
  53980. props: rawChild.componentOptions.propsData
  53981. })
  53982. }
  53983. }
  53984. function hasParentTransition (vnode) {
  53985. while ((vnode = vnode.parent)) {
  53986. if (vnode.data.transition) {
  53987. return true
  53988. }
  53989. }
  53990. }
  53991. function isSameChild (child, oldChild) {
  53992. return oldChild.key === child.key && oldChild.tag === child.tag
  53993. }
  53994. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  53995. var isVShowDirective = function (d) { return d.name === 'show'; };
  53996. var Transition = {
  53997. name: 'transition',
  53998. props: transitionProps,
  53999. abstract: true,
  54000. render: function render (h) {
  54001. var this$1 = this;
  54002. var children = this.$slots.default;
  54003. if (!children) {
  54004. return
  54005. }
  54006. // filter out text nodes (possible whitespaces)
  54007. children = children.filter(isNotTextNode);
  54008. /* istanbul ignore if */
  54009. if (!children.length) {
  54010. return
  54011. }
  54012. // warn multiple elements
  54013. if (children.length > 1) {
  54014. warn(
  54015. '<transition> can only be used on a single element. Use ' +
  54016. '<transition-group> for lists.',
  54017. this.$parent
  54018. );
  54019. }
  54020. var mode = this.mode;
  54021. // warn invalid mode
  54022. if (mode && mode !== 'in-out' && mode !== 'out-in'
  54023. ) {
  54024. warn(
  54025. 'invalid <transition> mode: ' + mode,
  54026. this.$parent
  54027. );
  54028. }
  54029. var rawChild = children[0];
  54030. // if this is a component root node and the component's
  54031. // parent container node also has transition, skip.
  54032. if (hasParentTransition(this.$vnode)) {
  54033. return rawChild
  54034. }
  54035. // apply transition data to child
  54036. // use getRealChild() to ignore abstract components e.g. keep-alive
  54037. var child = getRealChild(rawChild);
  54038. /* istanbul ignore if */
  54039. if (!child) {
  54040. return rawChild
  54041. }
  54042. if (this._leaving) {
  54043. return placeholder(h, rawChild)
  54044. }
  54045. // ensure a key that is unique to the vnode type and to this transition
  54046. // component instance. This key will be used to remove pending leaving nodes
  54047. // during entering.
  54048. var id = "__transition-" + (this._uid) + "-";
  54049. child.key = child.key == null
  54050. ? child.isComment
  54051. ? id + 'comment'
  54052. : id + child.tag
  54053. : isPrimitive(child.key)
  54054. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  54055. : child.key;
  54056. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  54057. var oldRawChild = this._vnode;
  54058. var oldChild = getRealChild(oldRawChild);
  54059. // mark v-show
  54060. // so that the transition module can hand over the control to the directive
  54061. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  54062. child.data.show = true;
  54063. }
  54064. if (
  54065. oldChild &&
  54066. oldChild.data &&
  54067. !isSameChild(child, oldChild) &&
  54068. !isAsyncPlaceholder(oldChild) &&
  54069. // #6687 component root is a comment node
  54070. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  54071. ) {
  54072. // replace old child transition data with fresh one
  54073. // important for dynamic transitions!
  54074. var oldData = oldChild.data.transition = extend({}, data);
  54075. // handle transition mode
  54076. if (mode === 'out-in') {
  54077. // return placeholder node and queue update when leave finishes
  54078. this._leaving = true;
  54079. mergeVNodeHook(oldData, 'afterLeave', function () {
  54080. this$1._leaving = false;
  54081. this$1.$forceUpdate();
  54082. });
  54083. return placeholder(h, rawChild)
  54084. } else if (mode === 'in-out') {
  54085. if (isAsyncPlaceholder(child)) {
  54086. return oldRawChild
  54087. }
  54088. var delayedLeave;
  54089. var performLeave = function () { delayedLeave(); };
  54090. mergeVNodeHook(data, 'afterEnter', performLeave);
  54091. mergeVNodeHook(data, 'enterCancelled', performLeave);
  54092. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  54093. }
  54094. }
  54095. return rawChild
  54096. }
  54097. };
  54098. /* */
  54099. var props = extend({
  54100. tag: String,
  54101. moveClass: String
  54102. }, transitionProps);
  54103. delete props.mode;
  54104. var TransitionGroup = {
  54105. props: props,
  54106. beforeMount: function beforeMount () {
  54107. var this$1 = this;
  54108. var update = this._update;
  54109. this._update = function (vnode, hydrating) {
  54110. var restoreActiveInstance = setActiveInstance(this$1);
  54111. // force removing pass
  54112. this$1.__patch__(
  54113. this$1._vnode,
  54114. this$1.kept,
  54115. false, // hydrating
  54116. true // removeOnly (!important, avoids unnecessary moves)
  54117. );
  54118. this$1._vnode = this$1.kept;
  54119. restoreActiveInstance();
  54120. update.call(this$1, vnode, hydrating);
  54121. };
  54122. },
  54123. render: function render (h) {
  54124. var tag = this.tag || this.$vnode.data.tag || 'span';
  54125. var map = Object.create(null);
  54126. var prevChildren = this.prevChildren = this.children;
  54127. var rawChildren = this.$slots.default || [];
  54128. var children = this.children = [];
  54129. var transitionData = extractTransitionData(this);
  54130. for (var i = 0; i < rawChildren.length; i++) {
  54131. var c = rawChildren[i];
  54132. if (c.tag) {
  54133. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  54134. children.push(c);
  54135. map[c.key] = c
  54136. ;(c.data || (c.data = {})).transition = transitionData;
  54137. } else {
  54138. var opts = c.componentOptions;
  54139. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  54140. warn(("<transition-group> children must be keyed: <" + name + ">"));
  54141. }
  54142. }
  54143. }
  54144. if (prevChildren) {
  54145. var kept = [];
  54146. var removed = [];
  54147. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  54148. var c$1 = prevChildren[i$1];
  54149. c$1.data.transition = transitionData;
  54150. c$1.data.pos = c$1.elm.getBoundingClientRect();
  54151. if (map[c$1.key]) {
  54152. kept.push(c$1);
  54153. } else {
  54154. removed.push(c$1);
  54155. }
  54156. }
  54157. this.kept = h(tag, null, kept);
  54158. this.removed = removed;
  54159. }
  54160. return h(tag, null, children)
  54161. },
  54162. updated: function updated () {
  54163. var children = this.prevChildren;
  54164. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  54165. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  54166. return
  54167. }
  54168. // we divide the work into three loops to avoid mixing DOM reads and writes
  54169. // in each iteration - which helps prevent layout thrashing.
  54170. children.forEach(callPendingCbs);
  54171. children.forEach(recordPosition);
  54172. children.forEach(applyTranslation);
  54173. // force reflow to put everything in position
  54174. // assign to this to avoid being removed in tree-shaking
  54175. // $flow-disable-line
  54176. this._reflow = document.body.offsetHeight;
  54177. children.forEach(function (c) {
  54178. if (c.data.moved) {
  54179. var el = c.elm;
  54180. var s = el.style;
  54181. addTransitionClass(el, moveClass);
  54182. s.transform = s.WebkitTransform = s.transitionDuration = '';
  54183. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  54184. if (e && e.target !== el) {
  54185. return
  54186. }
  54187. if (!e || /transform$/.test(e.propertyName)) {
  54188. el.removeEventListener(transitionEndEvent, cb);
  54189. el._moveCb = null;
  54190. removeTransitionClass(el, moveClass);
  54191. }
  54192. });
  54193. }
  54194. });
  54195. },
  54196. methods: {
  54197. hasMove: function hasMove (el, moveClass) {
  54198. /* istanbul ignore if */
  54199. if (!hasTransition) {
  54200. return false
  54201. }
  54202. /* istanbul ignore if */
  54203. if (this._hasMove) {
  54204. return this._hasMove
  54205. }
  54206. // Detect whether an element with the move class applied has
  54207. // CSS transitions. Since the element may be inside an entering
  54208. // transition at this very moment, we make a clone of it and remove
  54209. // all other transition classes applied to ensure only the move class
  54210. // is applied.
  54211. var clone = el.cloneNode();
  54212. if (el._transitionClasses) {
  54213. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  54214. }
  54215. addClass(clone, moveClass);
  54216. clone.style.display = 'none';
  54217. this.$el.appendChild(clone);
  54218. var info = getTransitionInfo(clone);
  54219. this.$el.removeChild(clone);
  54220. return (this._hasMove = info.hasTransform)
  54221. }
  54222. }
  54223. };
  54224. function callPendingCbs (c) {
  54225. /* istanbul ignore if */
  54226. if (c.elm._moveCb) {
  54227. c.elm._moveCb();
  54228. }
  54229. /* istanbul ignore if */
  54230. if (c.elm._enterCb) {
  54231. c.elm._enterCb();
  54232. }
  54233. }
  54234. function recordPosition (c) {
  54235. c.data.newPos = c.elm.getBoundingClientRect();
  54236. }
  54237. function applyTranslation (c) {
  54238. var oldPos = c.data.pos;
  54239. var newPos = c.data.newPos;
  54240. var dx = oldPos.left - newPos.left;
  54241. var dy = oldPos.top - newPos.top;
  54242. if (dx || dy) {
  54243. c.data.moved = true;
  54244. var s = c.elm.style;
  54245. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  54246. s.transitionDuration = '0s';
  54247. }
  54248. }
  54249. var platformComponents = {
  54250. Transition: Transition,
  54251. TransitionGroup: TransitionGroup
  54252. };
  54253. /* */
  54254. // install platform specific utils
  54255. Vue.config.mustUseProp = mustUseProp;
  54256. Vue.config.isReservedTag = isReservedTag;
  54257. Vue.config.isReservedAttr = isReservedAttr;
  54258. Vue.config.getTagNamespace = getTagNamespace;
  54259. Vue.config.isUnknownElement = isUnknownElement;
  54260. // install platform runtime directives & components
  54261. extend(Vue.options.directives, platformDirectives);
  54262. extend(Vue.options.components, platformComponents);
  54263. // install platform patch function
  54264. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  54265. // public mount method
  54266. Vue.prototype.$mount = function (
  54267. el,
  54268. hydrating
  54269. ) {
  54270. el = el && inBrowser ? query(el) : undefined;
  54271. return mountComponent(this, el, hydrating)
  54272. };
  54273. // devtools global hook
  54274. /* istanbul ignore next */
  54275. if (inBrowser) {
  54276. setTimeout(function () {
  54277. if (config.devtools) {
  54278. if (devtools) {
  54279. devtools.emit('init', Vue);
  54280. } else {
  54281. console[console.info ? 'info' : 'log'](
  54282. 'Download the Vue Devtools extension for a better development experience:\n' +
  54283. 'https://github.com/vuejs/vue-devtools'
  54284. );
  54285. }
  54286. }
  54287. if (config.productionTip !== false &&
  54288. typeof console !== 'undefined'
  54289. ) {
  54290. console[console.info ? 'info' : 'log'](
  54291. "You are running Vue in development mode.\n" +
  54292. "Make sure to turn on production mode when deploying for production.\n" +
  54293. "See more tips at https://vuejs.org/guide/deployment.html"
  54294. );
  54295. }
  54296. }, 0);
  54297. }
  54298. /* */
  54299. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  54300. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  54301. var buildRegex = cached(function (delimiters) {
  54302. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  54303. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  54304. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  54305. });
  54306. function parseText (
  54307. text,
  54308. delimiters
  54309. ) {
  54310. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  54311. if (!tagRE.test(text)) {
  54312. return
  54313. }
  54314. var tokens = [];
  54315. var rawTokens = [];
  54316. var lastIndex = tagRE.lastIndex = 0;
  54317. var match, index, tokenValue;
  54318. while ((match = tagRE.exec(text))) {
  54319. index = match.index;
  54320. // push text token
  54321. if (index > lastIndex) {
  54322. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  54323. tokens.push(JSON.stringify(tokenValue));
  54324. }
  54325. // tag token
  54326. var exp = parseFilters(match[1].trim());
  54327. tokens.push(("_s(" + exp + ")"));
  54328. rawTokens.push({ '@binding': exp });
  54329. lastIndex = index + match[0].length;
  54330. }
  54331. if (lastIndex < text.length) {
  54332. rawTokens.push(tokenValue = text.slice(lastIndex));
  54333. tokens.push(JSON.stringify(tokenValue));
  54334. }
  54335. return {
  54336. expression: tokens.join('+'),
  54337. tokens: rawTokens
  54338. }
  54339. }
  54340. /* */
  54341. function transformNode (el, options) {
  54342. var warn = options.warn || baseWarn;
  54343. var staticClass = getAndRemoveAttr(el, 'class');
  54344. if (staticClass) {
  54345. var res = parseText(staticClass, options.delimiters);
  54346. if (res) {
  54347. warn(
  54348. "class=\"" + staticClass + "\": " +
  54349. 'Interpolation inside attributes has been removed. ' +
  54350. 'Use v-bind or the colon shorthand instead. For example, ' +
  54351. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  54352. el.rawAttrsMap['class']
  54353. );
  54354. }
  54355. }
  54356. if (staticClass) {
  54357. el.staticClass = JSON.stringify(staticClass);
  54358. }
  54359. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  54360. if (classBinding) {
  54361. el.classBinding = classBinding;
  54362. }
  54363. }
  54364. function genData (el) {
  54365. var data = '';
  54366. if (el.staticClass) {
  54367. data += "staticClass:" + (el.staticClass) + ",";
  54368. }
  54369. if (el.classBinding) {
  54370. data += "class:" + (el.classBinding) + ",";
  54371. }
  54372. return data
  54373. }
  54374. var klass$1 = {
  54375. staticKeys: ['staticClass'],
  54376. transformNode: transformNode,
  54377. genData: genData
  54378. };
  54379. /* */
  54380. function transformNode$1 (el, options) {
  54381. var warn = options.warn || baseWarn;
  54382. var staticStyle = getAndRemoveAttr(el, 'style');
  54383. if (staticStyle) {
  54384. /* istanbul ignore if */
  54385. {
  54386. var res = parseText(staticStyle, options.delimiters);
  54387. if (res) {
  54388. warn(
  54389. "style=\"" + staticStyle + "\": " +
  54390. 'Interpolation inside attributes has been removed. ' +
  54391. 'Use v-bind or the colon shorthand instead. For example, ' +
  54392. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  54393. el.rawAttrsMap['style']
  54394. );
  54395. }
  54396. }
  54397. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  54398. }
  54399. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  54400. if (styleBinding) {
  54401. el.styleBinding = styleBinding;
  54402. }
  54403. }
  54404. function genData$1 (el) {
  54405. var data = '';
  54406. if (el.staticStyle) {
  54407. data += "staticStyle:" + (el.staticStyle) + ",";
  54408. }
  54409. if (el.styleBinding) {
  54410. data += "style:(" + (el.styleBinding) + "),";
  54411. }
  54412. return data
  54413. }
  54414. var style$1 = {
  54415. staticKeys: ['staticStyle'],
  54416. transformNode: transformNode$1,
  54417. genData: genData$1
  54418. };
  54419. /* */
  54420. var decoder;
  54421. var he = {
  54422. decode: function decode (html) {
  54423. decoder = decoder || document.createElement('div');
  54424. decoder.innerHTML = html;
  54425. return decoder.textContent
  54426. }
  54427. };
  54428. /* */
  54429. var isUnaryTag = makeMap(
  54430. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  54431. 'link,meta,param,source,track,wbr'
  54432. );
  54433. // Elements that you can, intentionally, leave open
  54434. // (and which close themselves)
  54435. var canBeLeftOpenTag = makeMap(
  54436. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  54437. );
  54438. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  54439. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  54440. var isNonPhrasingTag = makeMap(
  54441. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  54442. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  54443. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  54444. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  54445. 'title,tr,track'
  54446. );
  54447. /**
  54448. * Not type-checking this file because it's mostly vendor code.
  54449. */
  54450. // Regular Expressions for parsing tags and attributes
  54451. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  54452. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  54453. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  54454. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  54455. var startTagOpen = new RegExp(("^<" + qnameCapture));
  54456. var startTagClose = /^\s*(\/?)>/;
  54457. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  54458. var doctype = /^<!DOCTYPE [^>]+>/i;
  54459. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  54460. var comment = /^<!\--/;
  54461. var conditionalComment = /^<!\[/;
  54462. // Special Elements (can contain anything)
  54463. var isPlainTextElement = makeMap('script,style,textarea', true);
  54464. var reCache = {};
  54465. var decodingMap = {
  54466. '&lt;': '<',
  54467. '&gt;': '>',
  54468. '&quot;': '"',
  54469. '&amp;': '&',
  54470. '&#10;': '\n',
  54471. '&#9;': '\t',
  54472. '&#39;': "'"
  54473. };
  54474. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  54475. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  54476. // #5992
  54477. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  54478. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  54479. function decodeAttr (value, shouldDecodeNewlines) {
  54480. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  54481. return value.replace(re, function (match) { return decodingMap[match]; })
  54482. }
  54483. function parseHTML (html, options) {
  54484. var stack = [];
  54485. var expectHTML = options.expectHTML;
  54486. var isUnaryTag$$1 = options.isUnaryTag || no;
  54487. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  54488. var index = 0;
  54489. var last, lastTag;
  54490. while (html) {
  54491. last = html;
  54492. // Make sure we're not in a plaintext content element like script/style
  54493. if (!lastTag || !isPlainTextElement(lastTag)) {
  54494. var textEnd = html.indexOf('<');
  54495. if (textEnd === 0) {
  54496. // Comment:
  54497. if (comment.test(html)) {
  54498. var commentEnd = html.indexOf('-->');
  54499. if (commentEnd >= 0) {
  54500. if (options.shouldKeepComment) {
  54501. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  54502. }
  54503. advance(commentEnd + 3);
  54504. continue
  54505. }
  54506. }
  54507. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  54508. if (conditionalComment.test(html)) {
  54509. var conditionalEnd = html.indexOf(']>');
  54510. if (conditionalEnd >= 0) {
  54511. advance(conditionalEnd + 2);
  54512. continue
  54513. }
  54514. }
  54515. // Doctype:
  54516. var doctypeMatch = html.match(doctype);
  54517. if (doctypeMatch) {
  54518. advance(doctypeMatch[0].length);
  54519. continue
  54520. }
  54521. // End tag:
  54522. var endTagMatch = html.match(endTag);
  54523. if (endTagMatch) {
  54524. var curIndex = index;
  54525. advance(endTagMatch[0].length);
  54526. parseEndTag(endTagMatch[1], curIndex, index);
  54527. continue
  54528. }
  54529. // Start tag:
  54530. var startTagMatch = parseStartTag();
  54531. if (startTagMatch) {
  54532. handleStartTag(startTagMatch);
  54533. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  54534. advance(1);
  54535. }
  54536. continue
  54537. }
  54538. }
  54539. var text = (void 0), rest = (void 0), next = (void 0);
  54540. if (textEnd >= 0) {
  54541. rest = html.slice(textEnd);
  54542. while (
  54543. !endTag.test(rest) &&
  54544. !startTagOpen.test(rest) &&
  54545. !comment.test(rest) &&
  54546. !conditionalComment.test(rest)
  54547. ) {
  54548. // < in plain text, be forgiving and treat it as text
  54549. next = rest.indexOf('<', 1);
  54550. if (next < 0) { break }
  54551. textEnd += next;
  54552. rest = html.slice(textEnd);
  54553. }
  54554. text = html.substring(0, textEnd);
  54555. }
  54556. if (textEnd < 0) {
  54557. text = html;
  54558. }
  54559. if (text) {
  54560. advance(text.length);
  54561. }
  54562. if (options.chars && text) {
  54563. options.chars(text, index - text.length, index);
  54564. }
  54565. } else {
  54566. var endTagLength = 0;
  54567. var stackedTag = lastTag.toLowerCase();
  54568. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  54569. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  54570. endTagLength = endTag.length;
  54571. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  54572. text = text
  54573. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  54574. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  54575. }
  54576. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  54577. text = text.slice(1);
  54578. }
  54579. if (options.chars) {
  54580. options.chars(text);
  54581. }
  54582. return ''
  54583. });
  54584. index += html.length - rest$1.length;
  54585. html = rest$1;
  54586. parseEndTag(stackedTag, index - endTagLength, index);
  54587. }
  54588. if (html === last) {
  54589. options.chars && options.chars(html);
  54590. if (!stack.length && options.warn) {
  54591. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  54592. }
  54593. break
  54594. }
  54595. }
  54596. // Clean up any remaining tags
  54597. parseEndTag();
  54598. function advance (n) {
  54599. index += n;
  54600. html = html.substring(n);
  54601. }
  54602. function parseStartTag () {
  54603. var start = html.match(startTagOpen);
  54604. if (start) {
  54605. var match = {
  54606. tagName: start[1],
  54607. attrs: [],
  54608. start: index
  54609. };
  54610. advance(start[0].length);
  54611. var end, attr;
  54612. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  54613. attr.start = index;
  54614. advance(attr[0].length);
  54615. attr.end = index;
  54616. match.attrs.push(attr);
  54617. }
  54618. if (end) {
  54619. match.unarySlash = end[1];
  54620. advance(end[0].length);
  54621. match.end = index;
  54622. return match
  54623. }
  54624. }
  54625. }
  54626. function handleStartTag (match) {
  54627. var tagName = match.tagName;
  54628. var unarySlash = match.unarySlash;
  54629. if (expectHTML) {
  54630. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  54631. parseEndTag(lastTag);
  54632. }
  54633. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  54634. parseEndTag(tagName);
  54635. }
  54636. }
  54637. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  54638. var l = match.attrs.length;
  54639. var attrs = new Array(l);
  54640. for (var i = 0; i < l; i++) {
  54641. var args = match.attrs[i];
  54642. var value = args[3] || args[4] || args[5] || '';
  54643. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  54644. ? options.shouldDecodeNewlinesForHref
  54645. : options.shouldDecodeNewlines;
  54646. attrs[i] = {
  54647. name: args[1],
  54648. value: decodeAttr(value, shouldDecodeNewlines)
  54649. };
  54650. if (options.outputSourceRange) {
  54651. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  54652. attrs[i].end = args.end;
  54653. }
  54654. }
  54655. if (!unary) {
  54656. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  54657. lastTag = tagName;
  54658. }
  54659. if (options.start) {
  54660. options.start(tagName, attrs, unary, match.start, match.end);
  54661. }
  54662. }
  54663. function parseEndTag (tagName, start, end) {
  54664. var pos, lowerCasedTagName;
  54665. if (start == null) { start = index; }
  54666. if (end == null) { end = index; }
  54667. // Find the closest opened tag of the same type
  54668. if (tagName) {
  54669. lowerCasedTagName = tagName.toLowerCase();
  54670. for (pos = stack.length - 1; pos >= 0; pos--) {
  54671. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  54672. break
  54673. }
  54674. }
  54675. } else {
  54676. // If no tag name is provided, clean shop
  54677. pos = 0;
  54678. }
  54679. if (pos >= 0) {
  54680. // Close all the open elements, up the stack
  54681. for (var i = stack.length - 1; i >= pos; i--) {
  54682. if (i > pos || !tagName &&
  54683. options.warn
  54684. ) {
  54685. options.warn(
  54686. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  54687. { start: stack[i].start, end: stack[i].end }
  54688. );
  54689. }
  54690. if (options.end) {
  54691. options.end(stack[i].tag, start, end);
  54692. }
  54693. }
  54694. // Remove the open elements from the stack
  54695. stack.length = pos;
  54696. lastTag = pos && stack[pos - 1].tag;
  54697. } else if (lowerCasedTagName === 'br') {
  54698. if (options.start) {
  54699. options.start(tagName, [], true, start, end);
  54700. }
  54701. } else if (lowerCasedTagName === 'p') {
  54702. if (options.start) {
  54703. options.start(tagName, [], false, start, end);
  54704. }
  54705. if (options.end) {
  54706. options.end(tagName, start, end);
  54707. }
  54708. }
  54709. }
  54710. }
  54711. /* */
  54712. var onRE = /^@|^v-on:/;
  54713. var dirRE = /^v-|^@|^:|^#/;
  54714. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  54715. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  54716. var stripParensRE = /^\(|\)$/g;
  54717. var dynamicArgRE = /^\[.*\]$/;
  54718. var argRE = /:(.*)$/;
  54719. var bindRE = /^:|^\.|^v-bind:/;
  54720. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  54721. var slotRE = /^v-slot(:|$)|^#/;
  54722. var lineBreakRE = /[\r\n]/;
  54723. var whitespaceRE$1 = /\s+/g;
  54724. var invalidAttributeRE = /[\s"'<>\/=]/;
  54725. var decodeHTMLCached = cached(he.decode);
  54726. var emptySlotScopeToken = "_empty_";
  54727. // configurable state
  54728. var warn$2;
  54729. var delimiters;
  54730. var transforms;
  54731. var preTransforms;
  54732. var postTransforms;
  54733. var platformIsPreTag;
  54734. var platformMustUseProp;
  54735. var platformGetTagNamespace;
  54736. var maybeComponent;
  54737. function createASTElement (
  54738. tag,
  54739. attrs,
  54740. parent
  54741. ) {
  54742. return {
  54743. type: 1,
  54744. tag: tag,
  54745. attrsList: attrs,
  54746. attrsMap: makeAttrsMap(attrs),
  54747. rawAttrsMap: {},
  54748. parent: parent,
  54749. children: []
  54750. }
  54751. }
  54752. /**
  54753. * Convert HTML string to AST.
  54754. */
  54755. function parse (
  54756. template,
  54757. options
  54758. ) {
  54759. warn$2 = options.warn || baseWarn;
  54760. platformIsPreTag = options.isPreTag || no;
  54761. platformMustUseProp = options.mustUseProp || no;
  54762. platformGetTagNamespace = options.getTagNamespace || no;
  54763. var isReservedTag = options.isReservedTag || no;
  54764. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54765. transforms = pluckModuleFunction(options.modules, 'transformNode');
  54766. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  54767. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  54768. delimiters = options.delimiters;
  54769. var stack = [];
  54770. var preserveWhitespace = options.preserveWhitespace !== false;
  54771. var whitespaceOption = options.whitespace;
  54772. var root;
  54773. var currentParent;
  54774. var inVPre = false;
  54775. var inPre = false;
  54776. var warned = false;
  54777. function warnOnce (msg, range) {
  54778. if (!warned) {
  54779. warned = true;
  54780. warn$2(msg, range);
  54781. }
  54782. }
  54783. function closeElement (element) {
  54784. trimEndingWhitespace(element);
  54785. if (!inVPre && !element.processed) {
  54786. element = processElement(element, options);
  54787. }
  54788. // tree management
  54789. if (!stack.length && element !== root) {
  54790. // allow root elements with v-if, v-else-if and v-else
  54791. if (root.if && (element.elseif || element.else)) {
  54792. {
  54793. checkRootConstraints(element);
  54794. }
  54795. addIfCondition(root, {
  54796. exp: element.elseif,
  54797. block: element
  54798. });
  54799. } else {
  54800. warnOnce(
  54801. "Component template should contain exactly one root element. " +
  54802. "If you are using v-if on multiple elements, " +
  54803. "use v-else-if to chain them instead.",
  54804. { start: element.start }
  54805. );
  54806. }
  54807. }
  54808. if (currentParent && !element.forbidden) {
  54809. if (element.elseif || element.else) {
  54810. processIfConditions(element, currentParent);
  54811. } else {
  54812. if (element.slotScope) {
  54813. // scoped slot
  54814. // keep it in the children list so that v-else(-if) conditions can
  54815. // find it as the prev node.
  54816. var name = element.slotTarget || '"default"'
  54817. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  54818. }
  54819. currentParent.children.push(element);
  54820. element.parent = currentParent;
  54821. }
  54822. }
  54823. // final children cleanup
  54824. // filter out scoped slots
  54825. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  54826. // remove trailing whitespace node again
  54827. trimEndingWhitespace(element);
  54828. // check pre state
  54829. if (element.pre) {
  54830. inVPre = false;
  54831. }
  54832. if (platformIsPreTag(element.tag)) {
  54833. inPre = false;
  54834. }
  54835. // apply post-transforms
  54836. for (var i = 0; i < postTransforms.length; i++) {
  54837. postTransforms[i](element, options);
  54838. }
  54839. }
  54840. function trimEndingWhitespace (el) {
  54841. // remove trailing whitespace node
  54842. if (!inPre) {
  54843. var lastNode;
  54844. while (
  54845. (lastNode = el.children[el.children.length - 1]) &&
  54846. lastNode.type === 3 &&
  54847. lastNode.text === ' '
  54848. ) {
  54849. el.children.pop();
  54850. }
  54851. }
  54852. }
  54853. function checkRootConstraints (el) {
  54854. if (el.tag === 'slot' || el.tag === 'template') {
  54855. warnOnce(
  54856. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  54857. 'contain multiple nodes.',
  54858. { start: el.start }
  54859. );
  54860. }
  54861. if (el.attrsMap.hasOwnProperty('v-for')) {
  54862. warnOnce(
  54863. 'Cannot use v-for on stateful component root element because ' +
  54864. 'it renders multiple elements.',
  54865. el.rawAttrsMap['v-for']
  54866. );
  54867. }
  54868. }
  54869. parseHTML(template, {
  54870. warn: warn$2,
  54871. expectHTML: options.expectHTML,
  54872. isUnaryTag: options.isUnaryTag,
  54873. canBeLeftOpenTag: options.canBeLeftOpenTag,
  54874. shouldDecodeNewlines: options.shouldDecodeNewlines,
  54875. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  54876. shouldKeepComment: options.comments,
  54877. outputSourceRange: options.outputSourceRange,
  54878. start: function start (tag, attrs, unary, start$1, end) {
  54879. // check namespace.
  54880. // inherit parent ns if there is one
  54881. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  54882. // handle IE svg bug
  54883. /* istanbul ignore if */
  54884. if (isIE && ns === 'svg') {
  54885. attrs = guardIESVGBug(attrs);
  54886. }
  54887. var element = createASTElement(tag, attrs, currentParent);
  54888. if (ns) {
  54889. element.ns = ns;
  54890. }
  54891. {
  54892. if (options.outputSourceRange) {
  54893. element.start = start$1;
  54894. element.end = end;
  54895. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  54896. cumulated[attr.name] = attr;
  54897. return cumulated
  54898. }, {});
  54899. }
  54900. attrs.forEach(function (attr) {
  54901. if (invalidAttributeRE.test(attr.name)) {
  54902. warn$2(
  54903. "Invalid dynamic argument expression: attribute names cannot contain " +
  54904. "spaces, quotes, <, >, / or =.",
  54905. {
  54906. start: attr.start + attr.name.indexOf("["),
  54907. end: attr.start + attr.name.length
  54908. }
  54909. );
  54910. }
  54911. });
  54912. }
  54913. if (isForbiddenTag(element) && !isServerRendering()) {
  54914. element.forbidden = true;
  54915. warn$2(
  54916. 'Templates should only be responsible for mapping the state to the ' +
  54917. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  54918. "<" + tag + ">" + ', as they will not be parsed.',
  54919. { start: element.start }
  54920. );
  54921. }
  54922. // apply pre-transforms
  54923. for (var i = 0; i < preTransforms.length; i++) {
  54924. element = preTransforms[i](element, options) || element;
  54925. }
  54926. if (!inVPre) {
  54927. processPre(element);
  54928. if (element.pre) {
  54929. inVPre = true;
  54930. }
  54931. }
  54932. if (platformIsPreTag(element.tag)) {
  54933. inPre = true;
  54934. }
  54935. if (inVPre) {
  54936. processRawAttrs(element);
  54937. } else if (!element.processed) {
  54938. // structural directives
  54939. processFor(element);
  54940. processIf(element);
  54941. processOnce(element);
  54942. }
  54943. if (!root) {
  54944. root = element;
  54945. {
  54946. checkRootConstraints(root);
  54947. }
  54948. }
  54949. if (!unary) {
  54950. currentParent = element;
  54951. stack.push(element);
  54952. } else {
  54953. closeElement(element);
  54954. }
  54955. },
  54956. end: function end (tag, start, end$1) {
  54957. var element = stack[stack.length - 1];
  54958. // pop stack
  54959. stack.length -= 1;
  54960. currentParent = stack[stack.length - 1];
  54961. if (options.outputSourceRange) {
  54962. element.end = end$1;
  54963. }
  54964. closeElement(element);
  54965. },
  54966. chars: function chars (text, start, end) {
  54967. if (!currentParent) {
  54968. {
  54969. if (text === template) {
  54970. warnOnce(
  54971. 'Component template requires a root element, rather than just text.',
  54972. { start: start }
  54973. );
  54974. } else if ((text = text.trim())) {
  54975. warnOnce(
  54976. ("text \"" + text + "\" outside root element will be ignored."),
  54977. { start: start }
  54978. );
  54979. }
  54980. }
  54981. return
  54982. }
  54983. // IE textarea placeholder bug
  54984. /* istanbul ignore if */
  54985. if (isIE &&
  54986. currentParent.tag === 'textarea' &&
  54987. currentParent.attrsMap.placeholder === text
  54988. ) {
  54989. return
  54990. }
  54991. var children = currentParent.children;
  54992. if (inPre || text.trim()) {
  54993. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  54994. } else if (!children.length) {
  54995. // remove the whitespace-only node right after an opening tag
  54996. text = '';
  54997. } else if (whitespaceOption) {
  54998. if (whitespaceOption === 'condense') {
  54999. // in condense mode, remove the whitespace node if it contains
  55000. // line break, otherwise condense to a single space
  55001. text = lineBreakRE.test(text) ? '' : ' ';
  55002. } else {
  55003. text = ' ';
  55004. }
  55005. } else {
  55006. text = preserveWhitespace ? ' ' : '';
  55007. }
  55008. if (text) {
  55009. if (!inPre && whitespaceOption === 'condense') {
  55010. // condense consecutive whitespaces into single space
  55011. text = text.replace(whitespaceRE$1, ' ');
  55012. }
  55013. var res;
  55014. var child;
  55015. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  55016. child = {
  55017. type: 2,
  55018. expression: res.expression,
  55019. tokens: res.tokens,
  55020. text: text
  55021. };
  55022. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  55023. child = {
  55024. type: 3,
  55025. text: text
  55026. };
  55027. }
  55028. if (child) {
  55029. if (options.outputSourceRange) {
  55030. child.start = start;
  55031. child.end = end;
  55032. }
  55033. children.push(child);
  55034. }
  55035. }
  55036. },
  55037. comment: function comment (text, start, end) {
  55038. // adding anyting as a sibling to the root node is forbidden
  55039. // comments should still be allowed, but ignored
  55040. if (currentParent) {
  55041. var child = {
  55042. type: 3,
  55043. text: text,
  55044. isComment: true
  55045. };
  55046. if (options.outputSourceRange) {
  55047. child.start = start;
  55048. child.end = end;
  55049. }
  55050. currentParent.children.push(child);
  55051. }
  55052. }
  55053. });
  55054. return root
  55055. }
  55056. function processPre (el) {
  55057. if (getAndRemoveAttr(el, 'v-pre') != null) {
  55058. el.pre = true;
  55059. }
  55060. }
  55061. function processRawAttrs (el) {
  55062. var list = el.attrsList;
  55063. var len = list.length;
  55064. if (len) {
  55065. var attrs = el.attrs = new Array(len);
  55066. for (var i = 0; i < len; i++) {
  55067. attrs[i] = {
  55068. name: list[i].name,
  55069. value: JSON.stringify(list[i].value)
  55070. };
  55071. if (list[i].start != null) {
  55072. attrs[i].start = list[i].start;
  55073. attrs[i].end = list[i].end;
  55074. }
  55075. }
  55076. } else if (!el.pre) {
  55077. // non root node in pre blocks with no attributes
  55078. el.plain = true;
  55079. }
  55080. }
  55081. function processElement (
  55082. element,
  55083. options
  55084. ) {
  55085. processKey(element);
  55086. // determine whether this is a plain element after
  55087. // removing structural attributes
  55088. element.plain = (
  55089. !element.key &&
  55090. !element.scopedSlots &&
  55091. !element.attrsList.length
  55092. );
  55093. processRef(element);
  55094. processSlotContent(element);
  55095. processSlotOutlet(element);
  55096. processComponent(element);
  55097. for (var i = 0; i < transforms.length; i++) {
  55098. element = transforms[i](element, options) || element;
  55099. }
  55100. processAttrs(element);
  55101. return element
  55102. }
  55103. function processKey (el) {
  55104. var exp = getBindingAttr(el, 'key');
  55105. if (exp) {
  55106. {
  55107. if (el.tag === 'template') {
  55108. warn$2(
  55109. "<template> cannot be keyed. Place the key on real elements instead.",
  55110. getRawBindingAttr(el, 'key')
  55111. );
  55112. }
  55113. if (el.for) {
  55114. var iterator = el.iterator2 || el.iterator1;
  55115. var parent = el.parent;
  55116. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  55117. warn$2(
  55118. "Do not use v-for index as key on <transition-group> children, " +
  55119. "this is the same as not using keys.",
  55120. getRawBindingAttr(el, 'key'),
  55121. true /* tip */
  55122. );
  55123. }
  55124. }
  55125. }
  55126. el.key = exp;
  55127. }
  55128. }
  55129. function processRef (el) {
  55130. var ref = getBindingAttr(el, 'ref');
  55131. if (ref) {
  55132. el.ref = ref;
  55133. el.refInFor = checkInFor(el);
  55134. }
  55135. }
  55136. function processFor (el) {
  55137. var exp;
  55138. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  55139. var res = parseFor(exp);
  55140. if (res) {
  55141. extend(el, res);
  55142. } else {
  55143. warn$2(
  55144. ("Invalid v-for expression: " + exp),
  55145. el.rawAttrsMap['v-for']
  55146. );
  55147. }
  55148. }
  55149. }
  55150. function parseFor (exp) {
  55151. var inMatch = exp.match(forAliasRE);
  55152. if (!inMatch) { return }
  55153. var res = {};
  55154. res.for = inMatch[2].trim();
  55155. var alias = inMatch[1].trim().replace(stripParensRE, '');
  55156. var iteratorMatch = alias.match(forIteratorRE);
  55157. if (iteratorMatch) {
  55158. res.alias = alias.replace(forIteratorRE, '').trim();
  55159. res.iterator1 = iteratorMatch[1].trim();
  55160. if (iteratorMatch[2]) {
  55161. res.iterator2 = iteratorMatch[2].trim();
  55162. }
  55163. } else {
  55164. res.alias = alias;
  55165. }
  55166. return res
  55167. }
  55168. function processIf (el) {
  55169. var exp = getAndRemoveAttr(el, 'v-if');
  55170. if (exp) {
  55171. el.if = exp;
  55172. addIfCondition(el, {
  55173. exp: exp,
  55174. block: el
  55175. });
  55176. } else {
  55177. if (getAndRemoveAttr(el, 'v-else') != null) {
  55178. el.else = true;
  55179. }
  55180. var elseif = getAndRemoveAttr(el, 'v-else-if');
  55181. if (elseif) {
  55182. el.elseif = elseif;
  55183. }
  55184. }
  55185. }
  55186. function processIfConditions (el, parent) {
  55187. var prev = findPrevElement(parent.children);
  55188. if (prev && prev.if) {
  55189. addIfCondition(prev, {
  55190. exp: el.elseif,
  55191. block: el
  55192. });
  55193. } else {
  55194. warn$2(
  55195. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  55196. "used on element <" + (el.tag) + "> without corresponding v-if.",
  55197. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  55198. );
  55199. }
  55200. }
  55201. function findPrevElement (children) {
  55202. var i = children.length;
  55203. while (i--) {
  55204. if (children[i].type === 1) {
  55205. return children[i]
  55206. } else {
  55207. if (children[i].text !== ' ') {
  55208. warn$2(
  55209. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  55210. "will be ignored.",
  55211. children[i]
  55212. );
  55213. }
  55214. children.pop();
  55215. }
  55216. }
  55217. }
  55218. function addIfCondition (el, condition) {
  55219. if (!el.ifConditions) {
  55220. el.ifConditions = [];
  55221. }
  55222. el.ifConditions.push(condition);
  55223. }
  55224. function processOnce (el) {
  55225. var once$$1 = getAndRemoveAttr(el, 'v-once');
  55226. if (once$$1 != null) {
  55227. el.once = true;
  55228. }
  55229. }
  55230. // handle content being passed to a component as slot,
  55231. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  55232. function processSlotContent (el) {
  55233. var slotScope;
  55234. if (el.tag === 'template') {
  55235. slotScope = getAndRemoveAttr(el, 'scope');
  55236. /* istanbul ignore if */
  55237. if (slotScope) {
  55238. warn$2(
  55239. "the \"scope\" attribute for scoped slots have been deprecated and " +
  55240. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  55241. "can also be used on plain elements in addition to <template> to " +
  55242. "denote scoped slots.",
  55243. el.rawAttrsMap['scope'],
  55244. true
  55245. );
  55246. }
  55247. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  55248. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  55249. /* istanbul ignore if */
  55250. if (el.attrsMap['v-for']) {
  55251. warn$2(
  55252. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  55253. "(v-for takes higher priority). Use a wrapper <template> for the " +
  55254. "scoped slot to make it clearer.",
  55255. el.rawAttrsMap['slot-scope'],
  55256. true
  55257. );
  55258. }
  55259. el.slotScope = slotScope;
  55260. }
  55261. // slot="xxx"
  55262. var slotTarget = getBindingAttr(el, 'slot');
  55263. if (slotTarget) {
  55264. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  55265. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  55266. // preserve slot as an attribute for native shadow DOM compat
  55267. // only for non-scoped slots.
  55268. if (el.tag !== 'template' && !el.slotScope) {
  55269. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  55270. }
  55271. }
  55272. // 2.6 v-slot syntax
  55273. {
  55274. if (el.tag === 'template') {
  55275. // v-slot on <template>
  55276. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  55277. if (slotBinding) {
  55278. {
  55279. if (el.slotTarget || el.slotScope) {
  55280. warn$2(
  55281. "Unexpected mixed usage of different slot syntaxes.",
  55282. el
  55283. );
  55284. }
  55285. if (el.parent && !maybeComponent(el.parent)) {
  55286. warn$2(
  55287. "<template v-slot> can only appear at the root level inside " +
  55288. "the receiving component",
  55289. el
  55290. );
  55291. }
  55292. }
  55293. var ref = getSlotName(slotBinding);
  55294. var name = ref.name;
  55295. var dynamic = ref.dynamic;
  55296. el.slotTarget = name;
  55297. el.slotTargetDynamic = dynamic;
  55298. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  55299. }
  55300. } else {
  55301. // v-slot on component, denotes default slot
  55302. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  55303. if (slotBinding$1) {
  55304. {
  55305. if (!maybeComponent(el)) {
  55306. warn$2(
  55307. "v-slot can only be used on components or <template>.",
  55308. slotBinding$1
  55309. );
  55310. }
  55311. if (el.slotScope || el.slotTarget) {
  55312. warn$2(
  55313. "Unexpected mixed usage of different slot syntaxes.",
  55314. el
  55315. );
  55316. }
  55317. if (el.scopedSlots) {
  55318. warn$2(
  55319. "To avoid scope ambiguity, the default slot should also use " +
  55320. "<template> syntax when there are other named slots.",
  55321. slotBinding$1
  55322. );
  55323. }
  55324. }
  55325. // add the component's children to its default slot
  55326. var slots = el.scopedSlots || (el.scopedSlots = {});
  55327. var ref$1 = getSlotName(slotBinding$1);
  55328. var name$1 = ref$1.name;
  55329. var dynamic$1 = ref$1.dynamic;
  55330. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  55331. slotContainer.slotTarget = name$1;
  55332. slotContainer.slotTargetDynamic = dynamic$1;
  55333. slotContainer.children = el.children.filter(function (c) {
  55334. if (!c.slotScope) {
  55335. c.parent = slotContainer;
  55336. return true
  55337. }
  55338. });
  55339. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  55340. // remove children as they are returned from scopedSlots now
  55341. el.children = [];
  55342. // mark el non-plain so data gets generated
  55343. el.plain = false;
  55344. }
  55345. }
  55346. }
  55347. }
  55348. function getSlotName (binding) {
  55349. var name = binding.name.replace(slotRE, '');
  55350. if (!name) {
  55351. if (binding.name[0] !== '#') {
  55352. name = 'default';
  55353. } else {
  55354. warn$2(
  55355. "v-slot shorthand syntax requires a slot name.",
  55356. binding
  55357. );
  55358. }
  55359. }
  55360. return dynamicArgRE.test(name)
  55361. // dynamic [name]
  55362. ? { name: name.slice(1, -1), dynamic: true }
  55363. // static name
  55364. : { name: ("\"" + name + "\""), dynamic: false }
  55365. }
  55366. // handle <slot/> outlets
  55367. function processSlotOutlet (el) {
  55368. if (el.tag === 'slot') {
  55369. el.slotName = getBindingAttr(el, 'name');
  55370. if (el.key) {
  55371. warn$2(
  55372. "`key` does not work on <slot> because slots are abstract outlets " +
  55373. "and can possibly expand into multiple elements. " +
  55374. "Use the key on a wrapping element instead.",
  55375. getRawBindingAttr(el, 'key')
  55376. );
  55377. }
  55378. }
  55379. }
  55380. function processComponent (el) {
  55381. var binding;
  55382. if ((binding = getBindingAttr(el, 'is'))) {
  55383. el.component = binding;
  55384. }
  55385. if (getAndRemoveAttr(el, 'inline-template') != null) {
  55386. el.inlineTemplate = true;
  55387. }
  55388. }
  55389. function processAttrs (el) {
  55390. var list = el.attrsList;
  55391. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  55392. for (i = 0, l = list.length; i < l; i++) {
  55393. name = rawName = list[i].name;
  55394. value = list[i].value;
  55395. if (dirRE.test(name)) {
  55396. // mark element as dynamic
  55397. el.hasBindings = true;
  55398. // modifiers
  55399. modifiers = parseModifiers(name.replace(dirRE, ''));
  55400. // support .foo shorthand syntax for the .prop modifier
  55401. if (modifiers) {
  55402. name = name.replace(modifierRE, '');
  55403. }
  55404. if (bindRE.test(name)) { // v-bind
  55405. name = name.replace(bindRE, '');
  55406. value = parseFilters(value);
  55407. isDynamic = dynamicArgRE.test(name);
  55408. if (isDynamic) {
  55409. name = name.slice(1, -1);
  55410. }
  55411. if (
  55412. value.trim().length === 0
  55413. ) {
  55414. warn$2(
  55415. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  55416. );
  55417. }
  55418. if (modifiers) {
  55419. if (modifiers.prop && !isDynamic) {
  55420. name = camelize(name);
  55421. if (name === 'innerHtml') { name = 'innerHTML'; }
  55422. }
  55423. if (modifiers.camel && !isDynamic) {
  55424. name = camelize(name);
  55425. }
  55426. if (modifiers.sync) {
  55427. syncGen = genAssignmentCode(value, "$event");
  55428. if (!isDynamic) {
  55429. addHandler(
  55430. el,
  55431. ("update:" + (camelize(name))),
  55432. syncGen,
  55433. null,
  55434. false,
  55435. warn$2,
  55436. list[i]
  55437. );
  55438. if (hyphenate(name) !== camelize(name)) {
  55439. addHandler(
  55440. el,
  55441. ("update:" + (hyphenate(name))),
  55442. syncGen,
  55443. null,
  55444. false,
  55445. warn$2,
  55446. list[i]
  55447. );
  55448. }
  55449. } else {
  55450. // handler w/ dynamic event name
  55451. addHandler(
  55452. el,
  55453. ("\"update:\"+(" + name + ")"),
  55454. syncGen,
  55455. null,
  55456. false,
  55457. warn$2,
  55458. list[i],
  55459. true // dynamic
  55460. );
  55461. }
  55462. }
  55463. }
  55464. if ((modifiers && modifiers.prop) || (
  55465. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  55466. )) {
  55467. addProp(el, name, value, list[i], isDynamic);
  55468. } else {
  55469. addAttr(el, name, value, list[i], isDynamic);
  55470. }
  55471. } else if (onRE.test(name)) { // v-on
  55472. name = name.replace(onRE, '');
  55473. isDynamic = dynamicArgRE.test(name);
  55474. if (isDynamic) {
  55475. name = name.slice(1, -1);
  55476. }
  55477. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  55478. } else { // normal directives
  55479. name = name.replace(dirRE, '');
  55480. // parse arg
  55481. var argMatch = name.match(argRE);
  55482. var arg = argMatch && argMatch[1];
  55483. isDynamic = false;
  55484. if (arg) {
  55485. name = name.slice(0, -(arg.length + 1));
  55486. if (dynamicArgRE.test(arg)) {
  55487. arg = arg.slice(1, -1);
  55488. isDynamic = true;
  55489. }
  55490. }
  55491. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  55492. if (name === 'model') {
  55493. checkForAliasModel(el, value);
  55494. }
  55495. }
  55496. } else {
  55497. // literal attribute
  55498. {
  55499. var res = parseText(value, delimiters);
  55500. if (res) {
  55501. warn$2(
  55502. name + "=\"" + value + "\": " +
  55503. 'Interpolation inside attributes has been removed. ' +
  55504. 'Use v-bind or the colon shorthand instead. For example, ' +
  55505. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  55506. list[i]
  55507. );
  55508. }
  55509. }
  55510. addAttr(el, name, JSON.stringify(value), list[i]);
  55511. // #6887 firefox doesn't update muted state if set via attribute
  55512. // even immediately after element creation
  55513. if (!el.component &&
  55514. name === 'muted' &&
  55515. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  55516. addProp(el, name, 'true', list[i]);
  55517. }
  55518. }
  55519. }
  55520. }
  55521. function checkInFor (el) {
  55522. var parent = el;
  55523. while (parent) {
  55524. if (parent.for !== undefined) {
  55525. return true
  55526. }
  55527. parent = parent.parent;
  55528. }
  55529. return false
  55530. }
  55531. function parseModifiers (name) {
  55532. var match = name.match(modifierRE);
  55533. if (match) {
  55534. var ret = {};
  55535. match.forEach(function (m) { ret[m.slice(1)] = true; });
  55536. return ret
  55537. }
  55538. }
  55539. function makeAttrsMap (attrs) {
  55540. var map = {};
  55541. for (var i = 0, l = attrs.length; i < l; i++) {
  55542. if (
  55543. map[attrs[i].name] && !isIE && !isEdge
  55544. ) {
  55545. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  55546. }
  55547. map[attrs[i].name] = attrs[i].value;
  55548. }
  55549. return map
  55550. }
  55551. // for script (e.g. type="x/template") or style, do not decode content
  55552. function isTextTag (el) {
  55553. return el.tag === 'script' || el.tag === 'style'
  55554. }
  55555. function isForbiddenTag (el) {
  55556. return (
  55557. el.tag === 'style' ||
  55558. (el.tag === 'script' && (
  55559. !el.attrsMap.type ||
  55560. el.attrsMap.type === 'text/javascript'
  55561. ))
  55562. )
  55563. }
  55564. var ieNSBug = /^xmlns:NS\d+/;
  55565. var ieNSPrefix = /^NS\d+:/;
  55566. /* istanbul ignore next */
  55567. function guardIESVGBug (attrs) {
  55568. var res = [];
  55569. for (var i = 0; i < attrs.length; i++) {
  55570. var attr = attrs[i];
  55571. if (!ieNSBug.test(attr.name)) {
  55572. attr.name = attr.name.replace(ieNSPrefix, '');
  55573. res.push(attr);
  55574. }
  55575. }
  55576. return res
  55577. }
  55578. function checkForAliasModel (el, value) {
  55579. var _el = el;
  55580. while (_el) {
  55581. if (_el.for && _el.alias === value) {
  55582. warn$2(
  55583. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  55584. "You are binding v-model directly to a v-for iteration alias. " +
  55585. "This will not be able to modify the v-for source array because " +
  55586. "writing to the alias is like modifying a function local variable. " +
  55587. "Consider using an array of objects and use v-model on an object property instead.",
  55588. el.rawAttrsMap['v-model']
  55589. );
  55590. }
  55591. _el = _el.parent;
  55592. }
  55593. }
  55594. /* */
  55595. function preTransformNode (el, options) {
  55596. if (el.tag === 'input') {
  55597. var map = el.attrsMap;
  55598. if (!map['v-model']) {
  55599. return
  55600. }
  55601. var typeBinding;
  55602. if (map[':type'] || map['v-bind:type']) {
  55603. typeBinding = getBindingAttr(el, 'type');
  55604. }
  55605. if (!map.type && !typeBinding && map['v-bind']) {
  55606. typeBinding = "(" + (map['v-bind']) + ").type";
  55607. }
  55608. if (typeBinding) {
  55609. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  55610. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  55611. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  55612. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  55613. // 1. checkbox
  55614. var branch0 = cloneASTElement(el);
  55615. // process for on the main node
  55616. processFor(branch0);
  55617. addRawAttr(branch0, 'type', 'checkbox');
  55618. processElement(branch0, options);
  55619. branch0.processed = true; // prevent it from double-processed
  55620. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  55621. addIfCondition(branch0, {
  55622. exp: branch0.if,
  55623. block: branch0
  55624. });
  55625. // 2. add radio else-if condition
  55626. var branch1 = cloneASTElement(el);
  55627. getAndRemoveAttr(branch1, 'v-for', true);
  55628. addRawAttr(branch1, 'type', 'radio');
  55629. processElement(branch1, options);
  55630. addIfCondition(branch0, {
  55631. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  55632. block: branch1
  55633. });
  55634. // 3. other
  55635. var branch2 = cloneASTElement(el);
  55636. getAndRemoveAttr(branch2, 'v-for', true);
  55637. addRawAttr(branch2, ':type', typeBinding);
  55638. processElement(branch2, options);
  55639. addIfCondition(branch0, {
  55640. exp: ifCondition,
  55641. block: branch2
  55642. });
  55643. if (hasElse) {
  55644. branch0.else = true;
  55645. } else if (elseIfCondition) {
  55646. branch0.elseif = elseIfCondition;
  55647. }
  55648. return branch0
  55649. }
  55650. }
  55651. }
  55652. function cloneASTElement (el) {
  55653. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  55654. }
  55655. var model$1 = {
  55656. preTransformNode: preTransformNode
  55657. };
  55658. var modules$1 = [
  55659. klass$1,
  55660. style$1,
  55661. model$1
  55662. ];
  55663. /* */
  55664. function text (el, dir) {
  55665. if (dir.value) {
  55666. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  55667. }
  55668. }
  55669. /* */
  55670. function html (el, dir) {
  55671. if (dir.value) {
  55672. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  55673. }
  55674. }
  55675. var directives$1 = {
  55676. model: model,
  55677. text: text,
  55678. html: html
  55679. };
  55680. /* */
  55681. var baseOptions = {
  55682. expectHTML: true,
  55683. modules: modules$1,
  55684. directives: directives$1,
  55685. isPreTag: isPreTag,
  55686. isUnaryTag: isUnaryTag,
  55687. mustUseProp: mustUseProp,
  55688. canBeLeftOpenTag: canBeLeftOpenTag,
  55689. isReservedTag: isReservedTag,
  55690. getTagNamespace: getTagNamespace,
  55691. staticKeys: genStaticKeys(modules$1)
  55692. };
  55693. /* */
  55694. var isStaticKey;
  55695. var isPlatformReservedTag;
  55696. var genStaticKeysCached = cached(genStaticKeys$1);
  55697. /**
  55698. * Goal of the optimizer: walk the generated template AST tree
  55699. * and detect sub-trees that are purely static, i.e. parts of
  55700. * the DOM that never needs to change.
  55701. *
  55702. * Once we detect these sub-trees, we can:
  55703. *
  55704. * 1. Hoist them into constants, so that we no longer need to
  55705. * create fresh nodes for them on each re-render;
  55706. * 2. Completely skip them in the patching process.
  55707. */
  55708. function optimize (root, options) {
  55709. if (!root) { return }
  55710. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  55711. isPlatformReservedTag = options.isReservedTag || no;
  55712. // first pass: mark all non-static nodes.
  55713. markStatic$1(root);
  55714. // second pass: mark static roots.
  55715. markStaticRoots(root, false);
  55716. }
  55717. function genStaticKeys$1 (keys) {
  55718. return makeMap(
  55719. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  55720. (keys ? ',' + keys : '')
  55721. )
  55722. }
  55723. function markStatic$1 (node) {
  55724. node.static = isStatic(node);
  55725. if (node.type === 1) {
  55726. // do not make component slot content static. this avoids
  55727. // 1. components not able to mutate slot nodes
  55728. // 2. static slot content fails for hot-reloading
  55729. if (
  55730. !isPlatformReservedTag(node.tag) &&
  55731. node.tag !== 'slot' &&
  55732. node.attrsMap['inline-template'] == null
  55733. ) {
  55734. return
  55735. }
  55736. for (var i = 0, l = node.children.length; i < l; i++) {
  55737. var child = node.children[i];
  55738. markStatic$1(child);
  55739. if (!child.static) {
  55740. node.static = false;
  55741. }
  55742. }
  55743. if (node.ifConditions) {
  55744. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  55745. var block = node.ifConditions[i$1].block;
  55746. markStatic$1(block);
  55747. if (!block.static) {
  55748. node.static = false;
  55749. }
  55750. }
  55751. }
  55752. }
  55753. }
  55754. function markStaticRoots (node, isInFor) {
  55755. if (node.type === 1) {
  55756. if (node.static || node.once) {
  55757. node.staticInFor = isInFor;
  55758. }
  55759. // For a node to qualify as a static root, it should have children that
  55760. // are not just static text. Otherwise the cost of hoisting out will
  55761. // outweigh the benefits and it's better off to just always render it fresh.
  55762. if (node.static && node.children.length && !(
  55763. node.children.length === 1 &&
  55764. node.children[0].type === 3
  55765. )) {
  55766. node.staticRoot = true;
  55767. return
  55768. } else {
  55769. node.staticRoot = false;
  55770. }
  55771. if (node.children) {
  55772. for (var i = 0, l = node.children.length; i < l; i++) {
  55773. markStaticRoots(node.children[i], isInFor || !!node.for);
  55774. }
  55775. }
  55776. if (node.ifConditions) {
  55777. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  55778. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  55779. }
  55780. }
  55781. }
  55782. }
  55783. function isStatic (node) {
  55784. if (node.type === 2) { // expression
  55785. return false
  55786. }
  55787. if (node.type === 3) { // text
  55788. return true
  55789. }
  55790. return !!(node.pre || (
  55791. !node.hasBindings && // no dynamic bindings
  55792. !node.if && !node.for && // not v-if or v-for or v-else
  55793. !isBuiltInTag(node.tag) && // not a built-in
  55794. isPlatformReservedTag(node.tag) && // not a component
  55795. !isDirectChildOfTemplateFor(node) &&
  55796. Object.keys(node).every(isStaticKey)
  55797. ))
  55798. }
  55799. function isDirectChildOfTemplateFor (node) {
  55800. while (node.parent) {
  55801. node = node.parent;
  55802. if (node.tag !== 'template') {
  55803. return false
  55804. }
  55805. if (node.for) {
  55806. return true
  55807. }
  55808. }
  55809. return false
  55810. }
  55811. /* */
  55812. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  55813. var fnInvokeRE = /\([^)]*?\);*$/;
  55814. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  55815. // KeyboardEvent.keyCode aliases
  55816. var keyCodes = {
  55817. esc: 27,
  55818. tab: 9,
  55819. enter: 13,
  55820. space: 32,
  55821. up: 38,
  55822. left: 37,
  55823. right: 39,
  55824. down: 40,
  55825. 'delete': [8, 46]
  55826. };
  55827. // KeyboardEvent.key aliases
  55828. var keyNames = {
  55829. // #7880: IE11 and Edge use `Esc` for Escape key name.
  55830. esc: ['Esc', 'Escape'],
  55831. tab: 'Tab',
  55832. enter: 'Enter',
  55833. // #9112: IE11 uses `Spacebar` for Space key name.
  55834. space: [' ', 'Spacebar'],
  55835. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  55836. up: ['Up', 'ArrowUp'],
  55837. left: ['Left', 'ArrowLeft'],
  55838. right: ['Right', 'ArrowRight'],
  55839. down: ['Down', 'ArrowDown'],
  55840. // #9112: IE11 uses `Del` for Delete key name.
  55841. 'delete': ['Backspace', 'Delete', 'Del']
  55842. };
  55843. // #4868: modifiers that prevent the execution of the listener
  55844. // need to explicitly return null so that we can determine whether to remove
  55845. // the listener for .once
  55846. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  55847. var modifierCode = {
  55848. stop: '$event.stopPropagation();',
  55849. prevent: '$event.preventDefault();',
  55850. self: genGuard("$event.target !== $event.currentTarget"),
  55851. ctrl: genGuard("!$event.ctrlKey"),
  55852. shift: genGuard("!$event.shiftKey"),
  55853. alt: genGuard("!$event.altKey"),
  55854. meta: genGuard("!$event.metaKey"),
  55855. left: genGuard("'button' in $event && $event.button !== 0"),
  55856. middle: genGuard("'button' in $event && $event.button !== 1"),
  55857. right: genGuard("'button' in $event && $event.button !== 2")
  55858. };
  55859. function genHandlers (
  55860. events,
  55861. isNative
  55862. ) {
  55863. var prefix = isNative ? 'nativeOn:' : 'on:';
  55864. var staticHandlers = "";
  55865. var dynamicHandlers = "";
  55866. for (var name in events) {
  55867. var handlerCode = genHandler(events[name]);
  55868. if (events[name] && events[name].dynamic) {
  55869. dynamicHandlers += name + "," + handlerCode + ",";
  55870. } else {
  55871. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  55872. }
  55873. }
  55874. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  55875. if (dynamicHandlers) {
  55876. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  55877. } else {
  55878. return prefix + staticHandlers
  55879. }
  55880. }
  55881. function genHandler (handler) {
  55882. if (!handler) {
  55883. return 'function(){}'
  55884. }
  55885. if (Array.isArray(handler)) {
  55886. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  55887. }
  55888. var isMethodPath = simplePathRE.test(handler.value);
  55889. var isFunctionExpression = fnExpRE.test(handler.value);
  55890. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  55891. if (!handler.modifiers) {
  55892. if (isMethodPath || isFunctionExpression) {
  55893. return handler.value
  55894. }
  55895. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  55896. } else {
  55897. var code = '';
  55898. var genModifierCode = '';
  55899. var keys = [];
  55900. for (var key in handler.modifiers) {
  55901. if (modifierCode[key]) {
  55902. genModifierCode += modifierCode[key];
  55903. // left/right
  55904. if (keyCodes[key]) {
  55905. keys.push(key);
  55906. }
  55907. } else if (key === 'exact') {
  55908. var modifiers = (handler.modifiers);
  55909. genModifierCode += genGuard(
  55910. ['ctrl', 'shift', 'alt', 'meta']
  55911. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  55912. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  55913. .join('||')
  55914. );
  55915. } else {
  55916. keys.push(key);
  55917. }
  55918. }
  55919. if (keys.length) {
  55920. code += genKeyFilter(keys);
  55921. }
  55922. // Make sure modifiers like prevent and stop get executed after key filtering
  55923. if (genModifierCode) {
  55924. code += genModifierCode;
  55925. }
  55926. var handlerCode = isMethodPath
  55927. ? ("return " + (handler.value) + "($event)")
  55928. : isFunctionExpression
  55929. ? ("return (" + (handler.value) + ")($event)")
  55930. : isFunctionInvocation
  55931. ? ("return " + (handler.value))
  55932. : handler.value;
  55933. return ("function($event){" + code + handlerCode + "}")
  55934. }
  55935. }
  55936. function genKeyFilter (keys) {
  55937. return (
  55938. // make sure the key filters only apply to KeyboardEvents
  55939. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  55940. // key events that do not have keyCode property...
  55941. "if(!$event.type.indexOf('key')&&" +
  55942. (keys.map(genFilterCode).join('&&')) + ")return null;"
  55943. )
  55944. }
  55945. function genFilterCode (key) {
  55946. var keyVal = parseInt(key, 10);
  55947. if (keyVal) {
  55948. return ("$event.keyCode!==" + keyVal)
  55949. }
  55950. var keyCode = keyCodes[key];
  55951. var keyName = keyNames[key];
  55952. return (
  55953. "_k($event.keyCode," +
  55954. (JSON.stringify(key)) + "," +
  55955. (JSON.stringify(keyCode)) + "," +
  55956. "$event.key," +
  55957. "" + (JSON.stringify(keyName)) +
  55958. ")"
  55959. )
  55960. }
  55961. /* */
  55962. function on (el, dir) {
  55963. if (dir.modifiers) {
  55964. warn("v-on without argument does not support modifiers.");
  55965. }
  55966. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  55967. }
  55968. /* */
  55969. function bind$1 (el, dir) {
  55970. el.wrapData = function (code) {
  55971. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  55972. };
  55973. }
  55974. /* */
  55975. var baseDirectives = {
  55976. on: on,
  55977. bind: bind$1,
  55978. cloak: noop
  55979. };
  55980. /* */
  55981. var CodegenState = function CodegenState (options) {
  55982. this.options = options;
  55983. this.warn = options.warn || baseWarn;
  55984. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  55985. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  55986. this.directives = extend(extend({}, baseDirectives), options.directives);
  55987. var isReservedTag = options.isReservedTag || no;
  55988. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  55989. this.onceId = 0;
  55990. this.staticRenderFns = [];
  55991. this.pre = false;
  55992. };
  55993. function generate (
  55994. ast,
  55995. options
  55996. ) {
  55997. var state = new CodegenState(options);
  55998. var code = ast ? genElement(ast, state) : '_c("div")';
  55999. return {
  56000. render: ("with(this){return " + code + "}"),
  56001. staticRenderFns: state.staticRenderFns
  56002. }
  56003. }
  56004. function genElement (el, state) {
  56005. if (el.parent) {
  56006. el.pre = el.pre || el.parent.pre;
  56007. }
  56008. if (el.staticRoot && !el.staticProcessed) {
  56009. return genStatic(el, state)
  56010. } else if (el.once && !el.onceProcessed) {
  56011. return genOnce(el, state)
  56012. } else if (el.for && !el.forProcessed) {
  56013. return genFor(el, state)
  56014. } else if (el.if && !el.ifProcessed) {
  56015. return genIf(el, state)
  56016. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  56017. return genChildren(el, state) || 'void 0'
  56018. } else if (el.tag === 'slot') {
  56019. return genSlot(el, state)
  56020. } else {
  56021. // component or element
  56022. var code;
  56023. if (el.component) {
  56024. code = genComponent(el.component, el, state);
  56025. } else {
  56026. var data;
  56027. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  56028. data = genData$2(el, state);
  56029. }
  56030. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  56031. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  56032. }
  56033. // module transforms
  56034. for (var i = 0; i < state.transforms.length; i++) {
  56035. code = state.transforms[i](el, code);
  56036. }
  56037. return code
  56038. }
  56039. }
  56040. // hoist static sub-trees out
  56041. function genStatic (el, state) {
  56042. el.staticProcessed = true;
  56043. // Some elements (templates) need to behave differently inside of a v-pre
  56044. // node. All pre nodes are static roots, so we can use this as a location to
  56045. // wrap a state change and reset it upon exiting the pre node.
  56046. var originalPreState = state.pre;
  56047. if (el.pre) {
  56048. state.pre = el.pre;
  56049. }
  56050. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  56051. state.pre = originalPreState;
  56052. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  56053. }
  56054. // v-once
  56055. function genOnce (el, state) {
  56056. el.onceProcessed = true;
  56057. if (el.if && !el.ifProcessed) {
  56058. return genIf(el, state)
  56059. } else if (el.staticInFor) {
  56060. var key = '';
  56061. var parent = el.parent;
  56062. while (parent) {
  56063. if (parent.for) {
  56064. key = parent.key;
  56065. break
  56066. }
  56067. parent = parent.parent;
  56068. }
  56069. if (!key) {
  56070. state.warn(
  56071. "v-once can only be used inside v-for that is keyed. ",
  56072. el.rawAttrsMap['v-once']
  56073. );
  56074. return genElement(el, state)
  56075. }
  56076. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  56077. } else {
  56078. return genStatic(el, state)
  56079. }
  56080. }
  56081. function genIf (
  56082. el,
  56083. state,
  56084. altGen,
  56085. altEmpty
  56086. ) {
  56087. el.ifProcessed = true; // avoid recursion
  56088. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  56089. }
  56090. function genIfConditions (
  56091. conditions,
  56092. state,
  56093. altGen,
  56094. altEmpty
  56095. ) {
  56096. if (!conditions.length) {
  56097. return altEmpty || '_e()'
  56098. }
  56099. var condition = conditions.shift();
  56100. if (condition.exp) {
  56101. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  56102. } else {
  56103. return ("" + (genTernaryExp(condition.block)))
  56104. }
  56105. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  56106. function genTernaryExp (el) {
  56107. return altGen
  56108. ? altGen(el, state)
  56109. : el.once
  56110. ? genOnce(el, state)
  56111. : genElement(el, state)
  56112. }
  56113. }
  56114. function genFor (
  56115. el,
  56116. state,
  56117. altGen,
  56118. altHelper
  56119. ) {
  56120. var exp = el.for;
  56121. var alias = el.alias;
  56122. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  56123. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  56124. if (state.maybeComponent(el) &&
  56125. el.tag !== 'slot' &&
  56126. el.tag !== 'template' &&
  56127. !el.key
  56128. ) {
  56129. state.warn(
  56130. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  56131. "v-for should have explicit keys. " +
  56132. "See https://vuejs.org/guide/list.html#key for more info.",
  56133. el.rawAttrsMap['v-for'],
  56134. true /* tip */
  56135. );
  56136. }
  56137. el.forProcessed = true; // avoid recursion
  56138. return (altHelper || '_l') + "((" + exp + ")," +
  56139. "function(" + alias + iterator1 + iterator2 + "){" +
  56140. "return " + ((altGen || genElement)(el, state)) +
  56141. '})'
  56142. }
  56143. function genData$2 (el, state) {
  56144. var data = '{';
  56145. // directives first.
  56146. // directives may mutate the el's other properties before they are generated.
  56147. var dirs = genDirectives(el, state);
  56148. if (dirs) { data += dirs + ','; }
  56149. // key
  56150. if (el.key) {
  56151. data += "key:" + (el.key) + ",";
  56152. }
  56153. // ref
  56154. if (el.ref) {
  56155. data += "ref:" + (el.ref) + ",";
  56156. }
  56157. if (el.refInFor) {
  56158. data += "refInFor:true,";
  56159. }
  56160. // pre
  56161. if (el.pre) {
  56162. data += "pre:true,";
  56163. }
  56164. // record original tag name for components using "is" attribute
  56165. if (el.component) {
  56166. data += "tag:\"" + (el.tag) + "\",";
  56167. }
  56168. // module data generation functions
  56169. for (var i = 0; i < state.dataGenFns.length; i++) {
  56170. data += state.dataGenFns[i](el);
  56171. }
  56172. // attributes
  56173. if (el.attrs) {
  56174. data += "attrs:" + (genProps(el.attrs)) + ",";
  56175. }
  56176. // DOM props
  56177. if (el.props) {
  56178. data += "domProps:" + (genProps(el.props)) + ",";
  56179. }
  56180. // event handlers
  56181. if (el.events) {
  56182. data += (genHandlers(el.events, false)) + ",";
  56183. }
  56184. if (el.nativeEvents) {
  56185. data += (genHandlers(el.nativeEvents, true)) + ",";
  56186. }
  56187. // slot target
  56188. // only for non-scoped slots
  56189. if (el.slotTarget && !el.slotScope) {
  56190. data += "slot:" + (el.slotTarget) + ",";
  56191. }
  56192. // scoped slots
  56193. if (el.scopedSlots) {
  56194. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  56195. }
  56196. // component v-model
  56197. if (el.model) {
  56198. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  56199. }
  56200. // inline-template
  56201. if (el.inlineTemplate) {
  56202. var inlineTemplate = genInlineTemplate(el, state);
  56203. if (inlineTemplate) {
  56204. data += inlineTemplate + ",";
  56205. }
  56206. }
  56207. data = data.replace(/,$/, '') + '}';
  56208. // v-bind dynamic argument wrap
  56209. // v-bind with dynamic arguments must be applied using the same v-bind object
  56210. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  56211. if (el.dynamicAttrs) {
  56212. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  56213. }
  56214. // v-bind data wrap
  56215. if (el.wrapData) {
  56216. data = el.wrapData(data);
  56217. }
  56218. // v-on data wrap
  56219. if (el.wrapListeners) {
  56220. data = el.wrapListeners(data);
  56221. }
  56222. return data
  56223. }
  56224. function genDirectives (el, state) {
  56225. var dirs = el.directives;
  56226. if (!dirs) { return }
  56227. var res = 'directives:[';
  56228. var hasRuntime = false;
  56229. var i, l, dir, needRuntime;
  56230. for (i = 0, l = dirs.length; i < l; i++) {
  56231. dir = dirs[i];
  56232. needRuntime = true;
  56233. var gen = state.directives[dir.name];
  56234. if (gen) {
  56235. // compile-time directive that manipulates AST.
  56236. // returns true if it also needs a runtime counterpart.
  56237. needRuntime = !!gen(el, dir, state.warn);
  56238. }
  56239. if (needRuntime) {
  56240. hasRuntime = true;
  56241. 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))) : '') + "},";
  56242. }
  56243. }
  56244. if (hasRuntime) {
  56245. return res.slice(0, -1) + ']'
  56246. }
  56247. }
  56248. function genInlineTemplate (el, state) {
  56249. var ast = el.children[0];
  56250. if (el.children.length !== 1 || ast.type !== 1) {
  56251. state.warn(
  56252. 'Inline-template components must have exactly one child element.',
  56253. { start: el.start }
  56254. );
  56255. }
  56256. if (ast && ast.type === 1) {
  56257. var inlineRenderFns = generate(ast, state.options);
  56258. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  56259. }
  56260. }
  56261. function genScopedSlots (
  56262. el,
  56263. slots,
  56264. state
  56265. ) {
  56266. // by default scoped slots are considered "stable", this allows child
  56267. // components with only scoped slots to skip forced updates from parent.
  56268. // but in some cases we have to bail-out of this optimization
  56269. // for example if the slot contains dynamic names, has v-if or v-for on them...
  56270. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  56271. var slot = slots[key];
  56272. return (
  56273. slot.slotTargetDynamic ||
  56274. slot.if ||
  56275. slot.for ||
  56276. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  56277. )
  56278. });
  56279. // #9534: if a component with scoped slots is inside a conditional branch,
  56280. // it's possible for the same component to be reused but with different
  56281. // compiled slot content. To avoid that, we generate a unique key based on
  56282. // the generated code of all the slot contents.
  56283. var needsKey = !!el.if;
  56284. // OR when it is inside another scoped slot or v-for (the reactivity may be
  56285. // disconnected due to the intermediate scope variable)
  56286. // #9438, #9506
  56287. // TODO: this can be further optimized by properly analyzing in-scope bindings
  56288. // and skip force updating ones that do not actually use scope variables.
  56289. if (!needsForceUpdate) {
  56290. var parent = el.parent;
  56291. while (parent) {
  56292. if (
  56293. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  56294. parent.for
  56295. ) {
  56296. needsForceUpdate = true;
  56297. break
  56298. }
  56299. if (parent.if) {
  56300. needsKey = true;
  56301. }
  56302. parent = parent.parent;
  56303. }
  56304. }
  56305. var generatedSlots = Object.keys(slots)
  56306. .map(function (key) { return genScopedSlot(slots[key], state); })
  56307. .join(',');
  56308. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  56309. }
  56310. function hash(str) {
  56311. var hash = 5381;
  56312. var i = str.length;
  56313. while(i) {
  56314. hash = (hash * 33) ^ str.charCodeAt(--i);
  56315. }
  56316. return hash >>> 0
  56317. }
  56318. function containsSlotChild (el) {
  56319. if (el.type === 1) {
  56320. if (el.tag === 'slot') {
  56321. return true
  56322. }
  56323. return el.children.some(containsSlotChild)
  56324. }
  56325. return false
  56326. }
  56327. function genScopedSlot (
  56328. el,
  56329. state
  56330. ) {
  56331. var isLegacySyntax = el.attrsMap['slot-scope'];
  56332. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  56333. return genIf(el, state, genScopedSlot, "null")
  56334. }
  56335. if (el.for && !el.forProcessed) {
  56336. return genFor(el, state, genScopedSlot)
  56337. }
  56338. var slotScope = el.slotScope === emptySlotScopeToken
  56339. ? ""
  56340. : String(el.slotScope);
  56341. var fn = "function(" + slotScope + "){" +
  56342. "return " + (el.tag === 'template'
  56343. ? el.if && isLegacySyntax
  56344. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  56345. : genChildren(el, state) || 'undefined'
  56346. : genElement(el, state)) + "}";
  56347. // reverse proxy v-slot without scope on this.$slots
  56348. var reverseProxy = slotScope ? "" : ",proxy:true";
  56349. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  56350. }
  56351. function genChildren (
  56352. el,
  56353. state,
  56354. checkSkip,
  56355. altGenElement,
  56356. altGenNode
  56357. ) {
  56358. var children = el.children;
  56359. if (children.length) {
  56360. var el$1 = children[0];
  56361. // optimize single v-for
  56362. if (children.length === 1 &&
  56363. el$1.for &&
  56364. el$1.tag !== 'template' &&
  56365. el$1.tag !== 'slot'
  56366. ) {
  56367. var normalizationType = checkSkip
  56368. ? state.maybeComponent(el$1) ? ",1" : ",0"
  56369. : "";
  56370. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  56371. }
  56372. var normalizationType$1 = checkSkip
  56373. ? getNormalizationType(children, state.maybeComponent)
  56374. : 0;
  56375. var gen = altGenNode || genNode;
  56376. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  56377. }
  56378. }
  56379. // determine the normalization needed for the children array.
  56380. // 0: no normalization needed
  56381. // 1: simple normalization needed (possible 1-level deep nested array)
  56382. // 2: full normalization needed
  56383. function getNormalizationType (
  56384. children,
  56385. maybeComponent
  56386. ) {
  56387. var res = 0;
  56388. for (var i = 0; i < children.length; i++) {
  56389. var el = children[i];
  56390. if (el.type !== 1) {
  56391. continue
  56392. }
  56393. if (needsNormalization(el) ||
  56394. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  56395. res = 2;
  56396. break
  56397. }
  56398. if (maybeComponent(el) ||
  56399. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  56400. res = 1;
  56401. }
  56402. }
  56403. return res
  56404. }
  56405. function needsNormalization (el) {
  56406. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  56407. }
  56408. function genNode (node, state) {
  56409. if (node.type === 1) {
  56410. return genElement(node, state)
  56411. } else if (node.type === 3 && node.isComment) {
  56412. return genComment(node)
  56413. } else {
  56414. return genText(node)
  56415. }
  56416. }
  56417. function genText (text) {
  56418. return ("_v(" + (text.type === 2
  56419. ? text.expression // no need for () because already wrapped in _s()
  56420. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  56421. }
  56422. function genComment (comment) {
  56423. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  56424. }
  56425. function genSlot (el, state) {
  56426. var slotName = el.slotName || '"default"';
  56427. var children = genChildren(el, state);
  56428. var res = "_t(" + slotName + (children ? ("," + children) : '');
  56429. var attrs = el.attrs || el.dynamicAttrs
  56430. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  56431. // slot props are camelized
  56432. name: camelize(attr.name),
  56433. value: attr.value,
  56434. dynamic: attr.dynamic
  56435. }); }))
  56436. : null;
  56437. var bind$$1 = el.attrsMap['v-bind'];
  56438. if ((attrs || bind$$1) && !children) {
  56439. res += ",null";
  56440. }
  56441. if (attrs) {
  56442. res += "," + attrs;
  56443. }
  56444. if (bind$$1) {
  56445. res += (attrs ? '' : ',null') + "," + bind$$1;
  56446. }
  56447. return res + ')'
  56448. }
  56449. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  56450. function genComponent (
  56451. componentName,
  56452. el,
  56453. state
  56454. ) {
  56455. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  56456. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  56457. }
  56458. function genProps (props) {
  56459. var staticProps = "";
  56460. var dynamicProps = "";
  56461. for (var i = 0; i < props.length; i++) {
  56462. var prop = props[i];
  56463. var value = transformSpecialNewlines(prop.value);
  56464. if (prop.dynamic) {
  56465. dynamicProps += (prop.name) + "," + value + ",";
  56466. } else {
  56467. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  56468. }
  56469. }
  56470. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  56471. if (dynamicProps) {
  56472. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  56473. } else {
  56474. return staticProps
  56475. }
  56476. }
  56477. // #3895, #4268
  56478. function transformSpecialNewlines (text) {
  56479. return text
  56480. .replace(/\u2028/g, '\\u2028')
  56481. .replace(/\u2029/g, '\\u2029')
  56482. }
  56483. /* */
  56484. // these keywords should not appear inside expressions, but operators like
  56485. // typeof, instanceof and in are allowed
  56486. var prohibitedKeywordRE = new RegExp('\\b' + (
  56487. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  56488. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  56489. 'extends,finally,continue,debugger,function,arguments'
  56490. ).split(',').join('\\b|\\b') + '\\b');
  56491. // these unary operators should not be used as property/method names
  56492. var unaryOperatorsRE = new RegExp('\\b' + (
  56493. 'delete,typeof,void'
  56494. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  56495. // strip strings in expressions
  56496. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  56497. // detect problematic expressions in a template
  56498. function detectErrors (ast, warn) {
  56499. if (ast) {
  56500. checkNode(ast, warn);
  56501. }
  56502. }
  56503. function checkNode (node, warn) {
  56504. if (node.type === 1) {
  56505. for (var name in node.attrsMap) {
  56506. if (dirRE.test(name)) {
  56507. var value = node.attrsMap[name];
  56508. if (value) {
  56509. var range = node.rawAttrsMap[name];
  56510. if (name === 'v-for') {
  56511. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  56512. } else if (name === 'v-slot' || name[0] === '#') {
  56513. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  56514. } else if (onRE.test(name)) {
  56515. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  56516. } else {
  56517. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  56518. }
  56519. }
  56520. }
  56521. }
  56522. if (node.children) {
  56523. for (var i = 0; i < node.children.length; i++) {
  56524. checkNode(node.children[i], warn);
  56525. }
  56526. }
  56527. } else if (node.type === 2) {
  56528. checkExpression(node.expression, node.text, warn, node);
  56529. }
  56530. }
  56531. function checkEvent (exp, text, warn, range) {
  56532. var stripped = exp.replace(stripStringRE, '');
  56533. var keywordMatch = stripped.match(unaryOperatorsRE);
  56534. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  56535. warn(
  56536. "avoid using JavaScript unary operator as property name: " +
  56537. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  56538. range
  56539. );
  56540. }
  56541. checkExpression(exp, text, warn, range);
  56542. }
  56543. function checkFor (node, text, warn, range) {
  56544. checkExpression(node.for || '', text, warn, range);
  56545. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  56546. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  56547. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  56548. }
  56549. function checkIdentifier (
  56550. ident,
  56551. type,
  56552. text,
  56553. warn,
  56554. range
  56555. ) {
  56556. if (typeof ident === 'string') {
  56557. try {
  56558. new Function(("var " + ident + "=_"));
  56559. } catch (e) {
  56560. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  56561. }
  56562. }
  56563. }
  56564. function checkExpression (exp, text, warn, range) {
  56565. try {
  56566. new Function(("return " + exp));
  56567. } catch (e) {
  56568. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  56569. if (keywordMatch) {
  56570. warn(
  56571. "avoid using JavaScript keyword as property name: " +
  56572. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  56573. range
  56574. );
  56575. } else {
  56576. warn(
  56577. "invalid expression: " + (e.message) + " in\n\n" +
  56578. " " + exp + "\n\n" +
  56579. " Raw expression: " + (text.trim()) + "\n",
  56580. range
  56581. );
  56582. }
  56583. }
  56584. }
  56585. function checkFunctionParameterExpression (exp, text, warn, range) {
  56586. try {
  56587. new Function(exp, '');
  56588. } catch (e) {
  56589. warn(
  56590. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  56591. " " + exp + "\n\n" +
  56592. " Raw expression: " + (text.trim()) + "\n",
  56593. range
  56594. );
  56595. }
  56596. }
  56597. /* */
  56598. var range = 2;
  56599. function generateCodeFrame (
  56600. source,
  56601. start,
  56602. end
  56603. ) {
  56604. if ( start === void 0 ) start = 0;
  56605. if ( end === void 0 ) end = source.length;
  56606. var lines = source.split(/\r?\n/);
  56607. var count = 0;
  56608. var res = [];
  56609. for (var i = 0; i < lines.length; i++) {
  56610. count += lines[i].length + 1;
  56611. if (count >= start) {
  56612. for (var j = i - range; j <= i + range || end > count; j++) {
  56613. if (j < 0 || j >= lines.length) { continue }
  56614. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  56615. var lineLength = lines[j].length;
  56616. if (j === i) {
  56617. // push underline
  56618. var pad = start - (count - lineLength) + 1;
  56619. var length = end > count ? lineLength - pad : end - start;
  56620. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  56621. } else if (j > i) {
  56622. if (end > count) {
  56623. var length$1 = Math.min(end - count, lineLength);
  56624. res.push(" | " + repeat$1("^", length$1));
  56625. }
  56626. count += lineLength + 1;
  56627. }
  56628. }
  56629. break
  56630. }
  56631. }
  56632. return res.join('\n')
  56633. }
  56634. function repeat$1 (str, n) {
  56635. var result = '';
  56636. if (n > 0) {
  56637. while (true) { // eslint-disable-line
  56638. if (n & 1) { result += str; }
  56639. n >>>= 1;
  56640. if (n <= 0) { break }
  56641. str += str;
  56642. }
  56643. }
  56644. return result
  56645. }
  56646. /* */
  56647. function createFunction (code, errors) {
  56648. try {
  56649. return new Function(code)
  56650. } catch (err) {
  56651. errors.push({ err: err, code: code });
  56652. return noop
  56653. }
  56654. }
  56655. function createCompileToFunctionFn (compile) {
  56656. var cache = Object.create(null);
  56657. return function compileToFunctions (
  56658. template,
  56659. options,
  56660. vm
  56661. ) {
  56662. options = extend({}, options);
  56663. var warn$$1 = options.warn || warn;
  56664. delete options.warn;
  56665. /* istanbul ignore if */
  56666. {
  56667. // detect possible CSP restriction
  56668. try {
  56669. new Function('return 1');
  56670. } catch (e) {
  56671. if (e.toString().match(/unsafe-eval|CSP/)) {
  56672. warn$$1(
  56673. 'It seems you are using the standalone build of Vue.js in an ' +
  56674. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  56675. 'The template compiler cannot work in this environment. Consider ' +
  56676. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  56677. 'templates into render functions.'
  56678. );
  56679. }
  56680. }
  56681. }
  56682. // check cache
  56683. var key = options.delimiters
  56684. ? String(options.delimiters) + template
  56685. : template;
  56686. if (cache[key]) {
  56687. return cache[key]
  56688. }
  56689. // compile
  56690. var compiled = compile(template, options);
  56691. // check compilation errors/tips
  56692. {
  56693. if (compiled.errors && compiled.errors.length) {
  56694. if (options.outputSourceRange) {
  56695. compiled.errors.forEach(function (e) {
  56696. warn$$1(
  56697. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  56698. generateCodeFrame(template, e.start, e.end),
  56699. vm
  56700. );
  56701. });
  56702. } else {
  56703. warn$$1(
  56704. "Error compiling template:\n\n" + template + "\n\n" +
  56705. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  56706. vm
  56707. );
  56708. }
  56709. }
  56710. if (compiled.tips && compiled.tips.length) {
  56711. if (options.outputSourceRange) {
  56712. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  56713. } else {
  56714. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  56715. }
  56716. }
  56717. }
  56718. // turn code into functions
  56719. var res = {};
  56720. var fnGenErrors = [];
  56721. res.render = createFunction(compiled.render, fnGenErrors);
  56722. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  56723. return createFunction(code, fnGenErrors)
  56724. });
  56725. // check function generation errors.
  56726. // this should only happen if there is a bug in the compiler itself.
  56727. // mostly for codegen development use
  56728. /* istanbul ignore if */
  56729. {
  56730. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  56731. warn$$1(
  56732. "Failed to generate render function:\n\n" +
  56733. fnGenErrors.map(function (ref) {
  56734. var err = ref.err;
  56735. var code = ref.code;
  56736. return ((err.toString()) + " in\n\n" + code + "\n");
  56737. }).join('\n'),
  56738. vm
  56739. );
  56740. }
  56741. }
  56742. return (cache[key] = res)
  56743. }
  56744. }
  56745. /* */
  56746. function createCompilerCreator (baseCompile) {
  56747. return function createCompiler (baseOptions) {
  56748. function compile (
  56749. template,
  56750. options
  56751. ) {
  56752. var finalOptions = Object.create(baseOptions);
  56753. var errors = [];
  56754. var tips = [];
  56755. var warn = function (msg, range, tip) {
  56756. (tip ? tips : errors).push(msg);
  56757. };
  56758. if (options) {
  56759. if (options.outputSourceRange) {
  56760. // $flow-disable-line
  56761. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  56762. warn = function (msg, range, tip) {
  56763. var data = { msg: msg };
  56764. if (range) {
  56765. if (range.start != null) {
  56766. data.start = range.start + leadingSpaceLength;
  56767. }
  56768. if (range.end != null) {
  56769. data.end = range.end + leadingSpaceLength;
  56770. }
  56771. }
  56772. (tip ? tips : errors).push(data);
  56773. };
  56774. }
  56775. // merge custom modules
  56776. if (options.modules) {
  56777. finalOptions.modules =
  56778. (baseOptions.modules || []).concat(options.modules);
  56779. }
  56780. // merge custom directives
  56781. if (options.directives) {
  56782. finalOptions.directives = extend(
  56783. Object.create(baseOptions.directives || null),
  56784. options.directives
  56785. );
  56786. }
  56787. // copy other options
  56788. for (var key in options) {
  56789. if (key !== 'modules' && key !== 'directives') {
  56790. finalOptions[key] = options[key];
  56791. }
  56792. }
  56793. }
  56794. finalOptions.warn = warn;
  56795. var compiled = baseCompile(template.trim(), finalOptions);
  56796. {
  56797. detectErrors(compiled.ast, warn);
  56798. }
  56799. compiled.errors = errors;
  56800. compiled.tips = tips;
  56801. return compiled
  56802. }
  56803. return {
  56804. compile: compile,
  56805. compileToFunctions: createCompileToFunctionFn(compile)
  56806. }
  56807. }
  56808. }
  56809. /* */
  56810. // `createCompilerCreator` allows creating compilers that use alternative
  56811. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  56812. // Here we just export a default compiler using the default parts.
  56813. var createCompiler = createCompilerCreator(function baseCompile (
  56814. template,
  56815. options
  56816. ) {
  56817. var ast = parse(template.trim(), options);
  56818. if (options.optimize !== false) {
  56819. optimize(ast, options);
  56820. }
  56821. var code = generate(ast, options);
  56822. return {
  56823. ast: ast,
  56824. render: code.render,
  56825. staticRenderFns: code.staticRenderFns
  56826. }
  56827. });
  56828. /* */
  56829. var ref$1 = createCompiler(baseOptions);
  56830. var compile = ref$1.compile;
  56831. var compileToFunctions = ref$1.compileToFunctions;
  56832. /* */
  56833. // check whether current browser encodes a char inside attribute values
  56834. var div;
  56835. function getShouldDecode (href) {
  56836. div = div || document.createElement('div');
  56837. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  56838. return div.innerHTML.indexOf('&#10;') > 0
  56839. }
  56840. // #3663: IE encodes newlines inside attribute values while other browsers don't
  56841. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  56842. // #6828: chrome encodes content in a[href]
  56843. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  56844. /* */
  56845. var idToTemplate = cached(function (id) {
  56846. var el = query(id);
  56847. return el && el.innerHTML
  56848. });
  56849. var mount = Vue.prototype.$mount;
  56850. Vue.prototype.$mount = function (
  56851. el,
  56852. hydrating
  56853. ) {
  56854. el = el && query(el);
  56855. /* istanbul ignore if */
  56856. if (el === document.body || el === document.documentElement) {
  56857. warn(
  56858. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  56859. );
  56860. return this
  56861. }
  56862. var options = this.$options;
  56863. // resolve template/el and convert to render function
  56864. if (!options.render) {
  56865. var template = options.template;
  56866. if (template) {
  56867. if (typeof template === 'string') {
  56868. if (template.charAt(0) === '#') {
  56869. template = idToTemplate(template);
  56870. /* istanbul ignore if */
  56871. if (!template) {
  56872. warn(
  56873. ("Template element not found or is empty: " + (options.template)),
  56874. this
  56875. );
  56876. }
  56877. }
  56878. } else if (template.nodeType) {
  56879. template = template.innerHTML;
  56880. } else {
  56881. {
  56882. warn('invalid template option:' + template, this);
  56883. }
  56884. return this
  56885. }
  56886. } else if (el) {
  56887. template = getOuterHTML(el);
  56888. }
  56889. if (template) {
  56890. /* istanbul ignore if */
  56891. if (config.performance && mark) {
  56892. mark('compile');
  56893. }
  56894. var ref = compileToFunctions(template, {
  56895. outputSourceRange: "development" !== 'production',
  56896. shouldDecodeNewlines: shouldDecodeNewlines,
  56897. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  56898. delimiters: options.delimiters,
  56899. comments: options.comments
  56900. }, this);
  56901. var render = ref.render;
  56902. var staticRenderFns = ref.staticRenderFns;
  56903. options.render = render;
  56904. options.staticRenderFns = staticRenderFns;
  56905. /* istanbul ignore if */
  56906. if (config.performance && mark) {
  56907. mark('compile end');
  56908. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  56909. }
  56910. }
  56911. }
  56912. return mount.call(this, el, hydrating)
  56913. };
  56914. /**
  56915. * Get outerHTML of elements, taking care
  56916. * of SVG elements in IE as well.
  56917. */
  56918. function getOuterHTML (el) {
  56919. if (el.outerHTML) {
  56920. return el.outerHTML
  56921. } else {
  56922. var container = document.createElement('div');
  56923. container.appendChild(el.cloneNode(true));
  56924. return container.innerHTML
  56925. }
  56926. }
  56927. Vue.compile = compileToFunctions;
  56928. module.exports = Vue;
  56929. /* 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))
  56930. /***/ }),
  56931. /***/ "./node_modules/vue/dist/vue.common.js":
  56932. /*!*********************************************!*\
  56933. !*** ./node_modules/vue/dist/vue.common.js ***!
  56934. \*********************************************/
  56935. /*! no static exports found */
  56936. /***/ (function(module, exports, __webpack_require__) {
  56937. if (false) {} else {
  56938. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  56939. }
  56940. /***/ }),
  56941. /***/ "./node_modules/webpack/buildin/global.js":
  56942. /*!***********************************!*\
  56943. !*** (webpack)/buildin/global.js ***!
  56944. \***********************************/
  56945. /*! no static exports found */
  56946. /***/ (function(module, exports) {
  56947. var g;
  56948. // This works in non-strict mode
  56949. g = (function() {
  56950. return this;
  56951. })();
  56952. try {
  56953. // This works if eval is allowed (see CSP)
  56954. g = g || new Function("return this")();
  56955. } catch (e) {
  56956. // This works if the window reference is available
  56957. if (typeof window === "object") g = window;
  56958. }
  56959. // g can still be undefined, but nothing to do about it...
  56960. // We return undefined, instead of nothing here, so it's
  56961. // easier to handle this case. if(!global) { ...}
  56962. module.exports = g;
  56963. /***/ }),
  56964. /***/ "./node_modules/webpack/buildin/module.js":
  56965. /*!***********************************!*\
  56966. !*** (webpack)/buildin/module.js ***!
  56967. \***********************************/
  56968. /*! no static exports found */
  56969. /***/ (function(module, exports) {
  56970. module.exports = function(module) {
  56971. if (!module.webpackPolyfill) {
  56972. module.deprecate = function() {};
  56973. module.paths = [];
  56974. // module.parent = undefined by default
  56975. if (!module.children) module.children = [];
  56976. Object.defineProperty(module, "loaded", {
  56977. enumerable: true,
  56978. get: function() {
  56979. return module.l;
  56980. }
  56981. });
  56982. Object.defineProperty(module, "id", {
  56983. enumerable: true,
  56984. get: function() {
  56985. return module.i;
  56986. }
  56987. });
  56988. module.webpackPolyfill = 1;
  56989. }
  56990. return module;
  56991. };
  56992. /***/ }),
  56993. /***/ "./resources/js/app.js":
  56994. /*!*****************************!*\
  56995. !*** ./resources/js/app.js ***!
  56996. \*****************************/
  56997. /*! no exports provided */
  56998. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56999. "use strict";
  57000. __webpack_require__.r(__webpack_exports__);
  57001. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  57002. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  57003. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  57004. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  57005. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  57006. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  57007. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  57008. /**
  57009. * First we will load all of this project's JavaScript dependencies which
  57010. * includes Vue and other libraries. It is a great starting point when
  57011. * building robust, powerful web applications using Vue and Laravel.
  57012. */
  57013. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  57014. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  57015. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  57016. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  57017. //import WorkOrder from './views/WorkOrder'
  57018. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  57019. mode: 'history',
  57020. routes: [{
  57021. path: '/',
  57022. name: 'home',
  57023. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_5__["default"]
  57024. }, {
  57025. path: '/login',
  57026. name: 'login',
  57027. component: _views_Login__WEBPACK_IMPORTED_MODULE_4__["default"]
  57028. }, {
  57029. path: '/dashboard',
  57030. name: 'dashboard',
  57031. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  57032. }
  57033. /* {
  57034. path: '/workorders/:id',
  57035. name: 'workorders',
  57036. component: WorkOrder,
  57037. } */
  57038. ]
  57039. });
  57040. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  57041. el: '#app',
  57042. components: {
  57043. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  57044. },
  57045. router: router
  57046. });
  57047. $(function () {
  57048. $('[data-toggle="tooltip"]').tooltip();
  57049. });
  57050. var clipboard = new Clipboard('.btn-clip');
  57051. clipboard.on('success', function (e) {
  57052. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  57053. position: "right",
  57054. className: 'success'
  57055. });
  57056. e.clearSelection();
  57057. });
  57058. /***/ }),
  57059. /***/ "./resources/js/bootstrap.js":
  57060. /*!***********************************!*\
  57061. !*** ./resources/js/bootstrap.js ***!
  57062. \***********************************/
  57063. /*! no exports provided */
  57064. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57065. "use strict";
  57066. __webpack_require__.r(__webpack_exports__);
  57067. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  57068. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  57069. /**
  57070. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  57071. * for JavaScript based Bootstrap features such as modals and tabs. This
  57072. * code may be modified to fit the specific needs of your application.
  57073. */
  57074. try {
  57075. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  57076. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  57077. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  57078. } catch (e) {}
  57079. /**
  57080. * We'll load the axios HTTP library which allows us to easily issue requests
  57081. * to our Laravel back-end. This library automatically handles sending the
  57082. * CSRF token as a header based on the value of the "XSRF" token cookie.
  57083. */
  57084. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  57085. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  57086. /**
  57087. * Echo exposes an expressive API for subscribing to channels and listening
  57088. * for events that are broadcast by Laravel. Echo and event broadcasting
  57089. * allows your team to easily build robust real-time web applications.
  57090. */
  57091. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  57092. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  57093. broadcaster: 'pusher',
  57094. key: "upccrt",
  57095. authEndpoint: '/broadcasting/auth',
  57096. wsHost: window.location.hostname,
  57097. wsPort: 6001,
  57098. disableStats: true
  57099. });
  57100. /***/ }),
  57101. /***/ "./resources/js/notify.min.js":
  57102. /*!************************************!*\
  57103. !*** ./resources/js/notify.min.js ***!
  57104. \************************************/
  57105. /*! no static exports found */
  57106. /***/ (function(module, exports, __webpack_require__) {
  57107. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  57108. (function (e) {
  57109. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  57110. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  57111. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  57112. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  57113. })(function (e) {
  57114. function A(t, n, i) {
  57115. typeof i == "string" && (i = {
  57116. className: i
  57117. }), this.options = E(w, e.isPlainObject(i) ? i : {}), this.loadHTML(), this.wrapper = e(h.html), this.options.clickToHide && this.wrapper.addClass(r + "-hidable"), this.wrapper.data(r, this), this.arrow = this.wrapper.find("." + r + "-arrow"), this.container = this.wrapper.find("." + r + "-container"), this.container.append(this.userContainer), t && t.length && (this.elementType = t.attr("type"), this.originalElement = t, this.elem = N(t), this.elem.data(r, this), this.elem.before(this.wrapper)), this.container.hide(), this.run(n);
  57118. }
  57119. var t = [].indexOf || function (e) {
  57120. for (var t = 0, n = this.length; t < n; t++) {
  57121. if (t in this && this[t] === e) return t;
  57122. }
  57123. return -1;
  57124. },
  57125. n = "notify",
  57126. r = n + "js",
  57127. i = n + "!blank",
  57128. s = {
  57129. t: "top",
  57130. m: "middle",
  57131. b: "bottom",
  57132. l: "left",
  57133. c: "center",
  57134. r: "right"
  57135. },
  57136. o = ["l", "c", "r"],
  57137. u = ["t", "m", "b"],
  57138. a = ["t", "b", "l", "r"],
  57139. f = {
  57140. t: "b",
  57141. m: null,
  57142. b: "t",
  57143. l: "r",
  57144. c: null,
  57145. r: "l"
  57146. },
  57147. l = function l(t) {
  57148. var n;
  57149. return n = [], e.each(t.split(/\W+/), function (e, t) {
  57150. var r;
  57151. r = t.toLowerCase().charAt(0);
  57152. if (s[r]) return n.push(r);
  57153. }), n;
  57154. },
  57155. c = {},
  57156. h = {
  57157. name: "core",
  57158. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  57159. css: "." + r + "-corner {\n position: fixed;\n margin: 5px;\n z-index: 1050;\n}\n\n." + r + "-corner ." + r + "-wrapper,\n." + r + "-corner ." + r + "-container {\n position: relative;\n display: block;\n height: inherit;\n width: inherit;\n margin: 3px;\n}\n\n." + r + "-wrapper {\n z-index: 1;\n position: absolute;\n display: inline-block;\n height: 0;\n width: 0;\n}\n\n." + r + "-container {\n display: none;\n z-index: 1;\n position: absolute;\n}\n\n." + r + "-hidable {\n cursor: pointer;\n}\n\n[data-notify-text],[data-notify-html] {\n position: relative;\n}\n\n." + r + "-arrow {\n position: absolute;\n z-index: 2;\n width: 0;\n height: 0;\n}"
  57160. },
  57161. p = {
  57162. "border-radius": ["-webkit-", "-moz-"]
  57163. },
  57164. d = function d(e) {
  57165. return c[e];
  57166. },
  57167. v = function v(e) {
  57168. if (!e) throw "Missing Style name";
  57169. c[e] && delete c[e];
  57170. },
  57171. m = function m(t, i) {
  57172. if (!t) throw "Missing Style name";
  57173. if (!i) throw "Missing Style definition";
  57174. if (!i.html) throw "Missing Style HTML";
  57175. var s = c[t];
  57176. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  57177. var o = "";
  57178. i.classes && e.each(i.classes, function (t, n) {
  57179. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  57180. return p[t] && e.each(p[t], function (e, r) {
  57181. return o += " " + r + t + ": " + n + ";\n";
  57182. }), o += " " + t + ": " + n + ";\n";
  57183. }), o += "}\n";
  57184. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  57185. var u = {},
  57186. a = e(i.html);
  57187. y("html", a, u), y("text", a, u), i.fields = u;
  57188. },
  57189. g = function g(t) {
  57190. var n, r, i;
  57191. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  57192. try {
  57193. r.html(t);
  57194. } catch (s) {
  57195. r[0].styleSheet.cssText = t;
  57196. }
  57197. return r;
  57198. },
  57199. y = function y(t, n, r) {
  57200. var s;
  57201. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  57202. var n;
  57203. n = e(this).attr(s), n || (n = i), r[n] = t;
  57204. });
  57205. },
  57206. b = function b(e, t) {
  57207. return e.is(t) ? e : e.find(t);
  57208. },
  57209. w = {
  57210. clickToHide: !0,
  57211. autoHide: !0,
  57212. autoHideDelay: 5e3,
  57213. arrowShow: !0,
  57214. arrowSize: 5,
  57215. breakNewLines: !0,
  57216. elementPosition: "bottom",
  57217. globalPosition: "top right",
  57218. style: "bootstrap",
  57219. className: "error",
  57220. showAnimation: "slideDown",
  57221. showDuration: 400,
  57222. hideAnimation: "slideUp",
  57223. hideDuration: 200,
  57224. gap: 5
  57225. },
  57226. E = function E(t, n) {
  57227. var r;
  57228. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  57229. },
  57230. S = function S(t) {
  57231. return e.extend(w, t);
  57232. },
  57233. x = function x(t) {
  57234. return e("<" + t + "></" + t + ">");
  57235. },
  57236. T = {},
  57237. N = function N(t) {
  57238. var n;
  57239. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  57240. return e(r).attr("name") === t.attr("name");
  57241. }), t = n.first()), t;
  57242. },
  57243. C = function C(e, t, n) {
  57244. var r, i;
  57245. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  57246. if (isNaN(n)) return;
  57247. return r = s[f[t.charAt(0)]], i = t, e[r] !== undefined && (t = s[r.charAt(0)], n = -n), e[t] === undefined ? e[t] = n : e[t] += n, null;
  57248. },
  57249. k = function k(e, t, n) {
  57250. if (e === "l" || e === "t") return 0;
  57251. if (e === "c" || e === "m") return n / 2 - t / 2;
  57252. if (e === "r" || e === "b") return n - t;
  57253. throw "Invalid alignment";
  57254. },
  57255. L = function L(e) {
  57256. return L.e = L.e || x("div"), L.e.text(e).html();
  57257. };
  57258. A.prototype.loadHTML = function () {
  57259. var t;
  57260. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  57261. }, A.prototype.show = function (e, t) {
  57262. var n, r, i, s, o;
  57263. r = function (n) {
  57264. return function () {
  57265. !e && !n.elem && n.destroy();
  57266. if (t) return t();
  57267. };
  57268. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  57269. if (o && e) s = "show";else if (o && !e) s = "hide";else if (!o && e) s = this.options.showAnimation, n.push(this.options.showDuration);else {
  57270. if (!!o || !!e) return r();
  57271. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  57272. }
  57273. return n.push(r), i[s].apply(i, n);
  57274. }, A.prototype.setGlobalPosition = function () {
  57275. var t = this.getPosition(),
  57276. n = t[0],
  57277. i = t[1],
  57278. o = s[n],
  57279. u = s[i],
  57280. a = n + "|" + i,
  57281. f = T[a];
  57282. if (!f || !document.body.contains(f[0])) {
  57283. f = T[a] = x("div");
  57284. var l = {};
  57285. l[o] = 0, u === "middle" ? l.top = "45%" : u === "center" ? l.left = "45%" : l[u] = 0, f.css(l).addClass(r + "-corner"), e("body").append(f);
  57286. }
  57287. return f.prepend(this.wrapper);
  57288. }, A.prototype.setElementPosition = function () {
  57289. var n, r, i, l, c, h, p, d, v, m, g, y, b, w, E, S, x, T, N, L, A, O, M, _, D, P, H, B, j;
  57290. H = this.getPosition(), _ = H[0], O = H[1], M = H[2], g = this.elem.position(), d = this.elem.outerHeight(), y = this.elem.outerWidth(), v = this.elem.innerHeight(), m = this.elem.innerWidth(), j = this.wrapper.position(), c = this.container.height(), h = this.container.width(), T = s[_], L = f[_], A = s[L], p = {}, p[A] = _ === "b" ? d : _ === "r" ? y : 0, C(p, "top", g.top - j.top), C(p, "left", g.left - j.left), B = ["top", "left"];
  57291. for (w = 0, S = B.length; w < S; w++) {
  57292. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  57293. }
  57294. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  57295. if (!this.options.arrowShow) this.arrow.hide();else {
  57296. i = this.options.arrowSize, r = e.extend({}, p), n = this.userContainer.css("border-color") || this.userContainer.css("border-top-color") || this.userContainer.css("background-color") || "white";
  57297. for (E = 0, x = a.length; E < x; E++) {
  57298. D = a[E], P = s[D];
  57299. if (D === L) continue;
  57300. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  57301. }
  57302. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  57303. }
  57304. t.call(u, _) >= 0 ? (C(p, "left", k(O, h, y)), r && C(r, "left", k(O, i, m))) : t.call(o, _) >= 0 && (C(p, "top", k(O, c, d)), r && C(r, "top", k(O, i, v))), this.container.is(":visible") && (p.display = "block"), this.container.removeAttr("style").css(p);
  57305. if (r) return this.arrow.removeAttr("style").css(r);
  57306. }, A.prototype.getPosition = function () {
  57307. var e, n, r, i, s, f, c, h;
  57308. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  57309. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  57310. if (e.length === 1 || (r = e[0], t.call(u, r) >= 0) && (i = e[1], t.call(o, i) < 0) || (s = e[0], t.call(o, s) >= 0) && (f = e[1], t.call(u, f) < 0)) e[1] = (c = e[0], t.call(o, c) >= 0) ? "m" : "l";
  57311. return e.length === 2 && (e[2] = e[1]), e;
  57312. }, A.prototype.getStyle = function (e) {
  57313. var t;
  57314. e || (e = this.options.style), e || (e = "default"), t = c[e];
  57315. if (!t) throw "Missing style: " + e;
  57316. return t;
  57317. }, A.prototype.updateClasses = function () {
  57318. var t, n;
  57319. return t = ["base"], e.isArray(this.options.className) ? t = t.concat(this.options.className) : this.options.className && t.push(this.options.className), n = this.getStyle(), t = e.map(t, function (e) {
  57320. return r + "-" + n.name + "-" + e;
  57321. }).join(" "), this.userContainer.attr("class", t);
  57322. }, A.prototype.run = function (t, n) {
  57323. var r, s, o, u, a;
  57324. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  57325. if (this.container && !t) {
  57326. this.show(!1);
  57327. return;
  57328. }
  57329. if (!this.container && !t) return;
  57330. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  57331. for (o in s) {
  57332. r = s[o], u = this.userFields[o];
  57333. if (!u) continue;
  57334. u === "text" && (r = L(r), this.options.breakNewLines && (r = r.replace(/\n/g, "<br/>"))), a = o === i ? "" : "=" + o, b(this.userContainer, "[data-notify-" + u + a + "]").html(r);
  57335. }
  57336. this.updateClasses(), this.elem ? this.setElementPosition() : this.setGlobalPosition(), this.show(!0), this.options.autoHide && (clearTimeout(this.autohideTimer), this.autohideTimer = setTimeout(this.show.bind(this, !1), this.options.autoHideDelay));
  57337. }, A.prototype.destroy = function () {
  57338. this.wrapper.data(r, null), this.wrapper.remove();
  57339. }, e[n] = function (t, r, i) {
  57340. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  57341. }, e.fn[n] = function (t, n) {
  57342. return e(this).each(function () {
  57343. var i = N(e(this)).data(r);
  57344. i && i.destroy();
  57345. var s = new A(e(this), t, n);
  57346. }), this;
  57347. }, e.extend(e[n], {
  57348. defaults: S,
  57349. addStyle: m,
  57350. removeStyle: v,
  57351. pluginOptions: w,
  57352. getStyle: d,
  57353. insertCSS: g
  57354. }), m("bootstrap", {
  57355. html: "<div>\n<span data-notify-text></span>\n</div>",
  57356. classes: {
  57357. base: {
  57358. "font-weight": "bold",
  57359. padding: "8px 15px 8px 14px",
  57360. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  57361. "background-color": "#fcf8e3",
  57362. border: "1px solid #fbeed5",
  57363. "border-radius": "4px",
  57364. "white-space": "nowrap",
  57365. "padding-left": "25px",
  57366. "background-repeat": "no-repeat",
  57367. "background-position": "3px 7px"
  57368. },
  57369. error: {
  57370. color: "#B94A48",
  57371. "background-color": "#F2DEDE",
  57372. "border-color": "#EED3D7",
  57373. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY88FCEk9Yiwf8RhgRyaHFQpPHCDmZG5oX2ui2yilkcTT1AcDsbYC1NMAyOi7zTX2Agx7A9luAl88BauiiQ/cJaZQfIpAlngDcvZZMrl8vFPK5+XktrWlx3/ehZ5r9+t6e+WVnp1pxnNIjgBe4/6dAysQc8dsmHwPcW9C0h3fW1hans1ltwJhy0GxK7XZbUlMp5Ww2eyan6+ft/f2FAqXGK4CvQk5HueFz7D6GOZtIrK+srupdx1GRBBqNBtzc2AiMr7nPplRdKhb1q6q6zjFhrklEFOUutoQ50xcX86ZlqaZpQrfbBdu2R6/G19zX6XSgh6RX5ubyHCM8nqSID6ICrGiZjGYYxojEsiw4PDwMSL5VKsC8Yf4VRYFzMzMaxwjlJSlCyAQ9l0CW44PBADzXhe7xMdi9HtTrdYjFYkDQL0cn4Xdq2/EAE+InCnvADTf2eah4Sx9vExQjkqXT6aAERICMewd/UAp/IeYANM2joxt+q5VI+ieq2i0Wg3l6DNzHwTERPgo1ko7XBXj3vdlsT2F+UuhIhYkp7u7CarkcrFOCtR3H5JiwbAIeImjT/YQKKBtGjRFCU5IUgFRe7fF4cCNVIPMYo3VKqxwjyNAXNepuopyqnld602qVsfRpEkkz+GFL1wPj6ySXBpJtWVa5xlhpcyhBNwpZHmtX8AGgfIExo0ZpzkWVTBGiXCSEaHh62/PoR0p/vHaczxXGnj4bSo+G78lELU80h1uogBwWLf5YlsPmgDEd4M236xjm+8nm4IuE/9u+/PH2JXZfbwz4zw1WbO+SQPpXfwG/BBgAhCNZiSb/pOQAAAAASUVORK5CYII=)"
  57374. },
  57375. success: {
  57376. color: "#468847",
  57377. "background-color": "#DFF0D8",
  57378. "border-color": "#D6E9C6",
  57379. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLSQWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)"
  57380. },
  57381. info: {
  57382. color: "#3A87AD",
  57383. "background-color": "#D9EDF7",
  57384. "border-color": "#BCE8F1",
  57385. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzgnBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)"
  57386. },
  57387. warn: {
  57388. color: "#C09853",
  57389. "background-color": "#FCF8E3",
  57390. "border-color": "#FBEED5",
  57391. "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)"
  57392. }
  57393. }
  57394. }), e(function () {
  57395. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  57396. e(this).trigger("notify-hide");
  57397. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  57398. var n = e(this).data(r);
  57399. n && n.show(!1);
  57400. });
  57401. });
  57402. });
  57403. /***/ }),
  57404. /***/ "./resources/js/views/App.vue":
  57405. /*!************************************!*\
  57406. !*** ./resources/js/views/App.vue ***!
  57407. \************************************/
  57408. /*! exports provided: default */
  57409. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57410. "use strict";
  57411. __webpack_require__.r(__webpack_exports__);
  57412. /* harmony import */ var _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./App.vue?vue&type=template&id=91ac6b5c& */ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&");
  57413. /* harmony import */ var _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./App.vue?vue&type=script&lang=js& */ "./resources/js/views/App.vue?vue&type=script&lang=js&");
  57414. /* 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");
  57415. /* normalize component */
  57416. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  57417. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  57418. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  57419. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  57420. false,
  57421. null,
  57422. null,
  57423. null
  57424. )
  57425. /* hot reload */
  57426. if (false) { var api; }
  57427. component.options.__file = "resources/js/views/App.vue"
  57428. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  57429. /***/ }),
  57430. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  57431. /*!*************************************************************!*\
  57432. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  57433. \*************************************************************/
  57434. /*! exports provided: default */
  57435. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57436. "use strict";
  57437. __webpack_require__.r(__webpack_exports__);
  57438. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_App_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!./App.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&");
  57439. /* 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_App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  57440. /***/ }),
  57441. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  57442. /*!*******************************************************************!*\
  57443. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  57444. \*******************************************************************/
  57445. /*! exports provided: render, staticRenderFns */
  57446. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57447. "use strict";
  57448. __webpack_require__.r(__webpack_exports__);
  57449. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_App_vue_vue_type_template_id_91ac6b5c___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!./App.vue?vue&type=template&id=91ac6b5c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&");
  57450. /* 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_App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  57451. /* 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_App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  57452. /***/ }),
  57453. /***/ "./resources/js/views/Dashboard.vue":
  57454. /*!******************************************!*\
  57455. !*** ./resources/js/views/Dashboard.vue ***!
  57456. \******************************************/
  57457. /*! no static exports found */
  57458. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57459. "use strict";
  57460. __webpack_require__.r(__webpack_exports__);
  57461. /* harmony import */ var _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Dashboard.vue?vue&type=template&id=1f79daf6& */ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&");
  57462. /* harmony import */ var _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Dashboard.vue?vue&type=script&lang=js& */ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&");
  57463. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  57464. /* 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");
  57465. /* normalize component */
  57466. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  57467. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  57468. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  57469. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  57470. false,
  57471. null,
  57472. null,
  57473. null
  57474. )
  57475. /* hot reload */
  57476. if (false) { var api; }
  57477. component.options.__file = "resources/js/views/Dashboard.vue"
  57478. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  57479. /***/ }),
  57480. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  57481. /*!*******************************************************************!*\
  57482. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  57483. \*******************************************************************/
  57484. /*! no static exports found */
  57485. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57486. "use strict";
  57487. __webpack_require__.r(__webpack_exports__);
  57488. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Dashboard_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!./Dashboard.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&");
  57489. /* 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_Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  57490. /***/ }),
  57491. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  57492. /*!*************************************************************************!*\
  57493. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  57494. \*************************************************************************/
  57495. /*! exports provided: render, staticRenderFns */
  57496. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57497. "use strict";
  57498. __webpack_require__.r(__webpack_exports__);
  57499. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Dashboard_vue_vue_type_template_id_1f79daf6___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!./Dashboard.vue?vue&type=template&id=1f79daf6& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&");
  57500. /* 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_Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  57501. /* 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_Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  57502. /***/ }),
  57503. /***/ "./resources/js/views/Login.vue":
  57504. /*!**************************************!*\
  57505. !*** ./resources/js/views/Login.vue ***!
  57506. \**************************************/
  57507. /*! exports provided: default */
  57508. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57509. "use strict";
  57510. __webpack_require__.r(__webpack_exports__);
  57511. /* harmony import */ var _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Login.vue?vue&type=template&id=12f5395a& */ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&");
  57512. /* harmony import */ var _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Login.vue?vue&type=script&lang=js& */ "./resources/js/views/Login.vue?vue&type=script&lang=js&");
  57513. /* 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");
  57514. /* normalize component */
  57515. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  57516. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  57517. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  57518. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  57519. false,
  57520. null,
  57521. null,
  57522. null
  57523. )
  57524. /* hot reload */
  57525. if (false) { var api; }
  57526. component.options.__file = "resources/js/views/Login.vue"
  57527. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  57528. /***/ }),
  57529. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  57530. /*!***************************************************************!*\
  57531. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  57532. \***************************************************************/
  57533. /*! exports provided: default */
  57534. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57535. "use strict";
  57536. __webpack_require__.r(__webpack_exports__);
  57537. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_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!./Login.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&");
  57538. /* 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_Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  57539. /***/ }),
  57540. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  57541. /*!*********************************************************************!*\
  57542. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  57543. \*********************************************************************/
  57544. /*! exports provided: render, staticRenderFns */
  57545. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57546. "use strict";
  57547. __webpack_require__.r(__webpack_exports__);
  57548. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Login_vue_vue_type_template_id_12f5395a___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!./Login.vue?vue&type=template&id=12f5395a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=template&id=12f5395a&");
  57549. /* 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_Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  57550. /* 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_Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  57551. /***/ }),
  57552. /***/ "./resources/js/views/Welcome.vue":
  57553. /*!****************************************!*\
  57554. !*** ./resources/js/views/Welcome.vue ***!
  57555. \****************************************/
  57556. /*! exports provided: default */
  57557. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57558. "use strict";
  57559. __webpack_require__.r(__webpack_exports__);
  57560. /* harmony import */ var _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& */ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&");
  57561. /* harmony import */ var _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Welcome.vue?vue&type=script&lang=js& */ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&");
  57562. /* empty/unused harmony star reexport *//* harmony import */ var _Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  57563. /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
  57564. /* normalize component */
  57565. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  57566. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  57567. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  57568. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  57569. false,
  57570. null,
  57571. "1ae8ae93",
  57572. null
  57573. )
  57574. /* hot reload */
  57575. if (false) { var api; }
  57576. component.options.__file = "resources/js/views/Welcome.vue"
  57577. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  57578. /***/ }),
  57579. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  57580. /*!*****************************************************************!*\
  57581. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  57582. \*****************************************************************/
  57583. /*! exports provided: default */
  57584. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57585. "use strict";
  57586. __webpack_require__.r(__webpack_exports__);
  57587. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_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!./Welcome.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&");
  57588. /* 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_Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  57589. /***/ }),
  57590. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  57591. /*!*************************************************************************************************!*\
  57592. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  57593. \*************************************************************************************************/
  57594. /*! no static exports found */
  57595. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57596. "use strict";
  57597. __webpack_require__.r(__webpack_exports__);
  57598. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/style-loader!../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& */ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&");
  57599. /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
  57600. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  57601. /* harmony default export */ __webpack_exports__["default"] = (_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_style_index_0_id_1ae8ae93_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default.a);
  57602. /***/ }),
  57603. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  57604. /*!***********************************************************************************!*\
  57605. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  57606. \***********************************************************************************/
  57607. /*! exports provided: render, staticRenderFns */
  57608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57609. "use strict";
  57610. __webpack_require__.r(__webpack_exports__);
  57611. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___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!./Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&");
  57612. /* 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_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  57613. /* 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_Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  57614. /***/ }),
  57615. /***/ "./resources/sass/app.scss":
  57616. /*!*********************************!*\
  57617. !*** ./resources/sass/app.scss ***!
  57618. \*********************************/
  57619. /*! no static exports found */
  57620. /***/ (function(module, exports) {
  57621. // removed by extract-text-webpack-plugin
  57622. /***/ }),
  57623. /***/ 0:
  57624. /*!*************************************************************!*\
  57625. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  57626. \*************************************************************/
  57627. /*! no static exports found */
  57628. /***/ (function(module, exports, __webpack_require__) {
  57629. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  57630. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  57631. /***/ })
  57632. /******/ });