app.js 1.7 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. /* harmony default export */ __webpack_exports__["default"] = ({
  1621. props: ['asset'],
  1622. data: function data() {
  1623. return {
  1624. data: JSON.parse(this.asset)
  1625. };
  1626. },
  1627. mounted: function mounted() {
  1628. var _this = this;
  1629. Echo.channel('assets').listen('AssetUpdated', function (e) {
  1630. _this.data = JSON.parse(e.data);
  1631. });
  1632. }
  1633. });
  1634. /***/ }),
  1635. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  1636. /*!*********************************************************************************************************************************************************************!*\
  1637. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  1638. \*********************************************************************************************************************************************************************/
  1639. /*! exports provided: default */
  1640. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1641. "use strict";
  1642. __webpack_require__.r(__webpack_exports__);
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. //
  1668. //
  1669. //
  1670. //
  1671. //
  1672. //
  1673. /* harmony default export */ __webpack_exports__["default"] = ({
  1674. props: ['credential'],
  1675. data: function data() {
  1676. return {
  1677. data: JSON.parse(this.credential)
  1678. };
  1679. },
  1680. mounted: function mounted() {
  1681. var _this = this;
  1682. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  1683. _this.data = JSON.parse(e.data);
  1684. });
  1685. }
  1686. });
  1687. /***/ }),
  1688. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  1689. /*!*****************************************************************************************************************************************************************!*\
  1690. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  1691. \*****************************************************************************************************************************************************************/
  1692. /*! exports provided: default */
  1693. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1694. "use strict";
  1695. __webpack_require__.r(__webpack_exports__);
  1696. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1697. //
  1698. //
  1699. //
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. /* harmony default export */ __webpack_exports__["default"] = ({
  1716. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1717. props: ['workOrder'],
  1718. data: function data() {
  1719. return {
  1720. data: JSON.parse(this.workOrder)
  1721. };
  1722. },
  1723. mounted: function mounted() {
  1724. var _this = this;
  1725. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  1726. _this.data = JSON.parse(e.data);
  1727. });
  1728. }
  1729. });
  1730. /***/ }),
  1731. /***/ "./node_modules/base64-js/index.js":
  1732. /*!*****************************************!*\
  1733. !*** ./node_modules/base64-js/index.js ***!
  1734. \*****************************************/
  1735. /*! no static exports found */
  1736. /***/ (function(module, exports, __webpack_require__) {
  1737. "use strict";
  1738. exports.byteLength = byteLength
  1739. exports.toByteArray = toByteArray
  1740. exports.fromByteArray = fromByteArray
  1741. var lookup = []
  1742. var revLookup = []
  1743. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  1744. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  1745. for (var i = 0, len = code.length; i < len; ++i) {
  1746. lookup[i] = code[i]
  1747. revLookup[code.charCodeAt(i)] = i
  1748. }
  1749. // Support decoding URL-safe base64 strings, as Node.js does.
  1750. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  1751. revLookup['-'.charCodeAt(0)] = 62
  1752. revLookup['_'.charCodeAt(0)] = 63
  1753. function getLens (b64) {
  1754. var len = b64.length
  1755. if (len % 4 > 0) {
  1756. throw new Error('Invalid string. Length must be a multiple of 4')
  1757. }
  1758. // Trim off extra bytes after placeholder bytes are found
  1759. // See: https://github.com/beatgammit/base64-js/issues/42
  1760. var validLen = b64.indexOf('=')
  1761. if (validLen === -1) validLen = len
  1762. var placeHoldersLen = validLen === len
  1763. ? 0
  1764. : 4 - (validLen % 4)
  1765. return [validLen, placeHoldersLen]
  1766. }
  1767. // base64 is 4/3 + up to two characters of the original data
  1768. function byteLength (b64) {
  1769. var lens = getLens(b64)
  1770. var validLen = lens[0]
  1771. var placeHoldersLen = lens[1]
  1772. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1773. }
  1774. function _byteLength (b64, validLen, placeHoldersLen) {
  1775. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  1776. }
  1777. function toByteArray (b64) {
  1778. var tmp
  1779. var lens = getLens(b64)
  1780. var validLen = lens[0]
  1781. var placeHoldersLen = lens[1]
  1782. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  1783. var curByte = 0
  1784. // if there are placeholders, only get up to the last complete 4 chars
  1785. var len = placeHoldersLen > 0
  1786. ? validLen - 4
  1787. : validLen
  1788. var i
  1789. for (i = 0; i < len; i += 4) {
  1790. tmp =
  1791. (revLookup[b64.charCodeAt(i)] << 18) |
  1792. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  1793. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  1794. revLookup[b64.charCodeAt(i + 3)]
  1795. arr[curByte++] = (tmp >> 16) & 0xFF
  1796. arr[curByte++] = (tmp >> 8) & 0xFF
  1797. arr[curByte++] = tmp & 0xFF
  1798. }
  1799. if (placeHoldersLen === 2) {
  1800. tmp =
  1801. (revLookup[b64.charCodeAt(i)] << 2) |
  1802. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  1803. arr[curByte++] = tmp & 0xFF
  1804. }
  1805. if (placeHoldersLen === 1) {
  1806. tmp =
  1807. (revLookup[b64.charCodeAt(i)] << 10) |
  1808. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  1809. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  1810. arr[curByte++] = (tmp >> 8) & 0xFF
  1811. arr[curByte++] = tmp & 0xFF
  1812. }
  1813. return arr
  1814. }
  1815. function tripletToBase64 (num) {
  1816. return lookup[num >> 18 & 0x3F] +
  1817. lookup[num >> 12 & 0x3F] +
  1818. lookup[num >> 6 & 0x3F] +
  1819. lookup[num & 0x3F]
  1820. }
  1821. function encodeChunk (uint8, start, end) {
  1822. var tmp
  1823. var output = []
  1824. for (var i = start; i < end; i += 3) {
  1825. tmp =
  1826. ((uint8[i] << 16) & 0xFF0000) +
  1827. ((uint8[i + 1] << 8) & 0xFF00) +
  1828. (uint8[i + 2] & 0xFF)
  1829. output.push(tripletToBase64(tmp))
  1830. }
  1831. return output.join('')
  1832. }
  1833. function fromByteArray (uint8) {
  1834. var tmp
  1835. var len = uint8.length
  1836. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  1837. var parts = []
  1838. var maxChunkLength = 16383 // must be multiple of 3
  1839. // go through the array every three bytes, we'll deal with trailing stuff later
  1840. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  1841. parts.push(encodeChunk(
  1842. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  1843. ))
  1844. }
  1845. // pad the end with zeros, but make sure to not forget the extra bytes
  1846. if (extraBytes === 1) {
  1847. tmp = uint8[len - 1]
  1848. parts.push(
  1849. lookup[tmp >> 2] +
  1850. lookup[(tmp << 4) & 0x3F] +
  1851. '=='
  1852. )
  1853. } else if (extraBytes === 2) {
  1854. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  1855. parts.push(
  1856. lookup[tmp >> 10] +
  1857. lookup[(tmp >> 4) & 0x3F] +
  1858. lookup[(tmp << 2) & 0x3F] +
  1859. '='
  1860. )
  1861. }
  1862. return parts.join('')
  1863. }
  1864. /***/ }),
  1865. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  1866. /*!*****************************************************!*\
  1867. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  1868. \*****************************************************/
  1869. /*! no static exports found */
  1870. /***/ (function(module, exports, __webpack_require__) {
  1871. /*!
  1872. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  1873. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  1874. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1875. */
  1876. (function (global, factory) {
  1877. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  1878. undefined;
  1879. }(this, (function (exports, $, Popper) { 'use strict';
  1880. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  1881. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  1882. function _defineProperties(target, props) {
  1883. for (var i = 0; i < props.length; i++) {
  1884. var descriptor = props[i];
  1885. descriptor.enumerable = descriptor.enumerable || false;
  1886. descriptor.configurable = true;
  1887. if ("value" in descriptor) descriptor.writable = true;
  1888. Object.defineProperty(target, descriptor.key, descriptor);
  1889. }
  1890. }
  1891. function _createClass(Constructor, protoProps, staticProps) {
  1892. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1893. if (staticProps) _defineProperties(Constructor, staticProps);
  1894. return Constructor;
  1895. }
  1896. function _defineProperty(obj, key, value) {
  1897. if (key in obj) {
  1898. Object.defineProperty(obj, key, {
  1899. value: value,
  1900. enumerable: true,
  1901. configurable: true,
  1902. writable: true
  1903. });
  1904. } else {
  1905. obj[key] = value;
  1906. }
  1907. return obj;
  1908. }
  1909. function ownKeys(object, enumerableOnly) {
  1910. var keys = Object.keys(object);
  1911. if (Object.getOwnPropertySymbols) {
  1912. var symbols = Object.getOwnPropertySymbols(object);
  1913. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  1914. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  1915. });
  1916. keys.push.apply(keys, symbols);
  1917. }
  1918. return keys;
  1919. }
  1920. function _objectSpread2(target) {
  1921. for (var i = 1; i < arguments.length; i++) {
  1922. var source = arguments[i] != null ? arguments[i] : {};
  1923. if (i % 2) {
  1924. ownKeys(Object(source), true).forEach(function (key) {
  1925. _defineProperty(target, key, source[key]);
  1926. });
  1927. } else if (Object.getOwnPropertyDescriptors) {
  1928. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  1929. } else {
  1930. ownKeys(Object(source)).forEach(function (key) {
  1931. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  1932. });
  1933. }
  1934. }
  1935. return target;
  1936. }
  1937. function _inheritsLoose(subClass, superClass) {
  1938. subClass.prototype = Object.create(superClass.prototype);
  1939. subClass.prototype.constructor = subClass;
  1940. subClass.__proto__ = superClass;
  1941. }
  1942. /**
  1943. * --------------------------------------------------------------------------
  1944. * Bootstrap (v4.4.1): util.js
  1945. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1946. * --------------------------------------------------------------------------
  1947. */
  1948. /**
  1949. * ------------------------------------------------------------------------
  1950. * Private TransitionEnd Helpers
  1951. * ------------------------------------------------------------------------
  1952. */
  1953. var TRANSITION_END = 'transitionend';
  1954. var MAX_UID = 1000000;
  1955. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  1956. function toType(obj) {
  1957. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  1958. }
  1959. function getSpecialTransitionEndEvent() {
  1960. return {
  1961. bindType: TRANSITION_END,
  1962. delegateType: TRANSITION_END,
  1963. handle: function handle(event) {
  1964. if ($(event.target).is(this)) {
  1965. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  1966. }
  1967. return undefined; // eslint-disable-line no-undefined
  1968. }
  1969. };
  1970. }
  1971. function transitionEndEmulator(duration) {
  1972. var _this = this;
  1973. var called = false;
  1974. $(this).one(Util.TRANSITION_END, function () {
  1975. called = true;
  1976. });
  1977. setTimeout(function () {
  1978. if (!called) {
  1979. Util.triggerTransitionEnd(_this);
  1980. }
  1981. }, duration);
  1982. return this;
  1983. }
  1984. function setTransitionEndSupport() {
  1985. $.fn.emulateTransitionEnd = transitionEndEmulator;
  1986. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  1987. }
  1988. /**
  1989. * --------------------------------------------------------------------------
  1990. * Public Util Api
  1991. * --------------------------------------------------------------------------
  1992. */
  1993. var Util = {
  1994. TRANSITION_END: 'bsTransitionEnd',
  1995. getUID: function getUID(prefix) {
  1996. do {
  1997. // eslint-disable-next-line no-bitwise
  1998. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  1999. } while (document.getElementById(prefix));
  2000. return prefix;
  2001. },
  2002. getSelectorFromElement: function getSelectorFromElement(element) {
  2003. var selector = element.getAttribute('data-target');
  2004. if (!selector || selector === '#') {
  2005. var hrefAttr = element.getAttribute('href');
  2006. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2007. }
  2008. try {
  2009. return document.querySelector(selector) ? selector : null;
  2010. } catch (err) {
  2011. return null;
  2012. }
  2013. },
  2014. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2015. if (!element) {
  2016. return 0;
  2017. } // Get transition-duration of the element
  2018. var transitionDuration = $(element).css('transition-duration');
  2019. var transitionDelay = $(element).css('transition-delay');
  2020. var floatTransitionDuration = parseFloat(transitionDuration);
  2021. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2022. if (!floatTransitionDuration && !floatTransitionDelay) {
  2023. return 0;
  2024. } // If multiple durations are defined, take the first
  2025. transitionDuration = transitionDuration.split(',')[0];
  2026. transitionDelay = transitionDelay.split(',')[0];
  2027. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2028. },
  2029. reflow: function reflow(element) {
  2030. return element.offsetHeight;
  2031. },
  2032. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2033. $(element).trigger(TRANSITION_END);
  2034. },
  2035. // TODO: Remove in v5
  2036. supportsTransitionEnd: function supportsTransitionEnd() {
  2037. return Boolean(TRANSITION_END);
  2038. },
  2039. isElement: function isElement(obj) {
  2040. return (obj[0] || obj).nodeType;
  2041. },
  2042. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2043. for (var property in configTypes) {
  2044. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2045. var expectedTypes = configTypes[property];
  2046. var value = config[property];
  2047. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2048. if (!new RegExp(expectedTypes).test(valueType)) {
  2049. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2050. }
  2051. }
  2052. }
  2053. },
  2054. findShadowRoot: function findShadowRoot(element) {
  2055. if (!document.documentElement.attachShadow) {
  2056. return null;
  2057. } // Can find the shadow root otherwise it'll return the document
  2058. if (typeof element.getRootNode === 'function') {
  2059. var root = element.getRootNode();
  2060. return root instanceof ShadowRoot ? root : null;
  2061. }
  2062. if (element instanceof ShadowRoot) {
  2063. return element;
  2064. } // when we don't find a shadow root
  2065. if (!element.parentNode) {
  2066. return null;
  2067. }
  2068. return Util.findShadowRoot(element.parentNode);
  2069. },
  2070. jQueryDetection: function jQueryDetection() {
  2071. if (typeof $ === 'undefined') {
  2072. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2073. }
  2074. var version = $.fn.jquery.split(' ')[0].split('.');
  2075. var minMajor = 1;
  2076. var ltMajor = 2;
  2077. var minMinor = 9;
  2078. var minPatch = 1;
  2079. var maxMajor = 4;
  2080. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2081. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2082. }
  2083. }
  2084. };
  2085. Util.jQueryDetection();
  2086. setTransitionEndSupport();
  2087. /**
  2088. * ------------------------------------------------------------------------
  2089. * Constants
  2090. * ------------------------------------------------------------------------
  2091. */
  2092. var NAME = 'alert';
  2093. var VERSION = '4.4.1';
  2094. var DATA_KEY = 'bs.alert';
  2095. var EVENT_KEY = "." + DATA_KEY;
  2096. var DATA_API_KEY = '.data-api';
  2097. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2098. var Selector = {
  2099. DISMISS: '[data-dismiss="alert"]'
  2100. };
  2101. var Event = {
  2102. CLOSE: "close" + EVENT_KEY,
  2103. CLOSED: "closed" + EVENT_KEY,
  2104. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2105. };
  2106. var ClassName = {
  2107. ALERT: 'alert',
  2108. FADE: 'fade',
  2109. SHOW: 'show'
  2110. };
  2111. /**
  2112. * ------------------------------------------------------------------------
  2113. * Class Definition
  2114. * ------------------------------------------------------------------------
  2115. */
  2116. var Alert =
  2117. /*#__PURE__*/
  2118. function () {
  2119. function Alert(element) {
  2120. this._element = element;
  2121. } // Getters
  2122. var _proto = Alert.prototype;
  2123. // Public
  2124. _proto.close = function close(element) {
  2125. var rootElement = this._element;
  2126. if (element) {
  2127. rootElement = this._getRootElement(element);
  2128. }
  2129. var customEvent = this._triggerCloseEvent(rootElement);
  2130. if (customEvent.isDefaultPrevented()) {
  2131. return;
  2132. }
  2133. this._removeElement(rootElement);
  2134. };
  2135. _proto.dispose = function dispose() {
  2136. $.removeData(this._element, DATA_KEY);
  2137. this._element = null;
  2138. } // Private
  2139. ;
  2140. _proto._getRootElement = function _getRootElement(element) {
  2141. var selector = Util.getSelectorFromElement(element);
  2142. var parent = false;
  2143. if (selector) {
  2144. parent = document.querySelector(selector);
  2145. }
  2146. if (!parent) {
  2147. parent = $(element).closest("." + ClassName.ALERT)[0];
  2148. }
  2149. return parent;
  2150. };
  2151. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2152. var closeEvent = $.Event(Event.CLOSE);
  2153. $(element).trigger(closeEvent);
  2154. return closeEvent;
  2155. };
  2156. _proto._removeElement = function _removeElement(element) {
  2157. var _this = this;
  2158. $(element).removeClass(ClassName.SHOW);
  2159. if (!$(element).hasClass(ClassName.FADE)) {
  2160. this._destroyElement(element);
  2161. return;
  2162. }
  2163. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2164. $(element).one(Util.TRANSITION_END, function (event) {
  2165. return _this._destroyElement(element, event);
  2166. }).emulateTransitionEnd(transitionDuration);
  2167. };
  2168. _proto._destroyElement = function _destroyElement(element) {
  2169. $(element).detach().trigger(Event.CLOSED).remove();
  2170. } // Static
  2171. ;
  2172. Alert._jQueryInterface = function _jQueryInterface(config) {
  2173. return this.each(function () {
  2174. var $element = $(this);
  2175. var data = $element.data(DATA_KEY);
  2176. if (!data) {
  2177. data = new Alert(this);
  2178. $element.data(DATA_KEY, data);
  2179. }
  2180. if (config === 'close') {
  2181. data[config](this);
  2182. }
  2183. });
  2184. };
  2185. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2186. return function (event) {
  2187. if (event) {
  2188. event.preventDefault();
  2189. }
  2190. alertInstance.close(this);
  2191. };
  2192. };
  2193. _createClass(Alert, null, [{
  2194. key: "VERSION",
  2195. get: function get() {
  2196. return VERSION;
  2197. }
  2198. }]);
  2199. return Alert;
  2200. }();
  2201. /**
  2202. * ------------------------------------------------------------------------
  2203. * Data Api implementation
  2204. * ------------------------------------------------------------------------
  2205. */
  2206. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2207. /**
  2208. * ------------------------------------------------------------------------
  2209. * jQuery
  2210. * ------------------------------------------------------------------------
  2211. */
  2212. $.fn[NAME] = Alert._jQueryInterface;
  2213. $.fn[NAME].Constructor = Alert;
  2214. $.fn[NAME].noConflict = function () {
  2215. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2216. return Alert._jQueryInterface;
  2217. };
  2218. /**
  2219. * ------------------------------------------------------------------------
  2220. * Constants
  2221. * ------------------------------------------------------------------------
  2222. */
  2223. var NAME$1 = 'button';
  2224. var VERSION$1 = '4.4.1';
  2225. var DATA_KEY$1 = 'bs.button';
  2226. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2227. var DATA_API_KEY$1 = '.data-api';
  2228. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2229. var ClassName$1 = {
  2230. ACTIVE: 'active',
  2231. BUTTON: 'btn',
  2232. FOCUS: 'focus'
  2233. };
  2234. var Selector$1 = {
  2235. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2236. DATA_TOGGLES: '[data-toggle="buttons"]',
  2237. DATA_TOGGLE: '[data-toggle="button"]',
  2238. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2239. INPUT: 'input:not([type="hidden"])',
  2240. ACTIVE: '.active',
  2241. BUTTON: '.btn'
  2242. };
  2243. var Event$1 = {
  2244. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2245. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2246. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2247. };
  2248. /**
  2249. * ------------------------------------------------------------------------
  2250. * Class Definition
  2251. * ------------------------------------------------------------------------
  2252. */
  2253. var Button =
  2254. /*#__PURE__*/
  2255. function () {
  2256. function Button(element) {
  2257. this._element = element;
  2258. } // Getters
  2259. var _proto = Button.prototype;
  2260. // Public
  2261. _proto.toggle = function toggle() {
  2262. var triggerChangeEvent = true;
  2263. var addAriaPressed = true;
  2264. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2265. if (rootElement) {
  2266. var input = this._element.querySelector(Selector$1.INPUT);
  2267. if (input) {
  2268. if (input.type === 'radio') {
  2269. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2270. triggerChangeEvent = false;
  2271. } else {
  2272. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2273. if (activeElement) {
  2274. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2275. }
  2276. }
  2277. } else if (input.type === 'checkbox') {
  2278. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2279. triggerChangeEvent = false;
  2280. }
  2281. } else {
  2282. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2283. triggerChangeEvent = false;
  2284. }
  2285. if (triggerChangeEvent) {
  2286. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2287. $(input).trigger('change');
  2288. }
  2289. input.focus();
  2290. addAriaPressed = false;
  2291. }
  2292. }
  2293. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2294. if (addAriaPressed) {
  2295. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2296. }
  2297. if (triggerChangeEvent) {
  2298. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2299. }
  2300. }
  2301. };
  2302. _proto.dispose = function dispose() {
  2303. $.removeData(this._element, DATA_KEY$1);
  2304. this._element = null;
  2305. } // Static
  2306. ;
  2307. Button._jQueryInterface = function _jQueryInterface(config) {
  2308. return this.each(function () {
  2309. var data = $(this).data(DATA_KEY$1);
  2310. if (!data) {
  2311. data = new Button(this);
  2312. $(this).data(DATA_KEY$1, data);
  2313. }
  2314. if (config === 'toggle') {
  2315. data[config]();
  2316. }
  2317. });
  2318. };
  2319. _createClass(Button, null, [{
  2320. key: "VERSION",
  2321. get: function get() {
  2322. return VERSION$1;
  2323. }
  2324. }]);
  2325. return Button;
  2326. }();
  2327. /**
  2328. * ------------------------------------------------------------------------
  2329. * Data Api implementation
  2330. * ------------------------------------------------------------------------
  2331. */
  2332. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2333. var button = event.target;
  2334. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2335. button = $(button).closest(Selector$1.BUTTON)[0];
  2336. }
  2337. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2338. event.preventDefault(); // work around Firefox bug #1540995
  2339. } else {
  2340. var inputBtn = button.querySelector(Selector$1.INPUT);
  2341. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2342. event.preventDefault(); // work around Firefox bug #1540995
  2343. return;
  2344. }
  2345. Button._jQueryInterface.call($(button), 'toggle');
  2346. }
  2347. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2348. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2349. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2350. });
  2351. $(window).on(Event$1.LOAD_DATA_API, function () {
  2352. // ensure correct active class is set to match the controls' actual values/states
  2353. // find all checkboxes/readio buttons inside data-toggle groups
  2354. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2355. for (var i = 0, len = buttons.length; i < len; i++) {
  2356. var button = buttons[i];
  2357. var input = button.querySelector(Selector$1.INPUT);
  2358. if (input.checked || input.hasAttribute('checked')) {
  2359. button.classList.add(ClassName$1.ACTIVE);
  2360. } else {
  2361. button.classList.remove(ClassName$1.ACTIVE);
  2362. }
  2363. } // find all button toggles
  2364. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2365. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2366. var _button = buttons[_i];
  2367. if (_button.getAttribute('aria-pressed') === 'true') {
  2368. _button.classList.add(ClassName$1.ACTIVE);
  2369. } else {
  2370. _button.classList.remove(ClassName$1.ACTIVE);
  2371. }
  2372. }
  2373. });
  2374. /**
  2375. * ------------------------------------------------------------------------
  2376. * jQuery
  2377. * ------------------------------------------------------------------------
  2378. */
  2379. $.fn[NAME$1] = Button._jQueryInterface;
  2380. $.fn[NAME$1].Constructor = Button;
  2381. $.fn[NAME$1].noConflict = function () {
  2382. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2383. return Button._jQueryInterface;
  2384. };
  2385. /**
  2386. * ------------------------------------------------------------------------
  2387. * Constants
  2388. * ------------------------------------------------------------------------
  2389. */
  2390. var NAME$2 = 'carousel';
  2391. var VERSION$2 = '4.4.1';
  2392. var DATA_KEY$2 = 'bs.carousel';
  2393. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2394. var DATA_API_KEY$2 = '.data-api';
  2395. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2396. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2397. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2398. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2399. var SWIPE_THRESHOLD = 40;
  2400. var Default = {
  2401. interval: 5000,
  2402. keyboard: true,
  2403. slide: false,
  2404. pause: 'hover',
  2405. wrap: true,
  2406. touch: true
  2407. };
  2408. var DefaultType = {
  2409. interval: '(number|boolean)',
  2410. keyboard: 'boolean',
  2411. slide: '(boolean|string)',
  2412. pause: '(string|boolean)',
  2413. wrap: 'boolean',
  2414. touch: 'boolean'
  2415. };
  2416. var Direction = {
  2417. NEXT: 'next',
  2418. PREV: 'prev',
  2419. LEFT: 'left',
  2420. RIGHT: 'right'
  2421. };
  2422. var Event$2 = {
  2423. SLIDE: "slide" + EVENT_KEY$2,
  2424. SLID: "slid" + EVENT_KEY$2,
  2425. KEYDOWN: "keydown" + EVENT_KEY$2,
  2426. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2427. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2428. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2429. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2430. TOUCHEND: "touchend" + EVENT_KEY$2,
  2431. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2432. POINTERUP: "pointerup" + EVENT_KEY$2,
  2433. DRAG_START: "dragstart" + EVENT_KEY$2,
  2434. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2435. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2436. };
  2437. var ClassName$2 = {
  2438. CAROUSEL: 'carousel',
  2439. ACTIVE: 'active',
  2440. SLIDE: 'slide',
  2441. RIGHT: 'carousel-item-right',
  2442. LEFT: 'carousel-item-left',
  2443. NEXT: 'carousel-item-next',
  2444. PREV: 'carousel-item-prev',
  2445. ITEM: 'carousel-item',
  2446. POINTER_EVENT: 'pointer-event'
  2447. };
  2448. var Selector$2 = {
  2449. ACTIVE: '.active',
  2450. ACTIVE_ITEM: '.active.carousel-item',
  2451. ITEM: '.carousel-item',
  2452. ITEM_IMG: '.carousel-item img',
  2453. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2454. INDICATORS: '.carousel-indicators',
  2455. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2456. DATA_RIDE: '[data-ride="carousel"]'
  2457. };
  2458. var PointerType = {
  2459. TOUCH: 'touch',
  2460. PEN: 'pen'
  2461. };
  2462. /**
  2463. * ------------------------------------------------------------------------
  2464. * Class Definition
  2465. * ------------------------------------------------------------------------
  2466. */
  2467. var Carousel =
  2468. /*#__PURE__*/
  2469. function () {
  2470. function Carousel(element, config) {
  2471. this._items = null;
  2472. this._interval = null;
  2473. this._activeElement = null;
  2474. this._isPaused = false;
  2475. this._isSliding = false;
  2476. this.touchTimeout = null;
  2477. this.touchStartX = 0;
  2478. this.touchDeltaX = 0;
  2479. this._config = this._getConfig(config);
  2480. this._element = element;
  2481. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2482. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2483. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2484. this._addEventListeners();
  2485. } // Getters
  2486. var _proto = Carousel.prototype;
  2487. // Public
  2488. _proto.next = function next() {
  2489. if (!this._isSliding) {
  2490. this._slide(Direction.NEXT);
  2491. }
  2492. };
  2493. _proto.nextWhenVisible = function nextWhenVisible() {
  2494. // Don't call next when the page isn't visible
  2495. // or the carousel or its parent isn't visible
  2496. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2497. this.next();
  2498. }
  2499. };
  2500. _proto.prev = function prev() {
  2501. if (!this._isSliding) {
  2502. this._slide(Direction.PREV);
  2503. }
  2504. };
  2505. _proto.pause = function pause(event) {
  2506. if (!event) {
  2507. this._isPaused = true;
  2508. }
  2509. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2510. Util.triggerTransitionEnd(this._element);
  2511. this.cycle(true);
  2512. }
  2513. clearInterval(this._interval);
  2514. this._interval = null;
  2515. };
  2516. _proto.cycle = function cycle(event) {
  2517. if (!event) {
  2518. this._isPaused = false;
  2519. }
  2520. if (this._interval) {
  2521. clearInterval(this._interval);
  2522. this._interval = null;
  2523. }
  2524. if (this._config.interval && !this._isPaused) {
  2525. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2526. }
  2527. };
  2528. _proto.to = function to(index) {
  2529. var _this = this;
  2530. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2531. var activeIndex = this._getItemIndex(this._activeElement);
  2532. if (index > this._items.length - 1 || index < 0) {
  2533. return;
  2534. }
  2535. if (this._isSliding) {
  2536. $(this._element).one(Event$2.SLID, function () {
  2537. return _this.to(index);
  2538. });
  2539. return;
  2540. }
  2541. if (activeIndex === index) {
  2542. this.pause();
  2543. this.cycle();
  2544. return;
  2545. }
  2546. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2547. this._slide(direction, this._items[index]);
  2548. };
  2549. _proto.dispose = function dispose() {
  2550. $(this._element).off(EVENT_KEY$2);
  2551. $.removeData(this._element, DATA_KEY$2);
  2552. this._items = null;
  2553. this._config = null;
  2554. this._element = null;
  2555. this._interval = null;
  2556. this._isPaused = null;
  2557. this._isSliding = null;
  2558. this._activeElement = null;
  2559. this._indicatorsElement = null;
  2560. } // Private
  2561. ;
  2562. _proto._getConfig = function _getConfig(config) {
  2563. config = _objectSpread2({}, Default, {}, config);
  2564. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2565. return config;
  2566. };
  2567. _proto._handleSwipe = function _handleSwipe() {
  2568. var absDeltax = Math.abs(this.touchDeltaX);
  2569. if (absDeltax <= SWIPE_THRESHOLD) {
  2570. return;
  2571. }
  2572. var direction = absDeltax / this.touchDeltaX;
  2573. this.touchDeltaX = 0; // swipe left
  2574. if (direction > 0) {
  2575. this.prev();
  2576. } // swipe right
  2577. if (direction < 0) {
  2578. this.next();
  2579. }
  2580. };
  2581. _proto._addEventListeners = function _addEventListeners() {
  2582. var _this2 = this;
  2583. if (this._config.keyboard) {
  2584. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2585. return _this2._keydown(event);
  2586. });
  2587. }
  2588. if (this._config.pause === 'hover') {
  2589. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2590. return _this2.pause(event);
  2591. }).on(Event$2.MOUSELEAVE, function (event) {
  2592. return _this2.cycle(event);
  2593. });
  2594. }
  2595. if (this._config.touch) {
  2596. this._addTouchEventListeners();
  2597. }
  2598. };
  2599. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2600. var _this3 = this;
  2601. if (!this._touchSupported) {
  2602. return;
  2603. }
  2604. var start = function start(event) {
  2605. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2606. _this3.touchStartX = event.originalEvent.clientX;
  2607. } else if (!_this3._pointerEvent) {
  2608. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2609. }
  2610. };
  2611. var move = function move(event) {
  2612. // ensure swiping with one touch and not pinching
  2613. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2614. _this3.touchDeltaX = 0;
  2615. } else {
  2616. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2617. }
  2618. };
  2619. var end = function end(event) {
  2620. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2621. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2622. }
  2623. _this3._handleSwipe();
  2624. if (_this3._config.pause === 'hover') {
  2625. // If it's a touch-enabled device, mouseenter/leave are fired as
  2626. // part of the mouse compatibility events on first tap - the carousel
  2627. // would stop cycling until user tapped out of it;
  2628. // here, we listen for touchend, explicitly pause the carousel
  2629. // (as if it's the second time we tap on it, mouseenter compat event
  2630. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2631. // events to fire) we explicitly restart cycling
  2632. _this3.pause();
  2633. if (_this3.touchTimeout) {
  2634. clearTimeout(_this3.touchTimeout);
  2635. }
  2636. _this3.touchTimeout = setTimeout(function (event) {
  2637. return _this3.cycle(event);
  2638. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2639. }
  2640. };
  2641. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2642. return e.preventDefault();
  2643. });
  2644. if (this._pointerEvent) {
  2645. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2646. return start(event);
  2647. });
  2648. $(this._element).on(Event$2.POINTERUP, function (event) {
  2649. return end(event);
  2650. });
  2651. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2652. } else {
  2653. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2654. return start(event);
  2655. });
  2656. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2657. return move(event);
  2658. });
  2659. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2660. return end(event);
  2661. });
  2662. }
  2663. };
  2664. _proto._keydown = function _keydown(event) {
  2665. if (/input|textarea/i.test(event.target.tagName)) {
  2666. return;
  2667. }
  2668. switch (event.which) {
  2669. case ARROW_LEFT_KEYCODE:
  2670. event.preventDefault();
  2671. this.prev();
  2672. break;
  2673. case ARROW_RIGHT_KEYCODE:
  2674. event.preventDefault();
  2675. this.next();
  2676. break;
  2677. }
  2678. };
  2679. _proto._getItemIndex = function _getItemIndex(element) {
  2680. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2681. return this._items.indexOf(element);
  2682. };
  2683. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2684. var isNextDirection = direction === Direction.NEXT;
  2685. var isPrevDirection = direction === Direction.PREV;
  2686. var activeIndex = this._getItemIndex(activeElement);
  2687. var lastItemIndex = this._items.length - 1;
  2688. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2689. if (isGoingToWrap && !this._config.wrap) {
  2690. return activeElement;
  2691. }
  2692. var delta = direction === Direction.PREV ? -1 : 1;
  2693. var itemIndex = (activeIndex + delta) % this._items.length;
  2694. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2695. };
  2696. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2697. var targetIndex = this._getItemIndex(relatedTarget);
  2698. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2699. var slideEvent = $.Event(Event$2.SLIDE, {
  2700. relatedTarget: relatedTarget,
  2701. direction: eventDirectionName,
  2702. from: fromIndex,
  2703. to: targetIndex
  2704. });
  2705. $(this._element).trigger(slideEvent);
  2706. return slideEvent;
  2707. };
  2708. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2709. if (this._indicatorsElement) {
  2710. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2711. $(indicators).removeClass(ClassName$2.ACTIVE);
  2712. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2713. if (nextIndicator) {
  2714. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2715. }
  2716. }
  2717. };
  2718. _proto._slide = function _slide(direction, element) {
  2719. var _this4 = this;
  2720. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2721. var activeElementIndex = this._getItemIndex(activeElement);
  2722. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2723. var nextElementIndex = this._getItemIndex(nextElement);
  2724. var isCycling = Boolean(this._interval);
  2725. var directionalClassName;
  2726. var orderClassName;
  2727. var eventDirectionName;
  2728. if (direction === Direction.NEXT) {
  2729. directionalClassName = ClassName$2.LEFT;
  2730. orderClassName = ClassName$2.NEXT;
  2731. eventDirectionName = Direction.LEFT;
  2732. } else {
  2733. directionalClassName = ClassName$2.RIGHT;
  2734. orderClassName = ClassName$2.PREV;
  2735. eventDirectionName = Direction.RIGHT;
  2736. }
  2737. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  2738. this._isSliding = false;
  2739. return;
  2740. }
  2741. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  2742. if (slideEvent.isDefaultPrevented()) {
  2743. return;
  2744. }
  2745. if (!activeElement || !nextElement) {
  2746. // Some weirdness is happening, so we bail
  2747. return;
  2748. }
  2749. this._isSliding = true;
  2750. if (isCycling) {
  2751. this.pause();
  2752. }
  2753. this._setActiveIndicatorElement(nextElement);
  2754. var slidEvent = $.Event(Event$2.SLID, {
  2755. relatedTarget: nextElement,
  2756. direction: eventDirectionName,
  2757. from: activeElementIndex,
  2758. to: nextElementIndex
  2759. });
  2760. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  2761. $(nextElement).addClass(orderClassName);
  2762. Util.reflow(nextElement);
  2763. $(activeElement).addClass(directionalClassName);
  2764. $(nextElement).addClass(directionalClassName);
  2765. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  2766. if (nextElementInterval) {
  2767. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  2768. this._config.interval = nextElementInterval;
  2769. } else {
  2770. this._config.interval = this._config.defaultInterval || this._config.interval;
  2771. }
  2772. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  2773. $(activeElement).one(Util.TRANSITION_END, function () {
  2774. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  2775. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  2776. _this4._isSliding = false;
  2777. setTimeout(function () {
  2778. return $(_this4._element).trigger(slidEvent);
  2779. }, 0);
  2780. }).emulateTransitionEnd(transitionDuration);
  2781. } else {
  2782. $(activeElement).removeClass(ClassName$2.ACTIVE);
  2783. $(nextElement).addClass(ClassName$2.ACTIVE);
  2784. this._isSliding = false;
  2785. $(this._element).trigger(slidEvent);
  2786. }
  2787. if (isCycling) {
  2788. this.cycle();
  2789. }
  2790. } // Static
  2791. ;
  2792. Carousel._jQueryInterface = function _jQueryInterface(config) {
  2793. return this.each(function () {
  2794. var data = $(this).data(DATA_KEY$2);
  2795. var _config = _objectSpread2({}, Default, {}, $(this).data());
  2796. if (typeof config === 'object') {
  2797. _config = _objectSpread2({}, _config, {}, config);
  2798. }
  2799. var action = typeof config === 'string' ? config : _config.slide;
  2800. if (!data) {
  2801. data = new Carousel(this, _config);
  2802. $(this).data(DATA_KEY$2, data);
  2803. }
  2804. if (typeof config === 'number') {
  2805. data.to(config);
  2806. } else if (typeof action === 'string') {
  2807. if (typeof data[action] === 'undefined') {
  2808. throw new TypeError("No method named \"" + action + "\"");
  2809. }
  2810. data[action]();
  2811. } else if (_config.interval && _config.ride) {
  2812. data.pause();
  2813. data.cycle();
  2814. }
  2815. });
  2816. };
  2817. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  2818. var selector = Util.getSelectorFromElement(this);
  2819. if (!selector) {
  2820. return;
  2821. }
  2822. var target = $(selector)[0];
  2823. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  2824. return;
  2825. }
  2826. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  2827. var slideIndex = this.getAttribute('data-slide-to');
  2828. if (slideIndex) {
  2829. config.interval = false;
  2830. }
  2831. Carousel._jQueryInterface.call($(target), config);
  2832. if (slideIndex) {
  2833. $(target).data(DATA_KEY$2).to(slideIndex);
  2834. }
  2835. event.preventDefault();
  2836. };
  2837. _createClass(Carousel, null, [{
  2838. key: "VERSION",
  2839. get: function get() {
  2840. return VERSION$2;
  2841. }
  2842. }, {
  2843. key: "Default",
  2844. get: function get() {
  2845. return Default;
  2846. }
  2847. }]);
  2848. return Carousel;
  2849. }();
  2850. /**
  2851. * ------------------------------------------------------------------------
  2852. * Data Api implementation
  2853. * ------------------------------------------------------------------------
  2854. */
  2855. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  2856. $(window).on(Event$2.LOAD_DATA_API, function () {
  2857. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  2858. for (var i = 0, len = carousels.length; i < len; i++) {
  2859. var $carousel = $(carousels[i]);
  2860. Carousel._jQueryInterface.call($carousel, $carousel.data());
  2861. }
  2862. });
  2863. /**
  2864. * ------------------------------------------------------------------------
  2865. * jQuery
  2866. * ------------------------------------------------------------------------
  2867. */
  2868. $.fn[NAME$2] = Carousel._jQueryInterface;
  2869. $.fn[NAME$2].Constructor = Carousel;
  2870. $.fn[NAME$2].noConflict = function () {
  2871. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  2872. return Carousel._jQueryInterface;
  2873. };
  2874. /**
  2875. * ------------------------------------------------------------------------
  2876. * Constants
  2877. * ------------------------------------------------------------------------
  2878. */
  2879. var NAME$3 = 'collapse';
  2880. var VERSION$3 = '4.4.1';
  2881. var DATA_KEY$3 = 'bs.collapse';
  2882. var EVENT_KEY$3 = "." + DATA_KEY$3;
  2883. var DATA_API_KEY$3 = '.data-api';
  2884. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  2885. var Default$1 = {
  2886. toggle: true,
  2887. parent: ''
  2888. };
  2889. var DefaultType$1 = {
  2890. toggle: 'boolean',
  2891. parent: '(string|element)'
  2892. };
  2893. var Event$3 = {
  2894. SHOW: "show" + EVENT_KEY$3,
  2895. SHOWN: "shown" + EVENT_KEY$3,
  2896. HIDE: "hide" + EVENT_KEY$3,
  2897. HIDDEN: "hidden" + EVENT_KEY$3,
  2898. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  2899. };
  2900. var ClassName$3 = {
  2901. SHOW: 'show',
  2902. COLLAPSE: 'collapse',
  2903. COLLAPSING: 'collapsing',
  2904. COLLAPSED: 'collapsed'
  2905. };
  2906. var Dimension = {
  2907. WIDTH: 'width',
  2908. HEIGHT: 'height'
  2909. };
  2910. var Selector$3 = {
  2911. ACTIVES: '.show, .collapsing',
  2912. DATA_TOGGLE: '[data-toggle="collapse"]'
  2913. };
  2914. /**
  2915. * ------------------------------------------------------------------------
  2916. * Class Definition
  2917. * ------------------------------------------------------------------------
  2918. */
  2919. var Collapse =
  2920. /*#__PURE__*/
  2921. function () {
  2922. function Collapse(element, config) {
  2923. this._isTransitioning = false;
  2924. this._element = element;
  2925. this._config = this._getConfig(config);
  2926. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  2927. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  2928. for (var i = 0, len = toggleList.length; i < len; i++) {
  2929. var elem = toggleList[i];
  2930. var selector = Util.getSelectorFromElement(elem);
  2931. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  2932. return foundElem === element;
  2933. });
  2934. if (selector !== null && filterElement.length > 0) {
  2935. this._selector = selector;
  2936. this._triggerArray.push(elem);
  2937. }
  2938. }
  2939. this._parent = this._config.parent ? this._getParent() : null;
  2940. if (!this._config.parent) {
  2941. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  2942. }
  2943. if (this._config.toggle) {
  2944. this.toggle();
  2945. }
  2946. } // Getters
  2947. var _proto = Collapse.prototype;
  2948. // Public
  2949. _proto.toggle = function toggle() {
  2950. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  2951. this.hide();
  2952. } else {
  2953. this.show();
  2954. }
  2955. };
  2956. _proto.show = function show() {
  2957. var _this = this;
  2958. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  2959. return;
  2960. }
  2961. var actives;
  2962. var activesData;
  2963. if (this._parent) {
  2964. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  2965. if (typeof _this._config.parent === 'string') {
  2966. return elem.getAttribute('data-parent') === _this._config.parent;
  2967. }
  2968. return elem.classList.contains(ClassName$3.COLLAPSE);
  2969. });
  2970. if (actives.length === 0) {
  2971. actives = null;
  2972. }
  2973. }
  2974. if (actives) {
  2975. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  2976. if (activesData && activesData._isTransitioning) {
  2977. return;
  2978. }
  2979. }
  2980. var startEvent = $.Event(Event$3.SHOW);
  2981. $(this._element).trigger(startEvent);
  2982. if (startEvent.isDefaultPrevented()) {
  2983. return;
  2984. }
  2985. if (actives) {
  2986. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  2987. if (!activesData) {
  2988. $(actives).data(DATA_KEY$3, null);
  2989. }
  2990. }
  2991. var dimension = this._getDimension();
  2992. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  2993. this._element.style[dimension] = 0;
  2994. if (this._triggerArray.length) {
  2995. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  2996. }
  2997. this.setTransitioning(true);
  2998. var complete = function complete() {
  2999. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3000. _this._element.style[dimension] = '';
  3001. _this.setTransitioning(false);
  3002. $(_this._element).trigger(Event$3.SHOWN);
  3003. };
  3004. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3005. var scrollSize = "scroll" + capitalizedDimension;
  3006. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3007. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3008. this._element.style[dimension] = this._element[scrollSize] + "px";
  3009. };
  3010. _proto.hide = function hide() {
  3011. var _this2 = this;
  3012. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3013. return;
  3014. }
  3015. var startEvent = $.Event(Event$3.HIDE);
  3016. $(this._element).trigger(startEvent);
  3017. if (startEvent.isDefaultPrevented()) {
  3018. return;
  3019. }
  3020. var dimension = this._getDimension();
  3021. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3022. Util.reflow(this._element);
  3023. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3024. var triggerArrayLength = this._triggerArray.length;
  3025. if (triggerArrayLength > 0) {
  3026. for (var i = 0; i < triggerArrayLength; i++) {
  3027. var trigger = this._triggerArray[i];
  3028. var selector = Util.getSelectorFromElement(trigger);
  3029. if (selector !== null) {
  3030. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3031. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3032. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3033. }
  3034. }
  3035. }
  3036. }
  3037. this.setTransitioning(true);
  3038. var complete = function complete() {
  3039. _this2.setTransitioning(false);
  3040. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3041. };
  3042. this._element.style[dimension] = '';
  3043. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3044. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3045. };
  3046. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3047. this._isTransitioning = isTransitioning;
  3048. };
  3049. _proto.dispose = function dispose() {
  3050. $.removeData(this._element, DATA_KEY$3);
  3051. this._config = null;
  3052. this._parent = null;
  3053. this._element = null;
  3054. this._triggerArray = null;
  3055. this._isTransitioning = null;
  3056. } // Private
  3057. ;
  3058. _proto._getConfig = function _getConfig(config) {
  3059. config = _objectSpread2({}, Default$1, {}, config);
  3060. config.toggle = Boolean(config.toggle); // Coerce string values
  3061. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3062. return config;
  3063. };
  3064. _proto._getDimension = function _getDimension() {
  3065. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3066. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3067. };
  3068. _proto._getParent = function _getParent() {
  3069. var _this3 = this;
  3070. var parent;
  3071. if (Util.isElement(this._config.parent)) {
  3072. parent = this._config.parent; // It's a jQuery object
  3073. if (typeof this._config.parent.jquery !== 'undefined') {
  3074. parent = this._config.parent[0];
  3075. }
  3076. } else {
  3077. parent = document.querySelector(this._config.parent);
  3078. }
  3079. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3080. var children = [].slice.call(parent.querySelectorAll(selector));
  3081. $(children).each(function (i, element) {
  3082. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3083. });
  3084. return parent;
  3085. };
  3086. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3087. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3088. if (triggerArray.length) {
  3089. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3090. }
  3091. } // Static
  3092. ;
  3093. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3094. var selector = Util.getSelectorFromElement(element);
  3095. return selector ? document.querySelector(selector) : null;
  3096. };
  3097. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3098. return this.each(function () {
  3099. var $this = $(this);
  3100. var data = $this.data(DATA_KEY$3);
  3101. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3102. if (!data && _config.toggle && /show|hide/.test(config)) {
  3103. _config.toggle = false;
  3104. }
  3105. if (!data) {
  3106. data = new Collapse(this, _config);
  3107. $this.data(DATA_KEY$3, data);
  3108. }
  3109. if (typeof config === 'string') {
  3110. if (typeof data[config] === 'undefined') {
  3111. throw new TypeError("No method named \"" + config + "\"");
  3112. }
  3113. data[config]();
  3114. }
  3115. });
  3116. };
  3117. _createClass(Collapse, null, [{
  3118. key: "VERSION",
  3119. get: function get() {
  3120. return VERSION$3;
  3121. }
  3122. }, {
  3123. key: "Default",
  3124. get: function get() {
  3125. return Default$1;
  3126. }
  3127. }]);
  3128. return Collapse;
  3129. }();
  3130. /**
  3131. * ------------------------------------------------------------------------
  3132. * Data Api implementation
  3133. * ------------------------------------------------------------------------
  3134. */
  3135. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3136. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3137. if (event.currentTarget.tagName === 'A') {
  3138. event.preventDefault();
  3139. }
  3140. var $trigger = $(this);
  3141. var selector = Util.getSelectorFromElement(this);
  3142. var selectors = [].slice.call(document.querySelectorAll(selector));
  3143. $(selectors).each(function () {
  3144. var $target = $(this);
  3145. var data = $target.data(DATA_KEY$3);
  3146. var config = data ? 'toggle' : $trigger.data();
  3147. Collapse._jQueryInterface.call($target, config);
  3148. });
  3149. });
  3150. /**
  3151. * ------------------------------------------------------------------------
  3152. * jQuery
  3153. * ------------------------------------------------------------------------
  3154. */
  3155. $.fn[NAME$3] = Collapse._jQueryInterface;
  3156. $.fn[NAME$3].Constructor = Collapse;
  3157. $.fn[NAME$3].noConflict = function () {
  3158. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3159. return Collapse._jQueryInterface;
  3160. };
  3161. /**
  3162. * ------------------------------------------------------------------------
  3163. * Constants
  3164. * ------------------------------------------------------------------------
  3165. */
  3166. var NAME$4 = 'dropdown';
  3167. var VERSION$4 = '4.4.1';
  3168. var DATA_KEY$4 = 'bs.dropdown';
  3169. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3170. var DATA_API_KEY$4 = '.data-api';
  3171. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3172. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3173. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3174. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3175. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3176. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3177. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3178. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3179. var Event$4 = {
  3180. HIDE: "hide" + EVENT_KEY$4,
  3181. HIDDEN: "hidden" + EVENT_KEY$4,
  3182. SHOW: "show" + EVENT_KEY$4,
  3183. SHOWN: "shown" + EVENT_KEY$4,
  3184. CLICK: "click" + EVENT_KEY$4,
  3185. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3186. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3187. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3188. };
  3189. var ClassName$4 = {
  3190. DISABLED: 'disabled',
  3191. SHOW: 'show',
  3192. DROPUP: 'dropup',
  3193. DROPRIGHT: 'dropright',
  3194. DROPLEFT: 'dropleft',
  3195. MENURIGHT: 'dropdown-menu-right',
  3196. MENULEFT: 'dropdown-menu-left',
  3197. POSITION_STATIC: 'position-static'
  3198. };
  3199. var Selector$4 = {
  3200. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3201. FORM_CHILD: '.dropdown form',
  3202. MENU: '.dropdown-menu',
  3203. NAVBAR_NAV: '.navbar-nav',
  3204. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3205. };
  3206. var AttachmentMap = {
  3207. TOP: 'top-start',
  3208. TOPEND: 'top-end',
  3209. BOTTOM: 'bottom-start',
  3210. BOTTOMEND: 'bottom-end',
  3211. RIGHT: 'right-start',
  3212. RIGHTEND: 'right-end',
  3213. LEFT: 'left-start',
  3214. LEFTEND: 'left-end'
  3215. };
  3216. var Default$2 = {
  3217. offset: 0,
  3218. flip: true,
  3219. boundary: 'scrollParent',
  3220. reference: 'toggle',
  3221. display: 'dynamic',
  3222. popperConfig: null
  3223. };
  3224. var DefaultType$2 = {
  3225. offset: '(number|string|function)',
  3226. flip: 'boolean',
  3227. boundary: '(string|element)',
  3228. reference: '(string|element)',
  3229. display: 'string',
  3230. popperConfig: '(null|object)'
  3231. };
  3232. /**
  3233. * ------------------------------------------------------------------------
  3234. * Class Definition
  3235. * ------------------------------------------------------------------------
  3236. */
  3237. var Dropdown =
  3238. /*#__PURE__*/
  3239. function () {
  3240. function Dropdown(element, config) {
  3241. this._element = element;
  3242. this._popper = null;
  3243. this._config = this._getConfig(config);
  3244. this._menu = this._getMenuElement();
  3245. this._inNavbar = this._detectNavbar();
  3246. this._addEventListeners();
  3247. } // Getters
  3248. var _proto = Dropdown.prototype;
  3249. // Public
  3250. _proto.toggle = function toggle() {
  3251. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3252. return;
  3253. }
  3254. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3255. Dropdown._clearMenus();
  3256. if (isActive) {
  3257. return;
  3258. }
  3259. this.show(true);
  3260. };
  3261. _proto.show = function show(usePopper) {
  3262. if (usePopper === void 0) {
  3263. usePopper = false;
  3264. }
  3265. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3266. return;
  3267. }
  3268. var relatedTarget = {
  3269. relatedTarget: this._element
  3270. };
  3271. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3272. var parent = Dropdown._getParentFromElement(this._element);
  3273. $(parent).trigger(showEvent);
  3274. if (showEvent.isDefaultPrevented()) {
  3275. return;
  3276. } // Disable totally Popper.js for Dropdown in Navbar
  3277. if (!this._inNavbar && usePopper) {
  3278. /**
  3279. * Check for Popper dependency
  3280. * Popper - https://popper.js.org
  3281. */
  3282. if (typeof Popper === 'undefined') {
  3283. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3284. }
  3285. var referenceElement = this._element;
  3286. if (this._config.reference === 'parent') {
  3287. referenceElement = parent;
  3288. } else if (Util.isElement(this._config.reference)) {
  3289. referenceElement = this._config.reference; // Check if it's jQuery element
  3290. if (typeof this._config.reference.jquery !== 'undefined') {
  3291. referenceElement = this._config.reference[0];
  3292. }
  3293. } // If boundary is not `scrollParent`, then set position to `static`
  3294. // to allow the menu to "escape" the scroll parent's boundaries
  3295. // https://github.com/twbs/bootstrap/issues/24251
  3296. if (this._config.boundary !== 'scrollParent') {
  3297. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3298. }
  3299. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3300. } // If this is a touch-enabled device we add extra
  3301. // empty mouseover listeners to the body's immediate children;
  3302. // only needed because of broken event delegation on iOS
  3303. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3304. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3305. $(document.body).children().on('mouseover', null, $.noop);
  3306. }
  3307. this._element.focus();
  3308. this._element.setAttribute('aria-expanded', true);
  3309. $(this._menu).toggleClass(ClassName$4.SHOW);
  3310. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3311. };
  3312. _proto.hide = function hide() {
  3313. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3314. return;
  3315. }
  3316. var relatedTarget = {
  3317. relatedTarget: this._element
  3318. };
  3319. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3320. var parent = Dropdown._getParentFromElement(this._element);
  3321. $(parent).trigger(hideEvent);
  3322. if (hideEvent.isDefaultPrevented()) {
  3323. return;
  3324. }
  3325. if (this._popper) {
  3326. this._popper.destroy();
  3327. }
  3328. $(this._menu).toggleClass(ClassName$4.SHOW);
  3329. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3330. };
  3331. _proto.dispose = function dispose() {
  3332. $.removeData(this._element, DATA_KEY$4);
  3333. $(this._element).off(EVENT_KEY$4);
  3334. this._element = null;
  3335. this._menu = null;
  3336. if (this._popper !== null) {
  3337. this._popper.destroy();
  3338. this._popper = null;
  3339. }
  3340. };
  3341. _proto.update = function update() {
  3342. this._inNavbar = this._detectNavbar();
  3343. if (this._popper !== null) {
  3344. this._popper.scheduleUpdate();
  3345. }
  3346. } // Private
  3347. ;
  3348. _proto._addEventListeners = function _addEventListeners() {
  3349. var _this = this;
  3350. $(this._element).on(Event$4.CLICK, function (event) {
  3351. event.preventDefault();
  3352. event.stopPropagation();
  3353. _this.toggle();
  3354. });
  3355. };
  3356. _proto._getConfig = function _getConfig(config) {
  3357. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3358. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3359. return config;
  3360. };
  3361. _proto._getMenuElement = function _getMenuElement() {
  3362. if (!this._menu) {
  3363. var parent = Dropdown._getParentFromElement(this._element);
  3364. if (parent) {
  3365. this._menu = parent.querySelector(Selector$4.MENU);
  3366. }
  3367. }
  3368. return this._menu;
  3369. };
  3370. _proto._getPlacement = function _getPlacement() {
  3371. var $parentDropdown = $(this._element.parentNode);
  3372. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3373. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3374. placement = AttachmentMap.TOP;
  3375. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3376. placement = AttachmentMap.TOPEND;
  3377. }
  3378. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3379. placement = AttachmentMap.RIGHT;
  3380. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3381. placement = AttachmentMap.LEFT;
  3382. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3383. placement = AttachmentMap.BOTTOMEND;
  3384. }
  3385. return placement;
  3386. };
  3387. _proto._detectNavbar = function _detectNavbar() {
  3388. return $(this._element).closest('.navbar').length > 0;
  3389. };
  3390. _proto._getOffset = function _getOffset() {
  3391. var _this2 = this;
  3392. var offset = {};
  3393. if (typeof this._config.offset === 'function') {
  3394. offset.fn = function (data) {
  3395. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3396. return data;
  3397. };
  3398. } else {
  3399. offset.offset = this._config.offset;
  3400. }
  3401. return offset;
  3402. };
  3403. _proto._getPopperConfig = function _getPopperConfig() {
  3404. var popperConfig = {
  3405. placement: this._getPlacement(),
  3406. modifiers: {
  3407. offset: this._getOffset(),
  3408. flip: {
  3409. enabled: this._config.flip
  3410. },
  3411. preventOverflow: {
  3412. boundariesElement: this._config.boundary
  3413. }
  3414. }
  3415. }; // Disable Popper.js if we have a static display
  3416. if (this._config.display === 'static') {
  3417. popperConfig.modifiers.applyStyle = {
  3418. enabled: false
  3419. };
  3420. }
  3421. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3422. } // Static
  3423. ;
  3424. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3425. return this.each(function () {
  3426. var data = $(this).data(DATA_KEY$4);
  3427. var _config = typeof config === 'object' ? config : null;
  3428. if (!data) {
  3429. data = new Dropdown(this, _config);
  3430. $(this).data(DATA_KEY$4, data);
  3431. }
  3432. if (typeof config === 'string') {
  3433. if (typeof data[config] === 'undefined') {
  3434. throw new TypeError("No method named \"" + config + "\"");
  3435. }
  3436. data[config]();
  3437. }
  3438. });
  3439. };
  3440. Dropdown._clearMenus = function _clearMenus(event) {
  3441. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3442. return;
  3443. }
  3444. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3445. for (var i = 0, len = toggles.length; i < len; i++) {
  3446. var parent = Dropdown._getParentFromElement(toggles[i]);
  3447. var context = $(toggles[i]).data(DATA_KEY$4);
  3448. var relatedTarget = {
  3449. relatedTarget: toggles[i]
  3450. };
  3451. if (event && event.type === 'click') {
  3452. relatedTarget.clickEvent = event;
  3453. }
  3454. if (!context) {
  3455. continue;
  3456. }
  3457. var dropdownMenu = context._menu;
  3458. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3459. continue;
  3460. }
  3461. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3462. continue;
  3463. }
  3464. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3465. $(parent).trigger(hideEvent);
  3466. if (hideEvent.isDefaultPrevented()) {
  3467. continue;
  3468. } // If this is a touch-enabled device we remove the extra
  3469. // empty mouseover listeners we added for iOS support
  3470. if ('ontouchstart' in document.documentElement) {
  3471. $(document.body).children().off('mouseover', null, $.noop);
  3472. }
  3473. toggles[i].setAttribute('aria-expanded', 'false');
  3474. if (context._popper) {
  3475. context._popper.destroy();
  3476. }
  3477. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3478. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3479. }
  3480. };
  3481. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3482. var parent;
  3483. var selector = Util.getSelectorFromElement(element);
  3484. if (selector) {
  3485. parent = document.querySelector(selector);
  3486. }
  3487. return parent || element.parentNode;
  3488. } // eslint-disable-next-line complexity
  3489. ;
  3490. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3491. // If not input/textarea:
  3492. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3493. // If input/textarea:
  3494. // - If space key => not a dropdown command
  3495. // - If key is other than escape
  3496. // - If key is not up or down => not a dropdown command
  3497. // - If trigger inside the menu => not a dropdown command
  3498. 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)) {
  3499. return;
  3500. }
  3501. event.preventDefault();
  3502. event.stopPropagation();
  3503. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3504. return;
  3505. }
  3506. var parent = Dropdown._getParentFromElement(this);
  3507. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3508. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3509. return;
  3510. }
  3511. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3512. if (event.which === ESCAPE_KEYCODE) {
  3513. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3514. $(toggle).trigger('focus');
  3515. }
  3516. $(this).trigger('click');
  3517. return;
  3518. }
  3519. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3520. return $(item).is(':visible');
  3521. });
  3522. if (items.length === 0) {
  3523. return;
  3524. }
  3525. var index = items.indexOf(event.target);
  3526. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3527. // Up
  3528. index--;
  3529. }
  3530. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3531. // Down
  3532. index++;
  3533. }
  3534. if (index < 0) {
  3535. index = 0;
  3536. }
  3537. items[index].focus();
  3538. };
  3539. _createClass(Dropdown, null, [{
  3540. key: "VERSION",
  3541. get: function get() {
  3542. return VERSION$4;
  3543. }
  3544. }, {
  3545. key: "Default",
  3546. get: function get() {
  3547. return Default$2;
  3548. }
  3549. }, {
  3550. key: "DefaultType",
  3551. get: function get() {
  3552. return DefaultType$2;
  3553. }
  3554. }]);
  3555. return Dropdown;
  3556. }();
  3557. /**
  3558. * ------------------------------------------------------------------------
  3559. * Data Api implementation
  3560. * ------------------------------------------------------------------------
  3561. */
  3562. $(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) {
  3563. event.preventDefault();
  3564. event.stopPropagation();
  3565. Dropdown._jQueryInterface.call($(this), 'toggle');
  3566. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3567. e.stopPropagation();
  3568. });
  3569. /**
  3570. * ------------------------------------------------------------------------
  3571. * jQuery
  3572. * ------------------------------------------------------------------------
  3573. */
  3574. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3575. $.fn[NAME$4].Constructor = Dropdown;
  3576. $.fn[NAME$4].noConflict = function () {
  3577. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3578. return Dropdown._jQueryInterface;
  3579. };
  3580. /**
  3581. * ------------------------------------------------------------------------
  3582. * Constants
  3583. * ------------------------------------------------------------------------
  3584. */
  3585. var NAME$5 = 'modal';
  3586. var VERSION$5 = '4.4.1';
  3587. var DATA_KEY$5 = 'bs.modal';
  3588. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3589. var DATA_API_KEY$5 = '.data-api';
  3590. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3591. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3592. var Default$3 = {
  3593. backdrop: true,
  3594. keyboard: true,
  3595. focus: true,
  3596. show: true
  3597. };
  3598. var DefaultType$3 = {
  3599. backdrop: '(boolean|string)',
  3600. keyboard: 'boolean',
  3601. focus: 'boolean',
  3602. show: 'boolean'
  3603. };
  3604. var Event$5 = {
  3605. HIDE: "hide" + EVENT_KEY$5,
  3606. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3607. HIDDEN: "hidden" + EVENT_KEY$5,
  3608. SHOW: "show" + EVENT_KEY$5,
  3609. SHOWN: "shown" + EVENT_KEY$5,
  3610. FOCUSIN: "focusin" + EVENT_KEY$5,
  3611. RESIZE: "resize" + EVENT_KEY$5,
  3612. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3613. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3614. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3615. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3616. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3617. };
  3618. var ClassName$5 = {
  3619. SCROLLABLE: 'modal-dialog-scrollable',
  3620. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3621. BACKDROP: 'modal-backdrop',
  3622. OPEN: 'modal-open',
  3623. FADE: 'fade',
  3624. SHOW: 'show',
  3625. STATIC: 'modal-static'
  3626. };
  3627. var Selector$5 = {
  3628. DIALOG: '.modal-dialog',
  3629. MODAL_BODY: '.modal-body',
  3630. DATA_TOGGLE: '[data-toggle="modal"]',
  3631. DATA_DISMISS: '[data-dismiss="modal"]',
  3632. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3633. STICKY_CONTENT: '.sticky-top'
  3634. };
  3635. /**
  3636. * ------------------------------------------------------------------------
  3637. * Class Definition
  3638. * ------------------------------------------------------------------------
  3639. */
  3640. var Modal =
  3641. /*#__PURE__*/
  3642. function () {
  3643. function Modal(element, config) {
  3644. this._config = this._getConfig(config);
  3645. this._element = element;
  3646. this._dialog = element.querySelector(Selector$5.DIALOG);
  3647. this._backdrop = null;
  3648. this._isShown = false;
  3649. this._isBodyOverflowing = false;
  3650. this._ignoreBackdropClick = false;
  3651. this._isTransitioning = false;
  3652. this._scrollbarWidth = 0;
  3653. } // Getters
  3654. var _proto = Modal.prototype;
  3655. // Public
  3656. _proto.toggle = function toggle(relatedTarget) {
  3657. return this._isShown ? this.hide() : this.show(relatedTarget);
  3658. };
  3659. _proto.show = function show(relatedTarget) {
  3660. var _this = this;
  3661. if (this._isShown || this._isTransitioning) {
  3662. return;
  3663. }
  3664. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3665. this._isTransitioning = true;
  3666. }
  3667. var showEvent = $.Event(Event$5.SHOW, {
  3668. relatedTarget: relatedTarget
  3669. });
  3670. $(this._element).trigger(showEvent);
  3671. if (this._isShown || showEvent.isDefaultPrevented()) {
  3672. return;
  3673. }
  3674. this._isShown = true;
  3675. this._checkScrollbar();
  3676. this._setScrollbar();
  3677. this._adjustDialog();
  3678. this._setEscapeEvent();
  3679. this._setResizeEvent();
  3680. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3681. return _this.hide(event);
  3682. });
  3683. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3684. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3685. if ($(event.target).is(_this._element)) {
  3686. _this._ignoreBackdropClick = true;
  3687. }
  3688. });
  3689. });
  3690. this._showBackdrop(function () {
  3691. return _this._showElement(relatedTarget);
  3692. });
  3693. };
  3694. _proto.hide = function hide(event) {
  3695. var _this2 = this;
  3696. if (event) {
  3697. event.preventDefault();
  3698. }
  3699. if (!this._isShown || this._isTransitioning) {
  3700. return;
  3701. }
  3702. var hideEvent = $.Event(Event$5.HIDE);
  3703. $(this._element).trigger(hideEvent);
  3704. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3705. return;
  3706. }
  3707. this._isShown = false;
  3708. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3709. if (transition) {
  3710. this._isTransitioning = true;
  3711. }
  3712. this._setEscapeEvent();
  3713. this._setResizeEvent();
  3714. $(document).off(Event$5.FOCUSIN);
  3715. $(this._element).removeClass(ClassName$5.SHOW);
  3716. $(this._element).off(Event$5.CLICK_DISMISS);
  3717. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3718. if (transition) {
  3719. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3720. $(this._element).one(Util.TRANSITION_END, function (event) {
  3721. return _this2._hideModal(event);
  3722. }).emulateTransitionEnd(transitionDuration);
  3723. } else {
  3724. this._hideModal();
  3725. }
  3726. };
  3727. _proto.dispose = function dispose() {
  3728. [window, this._element, this._dialog].forEach(function (htmlElement) {
  3729. return $(htmlElement).off(EVENT_KEY$5);
  3730. });
  3731. /**
  3732. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  3733. * Do not move `document` in `htmlElements` array
  3734. * It will remove `Event.CLICK_DATA_API` event that should remain
  3735. */
  3736. $(document).off(Event$5.FOCUSIN);
  3737. $.removeData(this._element, DATA_KEY$5);
  3738. this._config = null;
  3739. this._element = null;
  3740. this._dialog = null;
  3741. this._backdrop = null;
  3742. this._isShown = null;
  3743. this._isBodyOverflowing = null;
  3744. this._ignoreBackdropClick = null;
  3745. this._isTransitioning = null;
  3746. this._scrollbarWidth = null;
  3747. };
  3748. _proto.handleUpdate = function handleUpdate() {
  3749. this._adjustDialog();
  3750. } // Private
  3751. ;
  3752. _proto._getConfig = function _getConfig(config) {
  3753. config = _objectSpread2({}, Default$3, {}, config);
  3754. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  3755. return config;
  3756. };
  3757. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  3758. var _this3 = this;
  3759. if (this._config.backdrop === 'static') {
  3760. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  3761. $(this._element).trigger(hideEventPrevented);
  3762. if (hideEventPrevented.defaultPrevented) {
  3763. return;
  3764. }
  3765. this._element.classList.add(ClassName$5.STATIC);
  3766. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  3767. $(this._element).one(Util.TRANSITION_END, function () {
  3768. _this3._element.classList.remove(ClassName$5.STATIC);
  3769. }).emulateTransitionEnd(modalTransitionDuration);
  3770. this._element.focus();
  3771. } else {
  3772. this.hide();
  3773. }
  3774. };
  3775. _proto._showElement = function _showElement(relatedTarget) {
  3776. var _this4 = this;
  3777. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3778. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  3779. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  3780. // Don't move modal's DOM position
  3781. document.body.appendChild(this._element);
  3782. }
  3783. this._element.style.display = 'block';
  3784. this._element.removeAttribute('aria-hidden');
  3785. this._element.setAttribute('aria-modal', true);
  3786. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  3787. modalBody.scrollTop = 0;
  3788. } else {
  3789. this._element.scrollTop = 0;
  3790. }
  3791. if (transition) {
  3792. Util.reflow(this._element);
  3793. }
  3794. $(this._element).addClass(ClassName$5.SHOW);
  3795. if (this._config.focus) {
  3796. this._enforceFocus();
  3797. }
  3798. var shownEvent = $.Event(Event$5.SHOWN, {
  3799. relatedTarget: relatedTarget
  3800. });
  3801. var transitionComplete = function transitionComplete() {
  3802. if (_this4._config.focus) {
  3803. _this4._element.focus();
  3804. }
  3805. _this4._isTransitioning = false;
  3806. $(_this4._element).trigger(shownEvent);
  3807. };
  3808. if (transition) {
  3809. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  3810. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  3811. } else {
  3812. transitionComplete();
  3813. }
  3814. };
  3815. _proto._enforceFocus = function _enforceFocus() {
  3816. var _this5 = this;
  3817. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  3818. .on(Event$5.FOCUSIN, function (event) {
  3819. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  3820. _this5._element.focus();
  3821. }
  3822. });
  3823. };
  3824. _proto._setEscapeEvent = function _setEscapeEvent() {
  3825. var _this6 = this;
  3826. if (this._isShown && this._config.keyboard) {
  3827. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  3828. if (event.which === ESCAPE_KEYCODE$1) {
  3829. _this6._triggerBackdropTransition();
  3830. }
  3831. });
  3832. } else if (!this._isShown) {
  3833. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  3834. }
  3835. };
  3836. _proto._setResizeEvent = function _setResizeEvent() {
  3837. var _this7 = this;
  3838. if (this._isShown) {
  3839. $(window).on(Event$5.RESIZE, function (event) {
  3840. return _this7.handleUpdate(event);
  3841. });
  3842. } else {
  3843. $(window).off(Event$5.RESIZE);
  3844. }
  3845. };
  3846. _proto._hideModal = function _hideModal() {
  3847. var _this8 = this;
  3848. this._element.style.display = 'none';
  3849. this._element.setAttribute('aria-hidden', true);
  3850. this._element.removeAttribute('aria-modal');
  3851. this._isTransitioning = false;
  3852. this._showBackdrop(function () {
  3853. $(document.body).removeClass(ClassName$5.OPEN);
  3854. _this8._resetAdjustments();
  3855. _this8._resetScrollbar();
  3856. $(_this8._element).trigger(Event$5.HIDDEN);
  3857. });
  3858. };
  3859. _proto._removeBackdrop = function _removeBackdrop() {
  3860. if (this._backdrop) {
  3861. $(this._backdrop).remove();
  3862. this._backdrop = null;
  3863. }
  3864. };
  3865. _proto._showBackdrop = function _showBackdrop(callback) {
  3866. var _this9 = this;
  3867. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  3868. if (this._isShown && this._config.backdrop) {
  3869. this._backdrop = document.createElement('div');
  3870. this._backdrop.className = ClassName$5.BACKDROP;
  3871. if (animate) {
  3872. this._backdrop.classList.add(animate);
  3873. }
  3874. $(this._backdrop).appendTo(document.body);
  3875. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  3876. if (_this9._ignoreBackdropClick) {
  3877. _this9._ignoreBackdropClick = false;
  3878. return;
  3879. }
  3880. if (event.target !== event.currentTarget) {
  3881. return;
  3882. }
  3883. _this9._triggerBackdropTransition();
  3884. });
  3885. if (animate) {
  3886. Util.reflow(this._backdrop);
  3887. }
  3888. $(this._backdrop).addClass(ClassName$5.SHOW);
  3889. if (!callback) {
  3890. return;
  3891. }
  3892. if (!animate) {
  3893. callback();
  3894. return;
  3895. }
  3896. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3897. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  3898. } else if (!this._isShown && this._backdrop) {
  3899. $(this._backdrop).removeClass(ClassName$5.SHOW);
  3900. var callbackRemove = function callbackRemove() {
  3901. _this9._removeBackdrop();
  3902. if (callback) {
  3903. callback();
  3904. }
  3905. };
  3906. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3907. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  3908. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  3909. } else {
  3910. callbackRemove();
  3911. }
  3912. } else if (callback) {
  3913. callback();
  3914. }
  3915. } // ----------------------------------------------------------------------
  3916. // the following methods are used to handle overflowing modals
  3917. // todo (fat): these should probably be refactored out of modal.js
  3918. // ----------------------------------------------------------------------
  3919. ;
  3920. _proto._adjustDialog = function _adjustDialog() {
  3921. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3922. if (!this._isBodyOverflowing && isModalOverflowing) {
  3923. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  3924. }
  3925. if (this._isBodyOverflowing && !isModalOverflowing) {
  3926. this._element.style.paddingRight = this._scrollbarWidth + "px";
  3927. }
  3928. };
  3929. _proto._resetAdjustments = function _resetAdjustments() {
  3930. this._element.style.paddingLeft = '';
  3931. this._element.style.paddingRight = '';
  3932. };
  3933. _proto._checkScrollbar = function _checkScrollbar() {
  3934. var rect = document.body.getBoundingClientRect();
  3935. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  3936. this._scrollbarWidth = this._getScrollbarWidth();
  3937. };
  3938. _proto._setScrollbar = function _setScrollbar() {
  3939. var _this10 = this;
  3940. if (this._isBodyOverflowing) {
  3941. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  3942. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  3943. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  3944. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  3945. $(fixedContent).each(function (index, element) {
  3946. var actualPadding = element.style.paddingRight;
  3947. var calculatedPadding = $(element).css('padding-right');
  3948. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  3949. }); // Adjust sticky content margin
  3950. $(stickyContent).each(function (index, element) {
  3951. var actualMargin = element.style.marginRight;
  3952. var calculatedMargin = $(element).css('margin-right');
  3953. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  3954. }); // Adjust body padding
  3955. var actualPadding = document.body.style.paddingRight;
  3956. var calculatedPadding = $(document.body).css('padding-right');
  3957. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  3958. }
  3959. $(document.body).addClass(ClassName$5.OPEN);
  3960. };
  3961. _proto._resetScrollbar = function _resetScrollbar() {
  3962. // Restore fixed content padding
  3963. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  3964. $(fixedContent).each(function (index, element) {
  3965. var padding = $(element).data('padding-right');
  3966. $(element).removeData('padding-right');
  3967. element.style.paddingRight = padding ? padding : '';
  3968. }); // Restore sticky content
  3969. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  3970. $(elements).each(function (index, element) {
  3971. var margin = $(element).data('margin-right');
  3972. if (typeof margin !== 'undefined') {
  3973. $(element).css('margin-right', margin).removeData('margin-right');
  3974. }
  3975. }); // Restore body padding
  3976. var padding = $(document.body).data('padding-right');
  3977. $(document.body).removeData('padding-right');
  3978. document.body.style.paddingRight = padding ? padding : '';
  3979. };
  3980. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  3981. // thx d.walsh
  3982. var scrollDiv = document.createElement('div');
  3983. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  3984. document.body.appendChild(scrollDiv);
  3985. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  3986. document.body.removeChild(scrollDiv);
  3987. return scrollbarWidth;
  3988. } // Static
  3989. ;
  3990. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  3991. return this.each(function () {
  3992. var data = $(this).data(DATA_KEY$5);
  3993. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  3994. if (!data) {
  3995. data = new Modal(this, _config);
  3996. $(this).data(DATA_KEY$5, data);
  3997. }
  3998. if (typeof config === 'string') {
  3999. if (typeof data[config] === 'undefined') {
  4000. throw new TypeError("No method named \"" + config + "\"");
  4001. }
  4002. data[config](relatedTarget);
  4003. } else if (_config.show) {
  4004. data.show(relatedTarget);
  4005. }
  4006. });
  4007. };
  4008. _createClass(Modal, null, [{
  4009. key: "VERSION",
  4010. get: function get() {
  4011. return VERSION$5;
  4012. }
  4013. }, {
  4014. key: "Default",
  4015. get: function get() {
  4016. return Default$3;
  4017. }
  4018. }]);
  4019. return Modal;
  4020. }();
  4021. /**
  4022. * ------------------------------------------------------------------------
  4023. * Data Api implementation
  4024. * ------------------------------------------------------------------------
  4025. */
  4026. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4027. var _this11 = this;
  4028. var target;
  4029. var selector = Util.getSelectorFromElement(this);
  4030. if (selector) {
  4031. target = document.querySelector(selector);
  4032. }
  4033. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4034. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4035. event.preventDefault();
  4036. }
  4037. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4038. if (showEvent.isDefaultPrevented()) {
  4039. // Only register focus restorer if modal will actually get shown
  4040. return;
  4041. }
  4042. $target.one(Event$5.HIDDEN, function () {
  4043. if ($(_this11).is(':visible')) {
  4044. _this11.focus();
  4045. }
  4046. });
  4047. });
  4048. Modal._jQueryInterface.call($(target), config, this);
  4049. });
  4050. /**
  4051. * ------------------------------------------------------------------------
  4052. * jQuery
  4053. * ------------------------------------------------------------------------
  4054. */
  4055. $.fn[NAME$5] = Modal._jQueryInterface;
  4056. $.fn[NAME$5].Constructor = Modal;
  4057. $.fn[NAME$5].noConflict = function () {
  4058. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4059. return Modal._jQueryInterface;
  4060. };
  4061. /**
  4062. * --------------------------------------------------------------------------
  4063. * Bootstrap (v4.4.1): tools/sanitizer.js
  4064. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4065. * --------------------------------------------------------------------------
  4066. */
  4067. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4068. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4069. var DefaultWhitelist = {
  4070. // Global attributes allowed on any supplied element below.
  4071. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4072. a: ['target', 'href', 'title', 'rel'],
  4073. area: [],
  4074. b: [],
  4075. br: [],
  4076. col: [],
  4077. code: [],
  4078. div: [],
  4079. em: [],
  4080. hr: [],
  4081. h1: [],
  4082. h2: [],
  4083. h3: [],
  4084. h4: [],
  4085. h5: [],
  4086. h6: [],
  4087. i: [],
  4088. img: ['src', 'alt', 'title', 'width', 'height'],
  4089. li: [],
  4090. ol: [],
  4091. p: [],
  4092. pre: [],
  4093. s: [],
  4094. small: [],
  4095. span: [],
  4096. sub: [],
  4097. sup: [],
  4098. strong: [],
  4099. u: [],
  4100. ul: []
  4101. };
  4102. /**
  4103. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4104. *
  4105. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4106. */
  4107. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4108. /**
  4109. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4110. *
  4111. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4112. */
  4113. 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;
  4114. function allowedAttribute(attr, allowedAttributeList) {
  4115. var attrName = attr.nodeName.toLowerCase();
  4116. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4117. if (uriAttrs.indexOf(attrName) !== -1) {
  4118. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4119. }
  4120. return true;
  4121. }
  4122. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4123. return attrRegex instanceof RegExp;
  4124. }); // Check if a regular expression validates the attribute.
  4125. for (var i = 0, l = regExp.length; i < l; i++) {
  4126. if (attrName.match(regExp[i])) {
  4127. return true;
  4128. }
  4129. }
  4130. return false;
  4131. }
  4132. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4133. if (unsafeHtml.length === 0) {
  4134. return unsafeHtml;
  4135. }
  4136. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4137. return sanitizeFn(unsafeHtml);
  4138. }
  4139. var domParser = new window.DOMParser();
  4140. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4141. var whitelistKeys = Object.keys(whiteList);
  4142. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4143. var _loop = function _loop(i, len) {
  4144. var el = elements[i];
  4145. var elName = el.nodeName.toLowerCase();
  4146. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4147. el.parentNode.removeChild(el);
  4148. return "continue";
  4149. }
  4150. var attributeList = [].slice.call(el.attributes);
  4151. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4152. attributeList.forEach(function (attr) {
  4153. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4154. el.removeAttribute(attr.nodeName);
  4155. }
  4156. });
  4157. };
  4158. for (var i = 0, len = elements.length; i < len; i++) {
  4159. var _ret = _loop(i);
  4160. if (_ret === "continue") continue;
  4161. }
  4162. return createdDocument.body.innerHTML;
  4163. }
  4164. /**
  4165. * ------------------------------------------------------------------------
  4166. * Constants
  4167. * ------------------------------------------------------------------------
  4168. */
  4169. var NAME$6 = 'tooltip';
  4170. var VERSION$6 = '4.4.1';
  4171. var DATA_KEY$6 = 'bs.tooltip';
  4172. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4173. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4174. var CLASS_PREFIX = 'bs-tooltip';
  4175. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4176. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4177. var DefaultType$4 = {
  4178. animation: 'boolean',
  4179. template: 'string',
  4180. title: '(string|element|function)',
  4181. trigger: 'string',
  4182. delay: '(number|object)',
  4183. html: 'boolean',
  4184. selector: '(string|boolean)',
  4185. placement: '(string|function)',
  4186. offset: '(number|string|function)',
  4187. container: '(string|element|boolean)',
  4188. fallbackPlacement: '(string|array)',
  4189. boundary: '(string|element)',
  4190. sanitize: 'boolean',
  4191. sanitizeFn: '(null|function)',
  4192. whiteList: 'object',
  4193. popperConfig: '(null|object)'
  4194. };
  4195. var AttachmentMap$1 = {
  4196. AUTO: 'auto',
  4197. TOP: 'top',
  4198. RIGHT: 'right',
  4199. BOTTOM: 'bottom',
  4200. LEFT: 'left'
  4201. };
  4202. var Default$4 = {
  4203. animation: true,
  4204. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4205. trigger: 'hover focus',
  4206. title: '',
  4207. delay: 0,
  4208. html: false,
  4209. selector: false,
  4210. placement: 'top',
  4211. offset: 0,
  4212. container: false,
  4213. fallbackPlacement: 'flip',
  4214. boundary: 'scrollParent',
  4215. sanitize: true,
  4216. sanitizeFn: null,
  4217. whiteList: DefaultWhitelist,
  4218. popperConfig: null
  4219. };
  4220. var HoverState = {
  4221. SHOW: 'show',
  4222. OUT: 'out'
  4223. };
  4224. var Event$6 = {
  4225. HIDE: "hide" + EVENT_KEY$6,
  4226. HIDDEN: "hidden" + EVENT_KEY$6,
  4227. SHOW: "show" + EVENT_KEY$6,
  4228. SHOWN: "shown" + EVENT_KEY$6,
  4229. INSERTED: "inserted" + EVENT_KEY$6,
  4230. CLICK: "click" + EVENT_KEY$6,
  4231. FOCUSIN: "focusin" + EVENT_KEY$6,
  4232. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4233. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4234. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4235. };
  4236. var ClassName$6 = {
  4237. FADE: 'fade',
  4238. SHOW: 'show'
  4239. };
  4240. var Selector$6 = {
  4241. TOOLTIP: '.tooltip',
  4242. TOOLTIP_INNER: '.tooltip-inner',
  4243. ARROW: '.arrow'
  4244. };
  4245. var Trigger = {
  4246. HOVER: 'hover',
  4247. FOCUS: 'focus',
  4248. CLICK: 'click',
  4249. MANUAL: 'manual'
  4250. };
  4251. /**
  4252. * ------------------------------------------------------------------------
  4253. * Class Definition
  4254. * ------------------------------------------------------------------------
  4255. */
  4256. var Tooltip =
  4257. /*#__PURE__*/
  4258. function () {
  4259. function Tooltip(element, config) {
  4260. if (typeof Popper === 'undefined') {
  4261. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4262. } // private
  4263. this._isEnabled = true;
  4264. this._timeout = 0;
  4265. this._hoverState = '';
  4266. this._activeTrigger = {};
  4267. this._popper = null; // Protected
  4268. this.element = element;
  4269. this.config = this._getConfig(config);
  4270. this.tip = null;
  4271. this._setListeners();
  4272. } // Getters
  4273. var _proto = Tooltip.prototype;
  4274. // Public
  4275. _proto.enable = function enable() {
  4276. this._isEnabled = true;
  4277. };
  4278. _proto.disable = function disable() {
  4279. this._isEnabled = false;
  4280. };
  4281. _proto.toggleEnabled = function toggleEnabled() {
  4282. this._isEnabled = !this._isEnabled;
  4283. };
  4284. _proto.toggle = function toggle(event) {
  4285. if (!this._isEnabled) {
  4286. return;
  4287. }
  4288. if (event) {
  4289. var dataKey = this.constructor.DATA_KEY;
  4290. var context = $(event.currentTarget).data(dataKey);
  4291. if (!context) {
  4292. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4293. $(event.currentTarget).data(dataKey, context);
  4294. }
  4295. context._activeTrigger.click = !context._activeTrigger.click;
  4296. if (context._isWithActiveTrigger()) {
  4297. context._enter(null, context);
  4298. } else {
  4299. context._leave(null, context);
  4300. }
  4301. } else {
  4302. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4303. this._leave(null, this);
  4304. return;
  4305. }
  4306. this._enter(null, this);
  4307. }
  4308. };
  4309. _proto.dispose = function dispose() {
  4310. clearTimeout(this._timeout);
  4311. $.removeData(this.element, this.constructor.DATA_KEY);
  4312. $(this.element).off(this.constructor.EVENT_KEY);
  4313. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4314. if (this.tip) {
  4315. $(this.tip).remove();
  4316. }
  4317. this._isEnabled = null;
  4318. this._timeout = null;
  4319. this._hoverState = null;
  4320. this._activeTrigger = null;
  4321. if (this._popper) {
  4322. this._popper.destroy();
  4323. }
  4324. this._popper = null;
  4325. this.element = null;
  4326. this.config = null;
  4327. this.tip = null;
  4328. };
  4329. _proto.show = function show() {
  4330. var _this = this;
  4331. if ($(this.element).css('display') === 'none') {
  4332. throw new Error('Please use show on visible elements');
  4333. }
  4334. var showEvent = $.Event(this.constructor.Event.SHOW);
  4335. if (this.isWithContent() && this._isEnabled) {
  4336. $(this.element).trigger(showEvent);
  4337. var shadowRoot = Util.findShadowRoot(this.element);
  4338. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4339. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4340. return;
  4341. }
  4342. var tip = this.getTipElement();
  4343. var tipId = Util.getUID(this.constructor.NAME);
  4344. tip.setAttribute('id', tipId);
  4345. this.element.setAttribute('aria-describedby', tipId);
  4346. this.setContent();
  4347. if (this.config.animation) {
  4348. $(tip).addClass(ClassName$6.FADE);
  4349. }
  4350. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4351. var attachment = this._getAttachment(placement);
  4352. this.addAttachmentClass(attachment);
  4353. var container = this._getContainer();
  4354. $(tip).data(this.constructor.DATA_KEY, this);
  4355. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4356. $(tip).appendTo(container);
  4357. }
  4358. $(this.element).trigger(this.constructor.Event.INSERTED);
  4359. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4360. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4361. // empty mouseover listeners to the body's immediate children;
  4362. // only needed because of broken event delegation on iOS
  4363. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4364. if ('ontouchstart' in document.documentElement) {
  4365. $(document.body).children().on('mouseover', null, $.noop);
  4366. }
  4367. var complete = function complete() {
  4368. if (_this.config.animation) {
  4369. _this._fixTransition();
  4370. }
  4371. var prevHoverState = _this._hoverState;
  4372. _this._hoverState = null;
  4373. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4374. if (prevHoverState === HoverState.OUT) {
  4375. _this._leave(null, _this);
  4376. }
  4377. };
  4378. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4379. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4380. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4381. } else {
  4382. complete();
  4383. }
  4384. }
  4385. };
  4386. _proto.hide = function hide(callback) {
  4387. var _this2 = this;
  4388. var tip = this.getTipElement();
  4389. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4390. var complete = function complete() {
  4391. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4392. tip.parentNode.removeChild(tip);
  4393. }
  4394. _this2._cleanTipClass();
  4395. _this2.element.removeAttribute('aria-describedby');
  4396. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4397. if (_this2._popper !== null) {
  4398. _this2._popper.destroy();
  4399. }
  4400. if (callback) {
  4401. callback();
  4402. }
  4403. };
  4404. $(this.element).trigger(hideEvent);
  4405. if (hideEvent.isDefaultPrevented()) {
  4406. return;
  4407. }
  4408. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4409. // empty mouseover listeners we added for iOS support
  4410. if ('ontouchstart' in document.documentElement) {
  4411. $(document.body).children().off('mouseover', null, $.noop);
  4412. }
  4413. this._activeTrigger[Trigger.CLICK] = false;
  4414. this._activeTrigger[Trigger.FOCUS] = false;
  4415. this._activeTrigger[Trigger.HOVER] = false;
  4416. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4417. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4418. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4419. } else {
  4420. complete();
  4421. }
  4422. this._hoverState = '';
  4423. };
  4424. _proto.update = function update() {
  4425. if (this._popper !== null) {
  4426. this._popper.scheduleUpdate();
  4427. }
  4428. } // Protected
  4429. ;
  4430. _proto.isWithContent = function isWithContent() {
  4431. return Boolean(this.getTitle());
  4432. };
  4433. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4434. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4435. };
  4436. _proto.getTipElement = function getTipElement() {
  4437. this.tip = this.tip || $(this.config.template)[0];
  4438. return this.tip;
  4439. };
  4440. _proto.setContent = function setContent() {
  4441. var tip = this.getTipElement();
  4442. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4443. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4444. };
  4445. _proto.setElementContent = function setElementContent($element, content) {
  4446. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4447. // Content is a DOM node or a jQuery
  4448. if (this.config.html) {
  4449. if (!$(content).parent().is($element)) {
  4450. $element.empty().append(content);
  4451. }
  4452. } else {
  4453. $element.text($(content).text());
  4454. }
  4455. return;
  4456. }
  4457. if (this.config.html) {
  4458. if (this.config.sanitize) {
  4459. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4460. }
  4461. $element.html(content);
  4462. } else {
  4463. $element.text(content);
  4464. }
  4465. };
  4466. _proto.getTitle = function getTitle() {
  4467. var title = this.element.getAttribute('data-original-title');
  4468. if (!title) {
  4469. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4470. }
  4471. return title;
  4472. } // Private
  4473. ;
  4474. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4475. var _this3 = this;
  4476. var defaultBsConfig = {
  4477. placement: attachment,
  4478. modifiers: {
  4479. offset: this._getOffset(),
  4480. flip: {
  4481. behavior: this.config.fallbackPlacement
  4482. },
  4483. arrow: {
  4484. element: Selector$6.ARROW
  4485. },
  4486. preventOverflow: {
  4487. boundariesElement: this.config.boundary
  4488. }
  4489. },
  4490. onCreate: function onCreate(data) {
  4491. if (data.originalPlacement !== data.placement) {
  4492. _this3._handlePopperPlacementChange(data);
  4493. }
  4494. },
  4495. onUpdate: function onUpdate(data) {
  4496. return _this3._handlePopperPlacementChange(data);
  4497. }
  4498. };
  4499. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4500. };
  4501. _proto._getOffset = function _getOffset() {
  4502. var _this4 = this;
  4503. var offset = {};
  4504. if (typeof this.config.offset === 'function') {
  4505. offset.fn = function (data) {
  4506. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4507. return data;
  4508. };
  4509. } else {
  4510. offset.offset = this.config.offset;
  4511. }
  4512. return offset;
  4513. };
  4514. _proto._getContainer = function _getContainer() {
  4515. if (this.config.container === false) {
  4516. return document.body;
  4517. }
  4518. if (Util.isElement(this.config.container)) {
  4519. return $(this.config.container);
  4520. }
  4521. return $(document).find(this.config.container);
  4522. };
  4523. _proto._getAttachment = function _getAttachment(placement) {
  4524. return AttachmentMap$1[placement.toUpperCase()];
  4525. };
  4526. _proto._setListeners = function _setListeners() {
  4527. var _this5 = this;
  4528. var triggers = this.config.trigger.split(' ');
  4529. triggers.forEach(function (trigger) {
  4530. if (trigger === 'click') {
  4531. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4532. return _this5.toggle(event);
  4533. });
  4534. } else if (trigger !== Trigger.MANUAL) {
  4535. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4536. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4537. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4538. return _this5._enter(event);
  4539. }).on(eventOut, _this5.config.selector, function (event) {
  4540. return _this5._leave(event);
  4541. });
  4542. }
  4543. });
  4544. this._hideModalHandler = function () {
  4545. if (_this5.element) {
  4546. _this5.hide();
  4547. }
  4548. };
  4549. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4550. if (this.config.selector) {
  4551. this.config = _objectSpread2({}, this.config, {
  4552. trigger: 'manual',
  4553. selector: ''
  4554. });
  4555. } else {
  4556. this._fixTitle();
  4557. }
  4558. };
  4559. _proto._fixTitle = function _fixTitle() {
  4560. var titleType = typeof this.element.getAttribute('data-original-title');
  4561. if (this.element.getAttribute('title') || titleType !== 'string') {
  4562. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4563. this.element.setAttribute('title', '');
  4564. }
  4565. };
  4566. _proto._enter = function _enter(event, context) {
  4567. var dataKey = this.constructor.DATA_KEY;
  4568. context = context || $(event.currentTarget).data(dataKey);
  4569. if (!context) {
  4570. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4571. $(event.currentTarget).data(dataKey, context);
  4572. }
  4573. if (event) {
  4574. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4575. }
  4576. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4577. context._hoverState = HoverState.SHOW;
  4578. return;
  4579. }
  4580. clearTimeout(context._timeout);
  4581. context._hoverState = HoverState.SHOW;
  4582. if (!context.config.delay || !context.config.delay.show) {
  4583. context.show();
  4584. return;
  4585. }
  4586. context._timeout = setTimeout(function () {
  4587. if (context._hoverState === HoverState.SHOW) {
  4588. context.show();
  4589. }
  4590. }, context.config.delay.show);
  4591. };
  4592. _proto._leave = function _leave(event, context) {
  4593. var dataKey = this.constructor.DATA_KEY;
  4594. context = context || $(event.currentTarget).data(dataKey);
  4595. if (!context) {
  4596. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4597. $(event.currentTarget).data(dataKey, context);
  4598. }
  4599. if (event) {
  4600. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4601. }
  4602. if (context._isWithActiveTrigger()) {
  4603. return;
  4604. }
  4605. clearTimeout(context._timeout);
  4606. context._hoverState = HoverState.OUT;
  4607. if (!context.config.delay || !context.config.delay.hide) {
  4608. context.hide();
  4609. return;
  4610. }
  4611. context._timeout = setTimeout(function () {
  4612. if (context._hoverState === HoverState.OUT) {
  4613. context.hide();
  4614. }
  4615. }, context.config.delay.hide);
  4616. };
  4617. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4618. for (var trigger in this._activeTrigger) {
  4619. if (this._activeTrigger[trigger]) {
  4620. return true;
  4621. }
  4622. }
  4623. return false;
  4624. };
  4625. _proto._getConfig = function _getConfig(config) {
  4626. var dataAttributes = $(this.element).data();
  4627. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4628. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4629. delete dataAttributes[dataAttr];
  4630. }
  4631. });
  4632. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4633. if (typeof config.delay === 'number') {
  4634. config.delay = {
  4635. show: config.delay,
  4636. hide: config.delay
  4637. };
  4638. }
  4639. if (typeof config.title === 'number') {
  4640. config.title = config.title.toString();
  4641. }
  4642. if (typeof config.content === 'number') {
  4643. config.content = config.content.toString();
  4644. }
  4645. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4646. if (config.sanitize) {
  4647. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4648. }
  4649. return config;
  4650. };
  4651. _proto._getDelegateConfig = function _getDelegateConfig() {
  4652. var config = {};
  4653. if (this.config) {
  4654. for (var key in this.config) {
  4655. if (this.constructor.Default[key] !== this.config[key]) {
  4656. config[key] = this.config[key];
  4657. }
  4658. }
  4659. }
  4660. return config;
  4661. };
  4662. _proto._cleanTipClass = function _cleanTipClass() {
  4663. var $tip = $(this.getTipElement());
  4664. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4665. if (tabClass !== null && tabClass.length) {
  4666. $tip.removeClass(tabClass.join(''));
  4667. }
  4668. };
  4669. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4670. var popperInstance = popperData.instance;
  4671. this.tip = popperInstance.popper;
  4672. this._cleanTipClass();
  4673. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4674. };
  4675. _proto._fixTransition = function _fixTransition() {
  4676. var tip = this.getTipElement();
  4677. var initConfigAnimation = this.config.animation;
  4678. if (tip.getAttribute('x-placement') !== null) {
  4679. return;
  4680. }
  4681. $(tip).removeClass(ClassName$6.FADE);
  4682. this.config.animation = false;
  4683. this.hide();
  4684. this.show();
  4685. this.config.animation = initConfigAnimation;
  4686. } // Static
  4687. ;
  4688. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4689. return this.each(function () {
  4690. var data = $(this).data(DATA_KEY$6);
  4691. var _config = typeof config === 'object' && config;
  4692. if (!data && /dispose|hide/.test(config)) {
  4693. return;
  4694. }
  4695. if (!data) {
  4696. data = new Tooltip(this, _config);
  4697. $(this).data(DATA_KEY$6, data);
  4698. }
  4699. if (typeof config === 'string') {
  4700. if (typeof data[config] === 'undefined') {
  4701. throw new TypeError("No method named \"" + config + "\"");
  4702. }
  4703. data[config]();
  4704. }
  4705. });
  4706. };
  4707. _createClass(Tooltip, null, [{
  4708. key: "VERSION",
  4709. get: function get() {
  4710. return VERSION$6;
  4711. }
  4712. }, {
  4713. key: "Default",
  4714. get: function get() {
  4715. return Default$4;
  4716. }
  4717. }, {
  4718. key: "NAME",
  4719. get: function get() {
  4720. return NAME$6;
  4721. }
  4722. }, {
  4723. key: "DATA_KEY",
  4724. get: function get() {
  4725. return DATA_KEY$6;
  4726. }
  4727. }, {
  4728. key: "Event",
  4729. get: function get() {
  4730. return Event$6;
  4731. }
  4732. }, {
  4733. key: "EVENT_KEY",
  4734. get: function get() {
  4735. return EVENT_KEY$6;
  4736. }
  4737. }, {
  4738. key: "DefaultType",
  4739. get: function get() {
  4740. return DefaultType$4;
  4741. }
  4742. }]);
  4743. return Tooltip;
  4744. }();
  4745. /**
  4746. * ------------------------------------------------------------------------
  4747. * jQuery
  4748. * ------------------------------------------------------------------------
  4749. */
  4750. $.fn[NAME$6] = Tooltip._jQueryInterface;
  4751. $.fn[NAME$6].Constructor = Tooltip;
  4752. $.fn[NAME$6].noConflict = function () {
  4753. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  4754. return Tooltip._jQueryInterface;
  4755. };
  4756. /**
  4757. * ------------------------------------------------------------------------
  4758. * Constants
  4759. * ------------------------------------------------------------------------
  4760. */
  4761. var NAME$7 = 'popover';
  4762. var VERSION$7 = '4.4.1';
  4763. var DATA_KEY$7 = 'bs.popover';
  4764. var EVENT_KEY$7 = "." + DATA_KEY$7;
  4765. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  4766. var CLASS_PREFIX$1 = 'bs-popover';
  4767. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  4768. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  4769. placement: 'right',
  4770. trigger: 'click',
  4771. content: '',
  4772. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  4773. });
  4774. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  4775. content: '(string|element|function)'
  4776. });
  4777. var ClassName$7 = {
  4778. FADE: 'fade',
  4779. SHOW: 'show'
  4780. };
  4781. var Selector$7 = {
  4782. TITLE: '.popover-header',
  4783. CONTENT: '.popover-body'
  4784. };
  4785. var Event$7 = {
  4786. HIDE: "hide" + EVENT_KEY$7,
  4787. HIDDEN: "hidden" + EVENT_KEY$7,
  4788. SHOW: "show" + EVENT_KEY$7,
  4789. SHOWN: "shown" + EVENT_KEY$7,
  4790. INSERTED: "inserted" + EVENT_KEY$7,
  4791. CLICK: "click" + EVENT_KEY$7,
  4792. FOCUSIN: "focusin" + EVENT_KEY$7,
  4793. FOCUSOUT: "focusout" + EVENT_KEY$7,
  4794. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  4795. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  4796. };
  4797. /**
  4798. * ------------------------------------------------------------------------
  4799. * Class Definition
  4800. * ------------------------------------------------------------------------
  4801. */
  4802. var Popover =
  4803. /*#__PURE__*/
  4804. function (_Tooltip) {
  4805. _inheritsLoose(Popover, _Tooltip);
  4806. function Popover() {
  4807. return _Tooltip.apply(this, arguments) || this;
  4808. }
  4809. var _proto = Popover.prototype;
  4810. // Overrides
  4811. _proto.isWithContent = function isWithContent() {
  4812. return this.getTitle() || this._getContent();
  4813. };
  4814. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4815. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  4816. };
  4817. _proto.getTipElement = function getTipElement() {
  4818. this.tip = this.tip || $(this.config.template)[0];
  4819. return this.tip;
  4820. };
  4821. _proto.setContent = function setContent() {
  4822. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  4823. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  4824. var content = this._getContent();
  4825. if (typeof content === 'function') {
  4826. content = content.call(this.element);
  4827. }
  4828. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  4829. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  4830. } // Private
  4831. ;
  4832. _proto._getContent = function _getContent() {
  4833. return this.element.getAttribute('data-content') || this.config.content;
  4834. };
  4835. _proto._cleanTipClass = function _cleanTipClass() {
  4836. var $tip = $(this.getTipElement());
  4837. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  4838. if (tabClass !== null && tabClass.length > 0) {
  4839. $tip.removeClass(tabClass.join(''));
  4840. }
  4841. } // Static
  4842. ;
  4843. Popover._jQueryInterface = function _jQueryInterface(config) {
  4844. return this.each(function () {
  4845. var data = $(this).data(DATA_KEY$7);
  4846. var _config = typeof config === 'object' ? config : null;
  4847. if (!data && /dispose|hide/.test(config)) {
  4848. return;
  4849. }
  4850. if (!data) {
  4851. data = new Popover(this, _config);
  4852. $(this).data(DATA_KEY$7, data);
  4853. }
  4854. if (typeof config === 'string') {
  4855. if (typeof data[config] === 'undefined') {
  4856. throw new TypeError("No method named \"" + config + "\"");
  4857. }
  4858. data[config]();
  4859. }
  4860. });
  4861. };
  4862. _createClass(Popover, null, [{
  4863. key: "VERSION",
  4864. // Getters
  4865. get: function get() {
  4866. return VERSION$7;
  4867. }
  4868. }, {
  4869. key: "Default",
  4870. get: function get() {
  4871. return Default$5;
  4872. }
  4873. }, {
  4874. key: "NAME",
  4875. get: function get() {
  4876. return NAME$7;
  4877. }
  4878. }, {
  4879. key: "DATA_KEY",
  4880. get: function get() {
  4881. return DATA_KEY$7;
  4882. }
  4883. }, {
  4884. key: "Event",
  4885. get: function get() {
  4886. return Event$7;
  4887. }
  4888. }, {
  4889. key: "EVENT_KEY",
  4890. get: function get() {
  4891. return EVENT_KEY$7;
  4892. }
  4893. }, {
  4894. key: "DefaultType",
  4895. get: function get() {
  4896. return DefaultType$5;
  4897. }
  4898. }]);
  4899. return Popover;
  4900. }(Tooltip);
  4901. /**
  4902. * ------------------------------------------------------------------------
  4903. * jQuery
  4904. * ------------------------------------------------------------------------
  4905. */
  4906. $.fn[NAME$7] = Popover._jQueryInterface;
  4907. $.fn[NAME$7].Constructor = Popover;
  4908. $.fn[NAME$7].noConflict = function () {
  4909. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  4910. return Popover._jQueryInterface;
  4911. };
  4912. /**
  4913. * ------------------------------------------------------------------------
  4914. * Constants
  4915. * ------------------------------------------------------------------------
  4916. */
  4917. var NAME$8 = 'scrollspy';
  4918. var VERSION$8 = '4.4.1';
  4919. var DATA_KEY$8 = 'bs.scrollspy';
  4920. var EVENT_KEY$8 = "." + DATA_KEY$8;
  4921. var DATA_API_KEY$6 = '.data-api';
  4922. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  4923. var Default$6 = {
  4924. offset: 10,
  4925. method: 'auto',
  4926. target: ''
  4927. };
  4928. var DefaultType$6 = {
  4929. offset: 'number',
  4930. method: 'string',
  4931. target: '(string|element)'
  4932. };
  4933. var Event$8 = {
  4934. ACTIVATE: "activate" + EVENT_KEY$8,
  4935. SCROLL: "scroll" + EVENT_KEY$8,
  4936. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  4937. };
  4938. var ClassName$8 = {
  4939. DROPDOWN_ITEM: 'dropdown-item',
  4940. DROPDOWN_MENU: 'dropdown-menu',
  4941. ACTIVE: 'active'
  4942. };
  4943. var Selector$8 = {
  4944. DATA_SPY: '[data-spy="scroll"]',
  4945. ACTIVE: '.active',
  4946. NAV_LIST_GROUP: '.nav, .list-group',
  4947. NAV_LINKS: '.nav-link',
  4948. NAV_ITEMS: '.nav-item',
  4949. LIST_ITEMS: '.list-group-item',
  4950. DROPDOWN: '.dropdown',
  4951. DROPDOWN_ITEMS: '.dropdown-item',
  4952. DROPDOWN_TOGGLE: '.dropdown-toggle'
  4953. };
  4954. var OffsetMethod = {
  4955. OFFSET: 'offset',
  4956. POSITION: 'position'
  4957. };
  4958. /**
  4959. * ------------------------------------------------------------------------
  4960. * Class Definition
  4961. * ------------------------------------------------------------------------
  4962. */
  4963. var ScrollSpy =
  4964. /*#__PURE__*/
  4965. function () {
  4966. function ScrollSpy(element, config) {
  4967. var _this = this;
  4968. this._element = element;
  4969. this._scrollElement = element.tagName === 'BODY' ? window : element;
  4970. this._config = this._getConfig(config);
  4971. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  4972. this._offsets = [];
  4973. this._targets = [];
  4974. this._activeTarget = null;
  4975. this._scrollHeight = 0;
  4976. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  4977. return _this._process(event);
  4978. });
  4979. this.refresh();
  4980. this._process();
  4981. } // Getters
  4982. var _proto = ScrollSpy.prototype;
  4983. // Public
  4984. _proto.refresh = function refresh() {
  4985. var _this2 = this;
  4986. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  4987. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  4988. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  4989. this._offsets = [];
  4990. this._targets = [];
  4991. this._scrollHeight = this._getScrollHeight();
  4992. var targets = [].slice.call(document.querySelectorAll(this._selector));
  4993. targets.map(function (element) {
  4994. var target;
  4995. var targetSelector = Util.getSelectorFromElement(element);
  4996. if (targetSelector) {
  4997. target = document.querySelector(targetSelector);
  4998. }
  4999. if (target) {
  5000. var targetBCR = target.getBoundingClientRect();
  5001. if (targetBCR.width || targetBCR.height) {
  5002. // TODO (fat): remove sketch reliance on jQuery position/offset
  5003. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5004. }
  5005. }
  5006. return null;
  5007. }).filter(function (item) {
  5008. return item;
  5009. }).sort(function (a, b) {
  5010. return a[0] - b[0];
  5011. }).forEach(function (item) {
  5012. _this2._offsets.push(item[0]);
  5013. _this2._targets.push(item[1]);
  5014. });
  5015. };
  5016. _proto.dispose = function dispose() {
  5017. $.removeData(this._element, DATA_KEY$8);
  5018. $(this._scrollElement).off(EVENT_KEY$8);
  5019. this._element = null;
  5020. this._scrollElement = null;
  5021. this._config = null;
  5022. this._selector = null;
  5023. this._offsets = null;
  5024. this._targets = null;
  5025. this._activeTarget = null;
  5026. this._scrollHeight = null;
  5027. } // Private
  5028. ;
  5029. _proto._getConfig = function _getConfig(config) {
  5030. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5031. if (typeof config.target !== 'string') {
  5032. var id = $(config.target).attr('id');
  5033. if (!id) {
  5034. id = Util.getUID(NAME$8);
  5035. $(config.target).attr('id', id);
  5036. }
  5037. config.target = "#" + id;
  5038. }
  5039. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5040. return config;
  5041. };
  5042. _proto._getScrollTop = function _getScrollTop() {
  5043. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5044. };
  5045. _proto._getScrollHeight = function _getScrollHeight() {
  5046. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5047. };
  5048. _proto._getOffsetHeight = function _getOffsetHeight() {
  5049. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5050. };
  5051. _proto._process = function _process() {
  5052. var scrollTop = this._getScrollTop() + this._config.offset;
  5053. var scrollHeight = this._getScrollHeight();
  5054. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5055. if (this._scrollHeight !== scrollHeight) {
  5056. this.refresh();
  5057. }
  5058. if (scrollTop >= maxScroll) {
  5059. var target = this._targets[this._targets.length - 1];
  5060. if (this._activeTarget !== target) {
  5061. this._activate(target);
  5062. }
  5063. return;
  5064. }
  5065. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5066. this._activeTarget = null;
  5067. this._clear();
  5068. return;
  5069. }
  5070. var offsetLength = this._offsets.length;
  5071. for (var i = offsetLength; i--;) {
  5072. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5073. if (isActiveTarget) {
  5074. this._activate(this._targets[i]);
  5075. }
  5076. }
  5077. };
  5078. _proto._activate = function _activate(target) {
  5079. this._activeTarget = target;
  5080. this._clear();
  5081. var queries = this._selector.split(',').map(function (selector) {
  5082. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5083. });
  5084. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5085. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5086. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5087. $link.addClass(ClassName$8.ACTIVE);
  5088. } else {
  5089. // Set triggered link as active
  5090. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5091. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5092. $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
  5093. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5094. }
  5095. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5096. relatedTarget: target
  5097. });
  5098. };
  5099. _proto._clear = function _clear() {
  5100. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5101. return node.classList.contains(ClassName$8.ACTIVE);
  5102. }).forEach(function (node) {
  5103. return node.classList.remove(ClassName$8.ACTIVE);
  5104. });
  5105. } // Static
  5106. ;
  5107. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5108. return this.each(function () {
  5109. var data = $(this).data(DATA_KEY$8);
  5110. var _config = typeof config === 'object' && config;
  5111. if (!data) {
  5112. data = new ScrollSpy(this, _config);
  5113. $(this).data(DATA_KEY$8, data);
  5114. }
  5115. if (typeof config === 'string') {
  5116. if (typeof data[config] === 'undefined') {
  5117. throw new TypeError("No method named \"" + config + "\"");
  5118. }
  5119. data[config]();
  5120. }
  5121. });
  5122. };
  5123. _createClass(ScrollSpy, null, [{
  5124. key: "VERSION",
  5125. get: function get() {
  5126. return VERSION$8;
  5127. }
  5128. }, {
  5129. key: "Default",
  5130. get: function get() {
  5131. return Default$6;
  5132. }
  5133. }]);
  5134. return ScrollSpy;
  5135. }();
  5136. /**
  5137. * ------------------------------------------------------------------------
  5138. * Data Api implementation
  5139. * ------------------------------------------------------------------------
  5140. */
  5141. $(window).on(Event$8.LOAD_DATA_API, function () {
  5142. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5143. var scrollSpysLength = scrollSpys.length;
  5144. for (var i = scrollSpysLength; i--;) {
  5145. var $spy = $(scrollSpys[i]);
  5146. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5147. }
  5148. });
  5149. /**
  5150. * ------------------------------------------------------------------------
  5151. * jQuery
  5152. * ------------------------------------------------------------------------
  5153. */
  5154. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5155. $.fn[NAME$8].Constructor = ScrollSpy;
  5156. $.fn[NAME$8].noConflict = function () {
  5157. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5158. return ScrollSpy._jQueryInterface;
  5159. };
  5160. /**
  5161. * ------------------------------------------------------------------------
  5162. * Constants
  5163. * ------------------------------------------------------------------------
  5164. */
  5165. var NAME$9 = 'tab';
  5166. var VERSION$9 = '4.4.1';
  5167. var DATA_KEY$9 = 'bs.tab';
  5168. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5169. var DATA_API_KEY$7 = '.data-api';
  5170. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5171. var Event$9 = {
  5172. HIDE: "hide" + EVENT_KEY$9,
  5173. HIDDEN: "hidden" + EVENT_KEY$9,
  5174. SHOW: "show" + EVENT_KEY$9,
  5175. SHOWN: "shown" + EVENT_KEY$9,
  5176. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5177. };
  5178. var ClassName$9 = {
  5179. DROPDOWN_MENU: 'dropdown-menu',
  5180. ACTIVE: 'active',
  5181. DISABLED: 'disabled',
  5182. FADE: 'fade',
  5183. SHOW: 'show'
  5184. };
  5185. var Selector$9 = {
  5186. DROPDOWN: '.dropdown',
  5187. NAV_LIST_GROUP: '.nav, .list-group',
  5188. ACTIVE: '.active',
  5189. ACTIVE_UL: '> li > .active',
  5190. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5191. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5192. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5193. };
  5194. /**
  5195. * ------------------------------------------------------------------------
  5196. * Class Definition
  5197. * ------------------------------------------------------------------------
  5198. */
  5199. var Tab =
  5200. /*#__PURE__*/
  5201. function () {
  5202. function Tab(element) {
  5203. this._element = element;
  5204. } // Getters
  5205. var _proto = Tab.prototype;
  5206. // Public
  5207. _proto.show = function show() {
  5208. var _this = this;
  5209. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5210. return;
  5211. }
  5212. var target;
  5213. var previous;
  5214. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5215. var selector = Util.getSelectorFromElement(this._element);
  5216. if (listElement) {
  5217. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5218. previous = $.makeArray($(listElement).find(itemSelector));
  5219. previous = previous[previous.length - 1];
  5220. }
  5221. var hideEvent = $.Event(Event$9.HIDE, {
  5222. relatedTarget: this._element
  5223. });
  5224. var showEvent = $.Event(Event$9.SHOW, {
  5225. relatedTarget: previous
  5226. });
  5227. if (previous) {
  5228. $(previous).trigger(hideEvent);
  5229. }
  5230. $(this._element).trigger(showEvent);
  5231. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5232. return;
  5233. }
  5234. if (selector) {
  5235. target = document.querySelector(selector);
  5236. }
  5237. this._activate(this._element, listElement);
  5238. var complete = function complete() {
  5239. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5240. relatedTarget: _this._element
  5241. });
  5242. var shownEvent = $.Event(Event$9.SHOWN, {
  5243. relatedTarget: previous
  5244. });
  5245. $(previous).trigger(hiddenEvent);
  5246. $(_this._element).trigger(shownEvent);
  5247. };
  5248. if (target) {
  5249. this._activate(target, target.parentNode, complete);
  5250. } else {
  5251. complete();
  5252. }
  5253. };
  5254. _proto.dispose = function dispose() {
  5255. $.removeData(this._element, DATA_KEY$9);
  5256. this._element = null;
  5257. } // Private
  5258. ;
  5259. _proto._activate = function _activate(element, container, callback) {
  5260. var _this2 = this;
  5261. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5262. var active = activeElements[0];
  5263. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5264. var complete = function complete() {
  5265. return _this2._transitionComplete(element, active, callback);
  5266. };
  5267. if (active && isTransitioning) {
  5268. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5269. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5270. } else {
  5271. complete();
  5272. }
  5273. };
  5274. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5275. if (active) {
  5276. $(active).removeClass(ClassName$9.ACTIVE);
  5277. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5278. if (dropdownChild) {
  5279. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5280. }
  5281. if (active.getAttribute('role') === 'tab') {
  5282. active.setAttribute('aria-selected', false);
  5283. }
  5284. }
  5285. $(element).addClass(ClassName$9.ACTIVE);
  5286. if (element.getAttribute('role') === 'tab') {
  5287. element.setAttribute('aria-selected', true);
  5288. }
  5289. Util.reflow(element);
  5290. if (element.classList.contains(ClassName$9.FADE)) {
  5291. element.classList.add(ClassName$9.SHOW);
  5292. }
  5293. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5294. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5295. if (dropdownElement) {
  5296. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5297. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5298. }
  5299. element.setAttribute('aria-expanded', true);
  5300. }
  5301. if (callback) {
  5302. callback();
  5303. }
  5304. } // Static
  5305. ;
  5306. Tab._jQueryInterface = function _jQueryInterface(config) {
  5307. return this.each(function () {
  5308. var $this = $(this);
  5309. var data = $this.data(DATA_KEY$9);
  5310. if (!data) {
  5311. data = new Tab(this);
  5312. $this.data(DATA_KEY$9, data);
  5313. }
  5314. if (typeof config === 'string') {
  5315. if (typeof data[config] === 'undefined') {
  5316. throw new TypeError("No method named \"" + config + "\"");
  5317. }
  5318. data[config]();
  5319. }
  5320. });
  5321. };
  5322. _createClass(Tab, null, [{
  5323. key: "VERSION",
  5324. get: function get() {
  5325. return VERSION$9;
  5326. }
  5327. }]);
  5328. return Tab;
  5329. }();
  5330. /**
  5331. * ------------------------------------------------------------------------
  5332. * Data Api implementation
  5333. * ------------------------------------------------------------------------
  5334. */
  5335. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5336. event.preventDefault();
  5337. Tab._jQueryInterface.call($(this), 'show');
  5338. });
  5339. /**
  5340. * ------------------------------------------------------------------------
  5341. * jQuery
  5342. * ------------------------------------------------------------------------
  5343. */
  5344. $.fn[NAME$9] = Tab._jQueryInterface;
  5345. $.fn[NAME$9].Constructor = Tab;
  5346. $.fn[NAME$9].noConflict = function () {
  5347. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5348. return Tab._jQueryInterface;
  5349. };
  5350. /**
  5351. * ------------------------------------------------------------------------
  5352. * Constants
  5353. * ------------------------------------------------------------------------
  5354. */
  5355. var NAME$a = 'toast';
  5356. var VERSION$a = '4.4.1';
  5357. var DATA_KEY$a = 'bs.toast';
  5358. var EVENT_KEY$a = "." + DATA_KEY$a;
  5359. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5360. var Event$a = {
  5361. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5362. HIDE: "hide" + EVENT_KEY$a,
  5363. HIDDEN: "hidden" + EVENT_KEY$a,
  5364. SHOW: "show" + EVENT_KEY$a,
  5365. SHOWN: "shown" + EVENT_KEY$a
  5366. };
  5367. var ClassName$a = {
  5368. FADE: 'fade',
  5369. HIDE: 'hide',
  5370. SHOW: 'show',
  5371. SHOWING: 'showing'
  5372. };
  5373. var DefaultType$7 = {
  5374. animation: 'boolean',
  5375. autohide: 'boolean',
  5376. delay: 'number'
  5377. };
  5378. var Default$7 = {
  5379. animation: true,
  5380. autohide: true,
  5381. delay: 500
  5382. };
  5383. var Selector$a = {
  5384. DATA_DISMISS: '[data-dismiss="toast"]'
  5385. };
  5386. /**
  5387. * ------------------------------------------------------------------------
  5388. * Class Definition
  5389. * ------------------------------------------------------------------------
  5390. */
  5391. var Toast =
  5392. /*#__PURE__*/
  5393. function () {
  5394. function Toast(element, config) {
  5395. this._element = element;
  5396. this._config = this._getConfig(config);
  5397. this._timeout = null;
  5398. this._setListeners();
  5399. } // Getters
  5400. var _proto = Toast.prototype;
  5401. // Public
  5402. _proto.show = function show() {
  5403. var _this = this;
  5404. var showEvent = $.Event(Event$a.SHOW);
  5405. $(this._element).trigger(showEvent);
  5406. if (showEvent.isDefaultPrevented()) {
  5407. return;
  5408. }
  5409. if (this._config.animation) {
  5410. this._element.classList.add(ClassName$a.FADE);
  5411. }
  5412. var complete = function complete() {
  5413. _this._element.classList.remove(ClassName$a.SHOWING);
  5414. _this._element.classList.add(ClassName$a.SHOW);
  5415. $(_this._element).trigger(Event$a.SHOWN);
  5416. if (_this._config.autohide) {
  5417. _this._timeout = setTimeout(function () {
  5418. _this.hide();
  5419. }, _this._config.delay);
  5420. }
  5421. };
  5422. this._element.classList.remove(ClassName$a.HIDE);
  5423. Util.reflow(this._element);
  5424. this._element.classList.add(ClassName$a.SHOWING);
  5425. if (this._config.animation) {
  5426. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5427. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5428. } else {
  5429. complete();
  5430. }
  5431. };
  5432. _proto.hide = function hide() {
  5433. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5434. return;
  5435. }
  5436. var hideEvent = $.Event(Event$a.HIDE);
  5437. $(this._element).trigger(hideEvent);
  5438. if (hideEvent.isDefaultPrevented()) {
  5439. return;
  5440. }
  5441. this._close();
  5442. };
  5443. _proto.dispose = function dispose() {
  5444. clearTimeout(this._timeout);
  5445. this._timeout = null;
  5446. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5447. this._element.classList.remove(ClassName$a.SHOW);
  5448. }
  5449. $(this._element).off(Event$a.CLICK_DISMISS);
  5450. $.removeData(this._element, DATA_KEY$a);
  5451. this._element = null;
  5452. this._config = null;
  5453. } // Private
  5454. ;
  5455. _proto._getConfig = function _getConfig(config) {
  5456. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5457. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5458. return config;
  5459. };
  5460. _proto._setListeners = function _setListeners() {
  5461. var _this2 = this;
  5462. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5463. return _this2.hide();
  5464. });
  5465. };
  5466. _proto._close = function _close() {
  5467. var _this3 = this;
  5468. var complete = function complete() {
  5469. _this3._element.classList.add(ClassName$a.HIDE);
  5470. $(_this3._element).trigger(Event$a.HIDDEN);
  5471. };
  5472. this._element.classList.remove(ClassName$a.SHOW);
  5473. if (this._config.animation) {
  5474. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5475. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5476. } else {
  5477. complete();
  5478. }
  5479. } // Static
  5480. ;
  5481. Toast._jQueryInterface = function _jQueryInterface(config) {
  5482. return this.each(function () {
  5483. var $element = $(this);
  5484. var data = $element.data(DATA_KEY$a);
  5485. var _config = typeof config === 'object' && config;
  5486. if (!data) {
  5487. data = new Toast(this, _config);
  5488. $element.data(DATA_KEY$a, data);
  5489. }
  5490. if (typeof config === 'string') {
  5491. if (typeof data[config] === 'undefined') {
  5492. throw new TypeError("No method named \"" + config + "\"");
  5493. }
  5494. data[config](this);
  5495. }
  5496. });
  5497. };
  5498. _createClass(Toast, null, [{
  5499. key: "VERSION",
  5500. get: function get() {
  5501. return VERSION$a;
  5502. }
  5503. }, {
  5504. key: "DefaultType",
  5505. get: function get() {
  5506. return DefaultType$7;
  5507. }
  5508. }, {
  5509. key: "Default",
  5510. get: function get() {
  5511. return Default$7;
  5512. }
  5513. }]);
  5514. return Toast;
  5515. }();
  5516. /**
  5517. * ------------------------------------------------------------------------
  5518. * jQuery
  5519. * ------------------------------------------------------------------------
  5520. */
  5521. $.fn[NAME$a] = Toast._jQueryInterface;
  5522. $.fn[NAME$a].Constructor = Toast;
  5523. $.fn[NAME$a].noConflict = function () {
  5524. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5525. return Toast._jQueryInterface;
  5526. };
  5527. exports.Alert = Alert;
  5528. exports.Button = Button;
  5529. exports.Carousel = Carousel;
  5530. exports.Collapse = Collapse;
  5531. exports.Dropdown = Dropdown;
  5532. exports.Modal = Modal;
  5533. exports.Popover = Popover;
  5534. exports.Scrollspy = ScrollSpy;
  5535. exports.Tab = Tab;
  5536. exports.Toast = Toast;
  5537. exports.Tooltip = Tooltip;
  5538. exports.Util = Util;
  5539. Object.defineProperty(exports, '__esModule', { value: true });
  5540. })));
  5541. //# sourceMappingURL=bootstrap.js.map
  5542. /***/ }),
  5543. /***/ "./node_modules/buffer/index.js":
  5544. /*!**************************************!*\
  5545. !*** ./node_modules/buffer/index.js ***!
  5546. \**************************************/
  5547. /*! no static exports found */
  5548. /***/ (function(module, exports, __webpack_require__) {
  5549. "use strict";
  5550. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5551. * The buffer module from node.js, for the browser.
  5552. *
  5553. * @author Feross Aboukhadijeh <http://feross.org>
  5554. * @license MIT
  5555. */
  5556. /* eslint-disable no-proto */
  5557. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5558. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5559. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5560. exports.Buffer = Buffer
  5561. exports.SlowBuffer = SlowBuffer
  5562. exports.INSPECT_MAX_BYTES = 50
  5563. /**
  5564. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5565. * === true Use Uint8Array implementation (fastest)
  5566. * === false Use Object implementation (most compatible, even IE6)
  5567. *
  5568. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5569. * Opera 11.6+, iOS 4.2+.
  5570. *
  5571. * Due to various browser bugs, sometimes the Object implementation will be used even
  5572. * when the browser supports typed arrays.
  5573. *
  5574. * Note:
  5575. *
  5576. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5577. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5578. *
  5579. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5580. *
  5581. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5582. * incorrect length in some situations.
  5583. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5584. * get the Object implementation, which is slower but behaves correctly.
  5585. */
  5586. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5587. ? global.TYPED_ARRAY_SUPPORT
  5588. : typedArraySupport()
  5589. /*
  5590. * Export kMaxLength after typed array support is determined.
  5591. */
  5592. exports.kMaxLength = kMaxLength()
  5593. function typedArraySupport () {
  5594. try {
  5595. var arr = new Uint8Array(1)
  5596. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5597. return arr.foo() === 42 && // typed array instances can be augmented
  5598. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5599. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5600. } catch (e) {
  5601. return false
  5602. }
  5603. }
  5604. function kMaxLength () {
  5605. return Buffer.TYPED_ARRAY_SUPPORT
  5606. ? 0x7fffffff
  5607. : 0x3fffffff
  5608. }
  5609. function createBuffer (that, length) {
  5610. if (kMaxLength() < length) {
  5611. throw new RangeError('Invalid typed array length')
  5612. }
  5613. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5614. // Return an augmented `Uint8Array` instance, for best performance
  5615. that = new Uint8Array(length)
  5616. that.__proto__ = Buffer.prototype
  5617. } else {
  5618. // Fallback: Return an object instance of the Buffer class
  5619. if (that === null) {
  5620. that = new Buffer(length)
  5621. }
  5622. that.length = length
  5623. }
  5624. return that
  5625. }
  5626. /**
  5627. * The Buffer constructor returns instances of `Uint8Array` that have their
  5628. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5629. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5630. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5631. * returns a single octet.
  5632. *
  5633. * The `Uint8Array` prototype remains unmodified.
  5634. */
  5635. function Buffer (arg, encodingOrOffset, length) {
  5636. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5637. return new Buffer(arg, encodingOrOffset, length)
  5638. }
  5639. // Common case.
  5640. if (typeof arg === 'number') {
  5641. if (typeof encodingOrOffset === 'string') {
  5642. throw new Error(
  5643. 'If encoding is specified then the first argument must be a string'
  5644. )
  5645. }
  5646. return allocUnsafe(this, arg)
  5647. }
  5648. return from(this, arg, encodingOrOffset, length)
  5649. }
  5650. Buffer.poolSize = 8192 // not used by this implementation
  5651. // TODO: Legacy, not needed anymore. Remove in next major version.
  5652. Buffer._augment = function (arr) {
  5653. arr.__proto__ = Buffer.prototype
  5654. return arr
  5655. }
  5656. function from (that, value, encodingOrOffset, length) {
  5657. if (typeof value === 'number') {
  5658. throw new TypeError('"value" argument must not be a number')
  5659. }
  5660. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5661. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5662. }
  5663. if (typeof value === 'string') {
  5664. return fromString(that, value, encodingOrOffset)
  5665. }
  5666. return fromObject(that, value)
  5667. }
  5668. /**
  5669. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5670. * if value is a number.
  5671. * Buffer.from(str[, encoding])
  5672. * Buffer.from(array)
  5673. * Buffer.from(buffer)
  5674. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5675. **/
  5676. Buffer.from = function (value, encodingOrOffset, length) {
  5677. return from(null, value, encodingOrOffset, length)
  5678. }
  5679. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5680. Buffer.prototype.__proto__ = Uint8Array.prototype
  5681. Buffer.__proto__ = Uint8Array
  5682. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5683. Buffer[Symbol.species] === Buffer) {
  5684. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5685. Object.defineProperty(Buffer, Symbol.species, {
  5686. value: null,
  5687. configurable: true
  5688. })
  5689. }
  5690. }
  5691. function assertSize (size) {
  5692. if (typeof size !== 'number') {
  5693. throw new TypeError('"size" argument must be a number')
  5694. } else if (size < 0) {
  5695. throw new RangeError('"size" argument must not be negative')
  5696. }
  5697. }
  5698. function alloc (that, size, fill, encoding) {
  5699. assertSize(size)
  5700. if (size <= 0) {
  5701. return createBuffer(that, size)
  5702. }
  5703. if (fill !== undefined) {
  5704. // Only pay attention to encoding if it's a string. This
  5705. // prevents accidentally sending in a number that would
  5706. // be interpretted as a start offset.
  5707. return typeof encoding === 'string'
  5708. ? createBuffer(that, size).fill(fill, encoding)
  5709. : createBuffer(that, size).fill(fill)
  5710. }
  5711. return createBuffer(that, size)
  5712. }
  5713. /**
  5714. * Creates a new filled Buffer instance.
  5715. * alloc(size[, fill[, encoding]])
  5716. **/
  5717. Buffer.alloc = function (size, fill, encoding) {
  5718. return alloc(null, size, fill, encoding)
  5719. }
  5720. function allocUnsafe (that, size) {
  5721. assertSize(size)
  5722. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5723. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5724. for (var i = 0; i < size; ++i) {
  5725. that[i] = 0
  5726. }
  5727. }
  5728. return that
  5729. }
  5730. /**
  5731. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  5732. * */
  5733. Buffer.allocUnsafe = function (size) {
  5734. return allocUnsafe(null, size)
  5735. }
  5736. /**
  5737. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  5738. */
  5739. Buffer.allocUnsafeSlow = function (size) {
  5740. return allocUnsafe(null, size)
  5741. }
  5742. function fromString (that, string, encoding) {
  5743. if (typeof encoding !== 'string' || encoding === '') {
  5744. encoding = 'utf8'
  5745. }
  5746. if (!Buffer.isEncoding(encoding)) {
  5747. throw new TypeError('"encoding" must be a valid string encoding')
  5748. }
  5749. var length = byteLength(string, encoding) | 0
  5750. that = createBuffer(that, length)
  5751. var actual = that.write(string, encoding)
  5752. if (actual !== length) {
  5753. // Writing a hex string, for example, that contains invalid characters will
  5754. // cause everything after the first invalid character to be ignored. (e.g.
  5755. // 'abxxcd' will be treated as 'ab')
  5756. that = that.slice(0, actual)
  5757. }
  5758. return that
  5759. }
  5760. function fromArrayLike (that, array) {
  5761. var length = array.length < 0 ? 0 : checked(array.length) | 0
  5762. that = createBuffer(that, length)
  5763. for (var i = 0; i < length; i += 1) {
  5764. that[i] = array[i] & 255
  5765. }
  5766. return that
  5767. }
  5768. function fromArrayBuffer (that, array, byteOffset, length) {
  5769. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  5770. if (byteOffset < 0 || array.byteLength < byteOffset) {
  5771. throw new RangeError('\'offset\' is out of bounds')
  5772. }
  5773. if (array.byteLength < byteOffset + (length || 0)) {
  5774. throw new RangeError('\'length\' is out of bounds')
  5775. }
  5776. if (byteOffset === undefined && length === undefined) {
  5777. array = new Uint8Array(array)
  5778. } else if (length === undefined) {
  5779. array = new Uint8Array(array, byteOffset)
  5780. } else {
  5781. array = new Uint8Array(array, byteOffset, length)
  5782. }
  5783. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5784. // Return an augmented `Uint8Array` instance, for best performance
  5785. that = array
  5786. that.__proto__ = Buffer.prototype
  5787. } else {
  5788. // Fallback: Return an object instance of the Buffer class
  5789. that = fromArrayLike(that, array)
  5790. }
  5791. return that
  5792. }
  5793. function fromObject (that, obj) {
  5794. if (Buffer.isBuffer(obj)) {
  5795. var len = checked(obj.length) | 0
  5796. that = createBuffer(that, len)
  5797. if (that.length === 0) {
  5798. return that
  5799. }
  5800. obj.copy(that, 0, 0, len)
  5801. return that
  5802. }
  5803. if (obj) {
  5804. if ((typeof ArrayBuffer !== 'undefined' &&
  5805. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  5806. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  5807. return createBuffer(that, 0)
  5808. }
  5809. return fromArrayLike(that, obj)
  5810. }
  5811. if (obj.type === 'Buffer' && isArray(obj.data)) {
  5812. return fromArrayLike(that, obj.data)
  5813. }
  5814. }
  5815. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  5816. }
  5817. function checked (length) {
  5818. // Note: cannot use `length < kMaxLength()` here because that fails when
  5819. // length is NaN (which is otherwise coerced to zero.)
  5820. if (length >= kMaxLength()) {
  5821. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  5822. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  5823. }
  5824. return length | 0
  5825. }
  5826. function SlowBuffer (length) {
  5827. if (+length != length) { // eslint-disable-line eqeqeq
  5828. length = 0
  5829. }
  5830. return Buffer.alloc(+length)
  5831. }
  5832. Buffer.isBuffer = function isBuffer (b) {
  5833. return !!(b != null && b._isBuffer)
  5834. }
  5835. Buffer.compare = function compare (a, b) {
  5836. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  5837. throw new TypeError('Arguments must be Buffers')
  5838. }
  5839. if (a === b) return 0
  5840. var x = a.length
  5841. var y = b.length
  5842. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  5843. if (a[i] !== b[i]) {
  5844. x = a[i]
  5845. y = b[i]
  5846. break
  5847. }
  5848. }
  5849. if (x < y) return -1
  5850. if (y < x) return 1
  5851. return 0
  5852. }
  5853. Buffer.isEncoding = function isEncoding (encoding) {
  5854. switch (String(encoding).toLowerCase()) {
  5855. case 'hex':
  5856. case 'utf8':
  5857. case 'utf-8':
  5858. case 'ascii':
  5859. case 'latin1':
  5860. case 'binary':
  5861. case 'base64':
  5862. case 'ucs2':
  5863. case 'ucs-2':
  5864. case 'utf16le':
  5865. case 'utf-16le':
  5866. return true
  5867. default:
  5868. return false
  5869. }
  5870. }
  5871. Buffer.concat = function concat (list, length) {
  5872. if (!isArray(list)) {
  5873. throw new TypeError('"list" argument must be an Array of Buffers')
  5874. }
  5875. if (list.length === 0) {
  5876. return Buffer.alloc(0)
  5877. }
  5878. var i
  5879. if (length === undefined) {
  5880. length = 0
  5881. for (i = 0; i < list.length; ++i) {
  5882. length += list[i].length
  5883. }
  5884. }
  5885. var buffer = Buffer.allocUnsafe(length)
  5886. var pos = 0
  5887. for (i = 0; i < list.length; ++i) {
  5888. var buf = list[i]
  5889. if (!Buffer.isBuffer(buf)) {
  5890. throw new TypeError('"list" argument must be an Array of Buffers')
  5891. }
  5892. buf.copy(buffer, pos)
  5893. pos += buf.length
  5894. }
  5895. return buffer
  5896. }
  5897. function byteLength (string, encoding) {
  5898. if (Buffer.isBuffer(string)) {
  5899. return string.length
  5900. }
  5901. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  5902. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  5903. return string.byteLength
  5904. }
  5905. if (typeof string !== 'string') {
  5906. string = '' + string
  5907. }
  5908. var len = string.length
  5909. if (len === 0) return 0
  5910. // Use a for loop to avoid recursion
  5911. var loweredCase = false
  5912. for (;;) {
  5913. switch (encoding) {
  5914. case 'ascii':
  5915. case 'latin1':
  5916. case 'binary':
  5917. return len
  5918. case 'utf8':
  5919. case 'utf-8':
  5920. case undefined:
  5921. return utf8ToBytes(string).length
  5922. case 'ucs2':
  5923. case 'ucs-2':
  5924. case 'utf16le':
  5925. case 'utf-16le':
  5926. return len * 2
  5927. case 'hex':
  5928. return len >>> 1
  5929. case 'base64':
  5930. return base64ToBytes(string).length
  5931. default:
  5932. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  5933. encoding = ('' + encoding).toLowerCase()
  5934. loweredCase = true
  5935. }
  5936. }
  5937. }
  5938. Buffer.byteLength = byteLength
  5939. function slowToString (encoding, start, end) {
  5940. var loweredCase = false
  5941. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  5942. // property of a typed array.
  5943. // This behaves neither like String nor Uint8Array in that we set start/end
  5944. // to their upper/lower bounds if the value passed is out of range.
  5945. // undefined is handled specially as per ECMA-262 6th Edition,
  5946. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  5947. if (start === undefined || start < 0) {
  5948. start = 0
  5949. }
  5950. // Return early if start > this.length. Done here to prevent potential uint32
  5951. // coercion fail below.
  5952. if (start > this.length) {
  5953. return ''
  5954. }
  5955. if (end === undefined || end > this.length) {
  5956. end = this.length
  5957. }
  5958. if (end <= 0) {
  5959. return ''
  5960. }
  5961. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  5962. end >>>= 0
  5963. start >>>= 0
  5964. if (end <= start) {
  5965. return ''
  5966. }
  5967. if (!encoding) encoding = 'utf8'
  5968. while (true) {
  5969. switch (encoding) {
  5970. case 'hex':
  5971. return hexSlice(this, start, end)
  5972. case 'utf8':
  5973. case 'utf-8':
  5974. return utf8Slice(this, start, end)
  5975. case 'ascii':
  5976. return asciiSlice(this, start, end)
  5977. case 'latin1':
  5978. case 'binary':
  5979. return latin1Slice(this, start, end)
  5980. case 'base64':
  5981. return base64Slice(this, start, end)
  5982. case 'ucs2':
  5983. case 'ucs-2':
  5984. case 'utf16le':
  5985. case 'utf-16le':
  5986. return utf16leSlice(this, start, end)
  5987. default:
  5988. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  5989. encoding = (encoding + '').toLowerCase()
  5990. loweredCase = true
  5991. }
  5992. }
  5993. }
  5994. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  5995. // Buffer instances.
  5996. Buffer.prototype._isBuffer = true
  5997. function swap (b, n, m) {
  5998. var i = b[n]
  5999. b[n] = b[m]
  6000. b[m] = i
  6001. }
  6002. Buffer.prototype.swap16 = function swap16 () {
  6003. var len = this.length
  6004. if (len % 2 !== 0) {
  6005. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6006. }
  6007. for (var i = 0; i < len; i += 2) {
  6008. swap(this, i, i + 1)
  6009. }
  6010. return this
  6011. }
  6012. Buffer.prototype.swap32 = function swap32 () {
  6013. var len = this.length
  6014. if (len % 4 !== 0) {
  6015. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6016. }
  6017. for (var i = 0; i < len; i += 4) {
  6018. swap(this, i, i + 3)
  6019. swap(this, i + 1, i + 2)
  6020. }
  6021. return this
  6022. }
  6023. Buffer.prototype.swap64 = function swap64 () {
  6024. var len = this.length
  6025. if (len % 8 !== 0) {
  6026. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6027. }
  6028. for (var i = 0; i < len; i += 8) {
  6029. swap(this, i, i + 7)
  6030. swap(this, i + 1, i + 6)
  6031. swap(this, i + 2, i + 5)
  6032. swap(this, i + 3, i + 4)
  6033. }
  6034. return this
  6035. }
  6036. Buffer.prototype.toString = function toString () {
  6037. var length = this.length | 0
  6038. if (length === 0) return ''
  6039. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6040. return slowToString.apply(this, arguments)
  6041. }
  6042. Buffer.prototype.equals = function equals (b) {
  6043. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6044. if (this === b) return true
  6045. return Buffer.compare(this, b) === 0
  6046. }
  6047. Buffer.prototype.inspect = function inspect () {
  6048. var str = ''
  6049. var max = exports.INSPECT_MAX_BYTES
  6050. if (this.length > 0) {
  6051. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6052. if (this.length > max) str += ' ... '
  6053. }
  6054. return '<Buffer ' + str + '>'
  6055. }
  6056. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6057. if (!Buffer.isBuffer(target)) {
  6058. throw new TypeError('Argument must be a Buffer')
  6059. }
  6060. if (start === undefined) {
  6061. start = 0
  6062. }
  6063. if (end === undefined) {
  6064. end = target ? target.length : 0
  6065. }
  6066. if (thisStart === undefined) {
  6067. thisStart = 0
  6068. }
  6069. if (thisEnd === undefined) {
  6070. thisEnd = this.length
  6071. }
  6072. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6073. throw new RangeError('out of range index')
  6074. }
  6075. if (thisStart >= thisEnd && start >= end) {
  6076. return 0
  6077. }
  6078. if (thisStart >= thisEnd) {
  6079. return -1
  6080. }
  6081. if (start >= end) {
  6082. return 1
  6083. }
  6084. start >>>= 0
  6085. end >>>= 0
  6086. thisStart >>>= 0
  6087. thisEnd >>>= 0
  6088. if (this === target) return 0
  6089. var x = thisEnd - thisStart
  6090. var y = end - start
  6091. var len = Math.min(x, y)
  6092. var thisCopy = this.slice(thisStart, thisEnd)
  6093. var targetCopy = target.slice(start, end)
  6094. for (var i = 0; i < len; ++i) {
  6095. if (thisCopy[i] !== targetCopy[i]) {
  6096. x = thisCopy[i]
  6097. y = targetCopy[i]
  6098. break
  6099. }
  6100. }
  6101. if (x < y) return -1
  6102. if (y < x) return 1
  6103. return 0
  6104. }
  6105. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6106. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6107. //
  6108. // Arguments:
  6109. // - buffer - a Buffer to search
  6110. // - val - a string, Buffer, or number
  6111. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6112. // - encoding - an optional encoding, relevant is val is a string
  6113. // - dir - true for indexOf, false for lastIndexOf
  6114. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6115. // Empty buffer means no match
  6116. if (buffer.length === 0) return -1
  6117. // Normalize byteOffset
  6118. if (typeof byteOffset === 'string') {
  6119. encoding = byteOffset
  6120. byteOffset = 0
  6121. } else if (byteOffset > 0x7fffffff) {
  6122. byteOffset = 0x7fffffff
  6123. } else if (byteOffset < -0x80000000) {
  6124. byteOffset = -0x80000000
  6125. }
  6126. byteOffset = +byteOffset // Coerce to Number.
  6127. if (isNaN(byteOffset)) {
  6128. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6129. byteOffset = dir ? 0 : (buffer.length - 1)
  6130. }
  6131. // Normalize byteOffset: negative offsets start from the end of the buffer
  6132. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6133. if (byteOffset >= buffer.length) {
  6134. if (dir) return -1
  6135. else byteOffset = buffer.length - 1
  6136. } else if (byteOffset < 0) {
  6137. if (dir) byteOffset = 0
  6138. else return -1
  6139. }
  6140. // Normalize val
  6141. if (typeof val === 'string') {
  6142. val = Buffer.from(val, encoding)
  6143. }
  6144. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6145. if (Buffer.isBuffer(val)) {
  6146. // Special case: looking for empty string/buffer always fails
  6147. if (val.length === 0) {
  6148. return -1
  6149. }
  6150. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6151. } else if (typeof val === 'number') {
  6152. val = val & 0xFF // Search for a byte value [0-255]
  6153. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6154. typeof Uint8Array.prototype.indexOf === 'function') {
  6155. if (dir) {
  6156. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6157. } else {
  6158. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6159. }
  6160. }
  6161. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6162. }
  6163. throw new TypeError('val must be string, number or Buffer')
  6164. }
  6165. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6166. var indexSize = 1
  6167. var arrLength = arr.length
  6168. var valLength = val.length
  6169. if (encoding !== undefined) {
  6170. encoding = String(encoding).toLowerCase()
  6171. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6172. encoding === 'utf16le' || encoding === 'utf-16le') {
  6173. if (arr.length < 2 || val.length < 2) {
  6174. return -1
  6175. }
  6176. indexSize = 2
  6177. arrLength /= 2
  6178. valLength /= 2
  6179. byteOffset /= 2
  6180. }
  6181. }
  6182. function read (buf, i) {
  6183. if (indexSize === 1) {
  6184. return buf[i]
  6185. } else {
  6186. return buf.readUInt16BE(i * indexSize)
  6187. }
  6188. }
  6189. var i
  6190. if (dir) {
  6191. var foundIndex = -1
  6192. for (i = byteOffset; i < arrLength; i++) {
  6193. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6194. if (foundIndex === -1) foundIndex = i
  6195. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6196. } else {
  6197. if (foundIndex !== -1) i -= i - foundIndex
  6198. foundIndex = -1
  6199. }
  6200. }
  6201. } else {
  6202. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6203. for (i = byteOffset; i >= 0; i--) {
  6204. var found = true
  6205. for (var j = 0; j < valLength; j++) {
  6206. if (read(arr, i + j) !== read(val, j)) {
  6207. found = false
  6208. break
  6209. }
  6210. }
  6211. if (found) return i
  6212. }
  6213. }
  6214. return -1
  6215. }
  6216. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6217. return this.indexOf(val, byteOffset, encoding) !== -1
  6218. }
  6219. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6220. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6221. }
  6222. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6223. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6224. }
  6225. function hexWrite (buf, string, offset, length) {
  6226. offset = Number(offset) || 0
  6227. var remaining = buf.length - offset
  6228. if (!length) {
  6229. length = remaining
  6230. } else {
  6231. length = Number(length)
  6232. if (length > remaining) {
  6233. length = remaining
  6234. }
  6235. }
  6236. // must be an even number of digits
  6237. var strLen = string.length
  6238. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6239. if (length > strLen / 2) {
  6240. length = strLen / 2
  6241. }
  6242. for (var i = 0; i < length; ++i) {
  6243. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6244. if (isNaN(parsed)) return i
  6245. buf[offset + i] = parsed
  6246. }
  6247. return i
  6248. }
  6249. function utf8Write (buf, string, offset, length) {
  6250. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6251. }
  6252. function asciiWrite (buf, string, offset, length) {
  6253. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6254. }
  6255. function latin1Write (buf, string, offset, length) {
  6256. return asciiWrite(buf, string, offset, length)
  6257. }
  6258. function base64Write (buf, string, offset, length) {
  6259. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6260. }
  6261. function ucs2Write (buf, string, offset, length) {
  6262. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6263. }
  6264. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6265. // Buffer#write(string)
  6266. if (offset === undefined) {
  6267. encoding = 'utf8'
  6268. length = this.length
  6269. offset = 0
  6270. // Buffer#write(string, encoding)
  6271. } else if (length === undefined && typeof offset === 'string') {
  6272. encoding = offset
  6273. length = this.length
  6274. offset = 0
  6275. // Buffer#write(string, offset[, length][, encoding])
  6276. } else if (isFinite(offset)) {
  6277. offset = offset | 0
  6278. if (isFinite(length)) {
  6279. length = length | 0
  6280. if (encoding === undefined) encoding = 'utf8'
  6281. } else {
  6282. encoding = length
  6283. length = undefined
  6284. }
  6285. // legacy write(string, encoding, offset, length) - remove in v0.13
  6286. } else {
  6287. throw new Error(
  6288. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6289. )
  6290. }
  6291. var remaining = this.length - offset
  6292. if (length === undefined || length > remaining) length = remaining
  6293. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6294. throw new RangeError('Attempt to write outside buffer bounds')
  6295. }
  6296. if (!encoding) encoding = 'utf8'
  6297. var loweredCase = false
  6298. for (;;) {
  6299. switch (encoding) {
  6300. case 'hex':
  6301. return hexWrite(this, string, offset, length)
  6302. case 'utf8':
  6303. case 'utf-8':
  6304. return utf8Write(this, string, offset, length)
  6305. case 'ascii':
  6306. return asciiWrite(this, string, offset, length)
  6307. case 'latin1':
  6308. case 'binary':
  6309. return latin1Write(this, string, offset, length)
  6310. case 'base64':
  6311. // Warning: maxLength not taken into account in base64Write
  6312. return base64Write(this, string, offset, length)
  6313. case 'ucs2':
  6314. case 'ucs-2':
  6315. case 'utf16le':
  6316. case 'utf-16le':
  6317. return ucs2Write(this, string, offset, length)
  6318. default:
  6319. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6320. encoding = ('' + encoding).toLowerCase()
  6321. loweredCase = true
  6322. }
  6323. }
  6324. }
  6325. Buffer.prototype.toJSON = function toJSON () {
  6326. return {
  6327. type: 'Buffer',
  6328. data: Array.prototype.slice.call(this._arr || this, 0)
  6329. }
  6330. }
  6331. function base64Slice (buf, start, end) {
  6332. if (start === 0 && end === buf.length) {
  6333. return base64.fromByteArray(buf)
  6334. } else {
  6335. return base64.fromByteArray(buf.slice(start, end))
  6336. }
  6337. }
  6338. function utf8Slice (buf, start, end) {
  6339. end = Math.min(buf.length, end)
  6340. var res = []
  6341. var i = start
  6342. while (i < end) {
  6343. var firstByte = buf[i]
  6344. var codePoint = null
  6345. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6346. : (firstByte > 0xDF) ? 3
  6347. : (firstByte > 0xBF) ? 2
  6348. : 1
  6349. if (i + bytesPerSequence <= end) {
  6350. var secondByte, thirdByte, fourthByte, tempCodePoint
  6351. switch (bytesPerSequence) {
  6352. case 1:
  6353. if (firstByte < 0x80) {
  6354. codePoint = firstByte
  6355. }
  6356. break
  6357. case 2:
  6358. secondByte = buf[i + 1]
  6359. if ((secondByte & 0xC0) === 0x80) {
  6360. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6361. if (tempCodePoint > 0x7F) {
  6362. codePoint = tempCodePoint
  6363. }
  6364. }
  6365. break
  6366. case 3:
  6367. secondByte = buf[i + 1]
  6368. thirdByte = buf[i + 2]
  6369. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6370. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6371. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6372. codePoint = tempCodePoint
  6373. }
  6374. }
  6375. break
  6376. case 4:
  6377. secondByte = buf[i + 1]
  6378. thirdByte = buf[i + 2]
  6379. fourthByte = buf[i + 3]
  6380. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6381. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6382. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6383. codePoint = tempCodePoint
  6384. }
  6385. }
  6386. }
  6387. }
  6388. if (codePoint === null) {
  6389. // we did not generate a valid codePoint so insert a
  6390. // replacement char (U+FFFD) and advance only 1 byte
  6391. codePoint = 0xFFFD
  6392. bytesPerSequence = 1
  6393. } else if (codePoint > 0xFFFF) {
  6394. // encode to utf16 (surrogate pair dance)
  6395. codePoint -= 0x10000
  6396. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6397. codePoint = 0xDC00 | codePoint & 0x3FF
  6398. }
  6399. res.push(codePoint)
  6400. i += bytesPerSequence
  6401. }
  6402. return decodeCodePointsArray(res)
  6403. }
  6404. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6405. // the lowest limit is Chrome, with 0x10000 args.
  6406. // We go 1 magnitude less, for safety
  6407. var MAX_ARGUMENTS_LENGTH = 0x1000
  6408. function decodeCodePointsArray (codePoints) {
  6409. var len = codePoints.length
  6410. if (len <= MAX_ARGUMENTS_LENGTH) {
  6411. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6412. }
  6413. // Decode in chunks to avoid "call stack size exceeded".
  6414. var res = ''
  6415. var i = 0
  6416. while (i < len) {
  6417. res += String.fromCharCode.apply(
  6418. String,
  6419. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6420. )
  6421. }
  6422. return res
  6423. }
  6424. function asciiSlice (buf, start, end) {
  6425. var ret = ''
  6426. end = Math.min(buf.length, end)
  6427. for (var i = start; i < end; ++i) {
  6428. ret += String.fromCharCode(buf[i] & 0x7F)
  6429. }
  6430. return ret
  6431. }
  6432. function latin1Slice (buf, start, end) {
  6433. var ret = ''
  6434. end = Math.min(buf.length, end)
  6435. for (var i = start; i < end; ++i) {
  6436. ret += String.fromCharCode(buf[i])
  6437. }
  6438. return ret
  6439. }
  6440. function hexSlice (buf, start, end) {
  6441. var len = buf.length
  6442. if (!start || start < 0) start = 0
  6443. if (!end || end < 0 || end > len) end = len
  6444. var out = ''
  6445. for (var i = start; i < end; ++i) {
  6446. out += toHex(buf[i])
  6447. }
  6448. return out
  6449. }
  6450. function utf16leSlice (buf, start, end) {
  6451. var bytes = buf.slice(start, end)
  6452. var res = ''
  6453. for (var i = 0; i < bytes.length; i += 2) {
  6454. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6455. }
  6456. return res
  6457. }
  6458. Buffer.prototype.slice = function slice (start, end) {
  6459. var len = this.length
  6460. start = ~~start
  6461. end = end === undefined ? len : ~~end
  6462. if (start < 0) {
  6463. start += len
  6464. if (start < 0) start = 0
  6465. } else if (start > len) {
  6466. start = len
  6467. }
  6468. if (end < 0) {
  6469. end += len
  6470. if (end < 0) end = 0
  6471. } else if (end > len) {
  6472. end = len
  6473. }
  6474. if (end < start) end = start
  6475. var newBuf
  6476. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6477. newBuf = this.subarray(start, end)
  6478. newBuf.__proto__ = Buffer.prototype
  6479. } else {
  6480. var sliceLen = end - start
  6481. newBuf = new Buffer(sliceLen, undefined)
  6482. for (var i = 0; i < sliceLen; ++i) {
  6483. newBuf[i] = this[i + start]
  6484. }
  6485. }
  6486. return newBuf
  6487. }
  6488. /*
  6489. * Need to make sure that buffer isn't trying to write out of bounds.
  6490. */
  6491. function checkOffset (offset, ext, length) {
  6492. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6493. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6494. }
  6495. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6496. offset = offset | 0
  6497. byteLength = byteLength | 0
  6498. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6499. var val = this[offset]
  6500. var mul = 1
  6501. var i = 0
  6502. while (++i < byteLength && (mul *= 0x100)) {
  6503. val += this[offset + i] * mul
  6504. }
  6505. return val
  6506. }
  6507. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6508. offset = offset | 0
  6509. byteLength = byteLength | 0
  6510. if (!noAssert) {
  6511. checkOffset(offset, byteLength, this.length)
  6512. }
  6513. var val = this[offset + --byteLength]
  6514. var mul = 1
  6515. while (byteLength > 0 && (mul *= 0x100)) {
  6516. val += this[offset + --byteLength] * mul
  6517. }
  6518. return val
  6519. }
  6520. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6521. if (!noAssert) checkOffset(offset, 1, this.length)
  6522. return this[offset]
  6523. }
  6524. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6525. if (!noAssert) checkOffset(offset, 2, this.length)
  6526. return this[offset] | (this[offset + 1] << 8)
  6527. }
  6528. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6529. if (!noAssert) checkOffset(offset, 2, this.length)
  6530. return (this[offset] << 8) | this[offset + 1]
  6531. }
  6532. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6533. if (!noAssert) checkOffset(offset, 4, this.length)
  6534. return ((this[offset]) |
  6535. (this[offset + 1] << 8) |
  6536. (this[offset + 2] << 16)) +
  6537. (this[offset + 3] * 0x1000000)
  6538. }
  6539. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6540. if (!noAssert) checkOffset(offset, 4, this.length)
  6541. return (this[offset] * 0x1000000) +
  6542. ((this[offset + 1] << 16) |
  6543. (this[offset + 2] << 8) |
  6544. this[offset + 3])
  6545. }
  6546. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6547. offset = offset | 0
  6548. byteLength = byteLength | 0
  6549. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6550. var val = this[offset]
  6551. var mul = 1
  6552. var i = 0
  6553. while (++i < byteLength && (mul *= 0x100)) {
  6554. val += this[offset + i] * mul
  6555. }
  6556. mul *= 0x80
  6557. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6558. return val
  6559. }
  6560. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6561. offset = offset | 0
  6562. byteLength = byteLength | 0
  6563. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6564. var i = byteLength
  6565. var mul = 1
  6566. var val = this[offset + --i]
  6567. while (i > 0 && (mul *= 0x100)) {
  6568. val += this[offset + --i] * mul
  6569. }
  6570. mul *= 0x80
  6571. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6572. return val
  6573. }
  6574. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6575. if (!noAssert) checkOffset(offset, 1, this.length)
  6576. if (!(this[offset] & 0x80)) return (this[offset])
  6577. return ((0xff - this[offset] + 1) * -1)
  6578. }
  6579. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6580. if (!noAssert) checkOffset(offset, 2, this.length)
  6581. var val = this[offset] | (this[offset + 1] << 8)
  6582. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6583. }
  6584. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6585. if (!noAssert) checkOffset(offset, 2, this.length)
  6586. var val = this[offset + 1] | (this[offset] << 8)
  6587. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6588. }
  6589. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6590. if (!noAssert) checkOffset(offset, 4, this.length)
  6591. return (this[offset]) |
  6592. (this[offset + 1] << 8) |
  6593. (this[offset + 2] << 16) |
  6594. (this[offset + 3] << 24)
  6595. }
  6596. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6597. if (!noAssert) checkOffset(offset, 4, this.length)
  6598. return (this[offset] << 24) |
  6599. (this[offset + 1] << 16) |
  6600. (this[offset + 2] << 8) |
  6601. (this[offset + 3])
  6602. }
  6603. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6604. if (!noAssert) checkOffset(offset, 4, this.length)
  6605. return ieee754.read(this, offset, true, 23, 4)
  6606. }
  6607. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6608. if (!noAssert) checkOffset(offset, 4, this.length)
  6609. return ieee754.read(this, offset, false, 23, 4)
  6610. }
  6611. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6612. if (!noAssert) checkOffset(offset, 8, this.length)
  6613. return ieee754.read(this, offset, true, 52, 8)
  6614. }
  6615. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6616. if (!noAssert) checkOffset(offset, 8, this.length)
  6617. return ieee754.read(this, offset, false, 52, 8)
  6618. }
  6619. function checkInt (buf, value, offset, ext, max, min) {
  6620. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6621. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6622. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6623. }
  6624. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6625. value = +value
  6626. offset = offset | 0
  6627. byteLength = byteLength | 0
  6628. if (!noAssert) {
  6629. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6630. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6631. }
  6632. var mul = 1
  6633. var i = 0
  6634. this[offset] = value & 0xFF
  6635. while (++i < byteLength && (mul *= 0x100)) {
  6636. this[offset + i] = (value / mul) & 0xFF
  6637. }
  6638. return offset + byteLength
  6639. }
  6640. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6641. value = +value
  6642. offset = offset | 0
  6643. byteLength = byteLength | 0
  6644. if (!noAssert) {
  6645. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6646. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6647. }
  6648. var i = byteLength - 1
  6649. var mul = 1
  6650. this[offset + i] = value & 0xFF
  6651. while (--i >= 0 && (mul *= 0x100)) {
  6652. this[offset + i] = (value / mul) & 0xFF
  6653. }
  6654. return offset + byteLength
  6655. }
  6656. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6657. value = +value
  6658. offset = offset | 0
  6659. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6660. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6661. this[offset] = (value & 0xff)
  6662. return offset + 1
  6663. }
  6664. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6665. if (value < 0) value = 0xffff + value + 1
  6666. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6667. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6668. (littleEndian ? i : 1 - i) * 8
  6669. }
  6670. }
  6671. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6672. value = +value
  6673. offset = offset | 0
  6674. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6675. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6676. this[offset] = (value & 0xff)
  6677. this[offset + 1] = (value >>> 8)
  6678. } else {
  6679. objectWriteUInt16(this, value, offset, true)
  6680. }
  6681. return offset + 2
  6682. }
  6683. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6684. value = +value
  6685. offset = offset | 0
  6686. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6687. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6688. this[offset] = (value >>> 8)
  6689. this[offset + 1] = (value & 0xff)
  6690. } else {
  6691. objectWriteUInt16(this, value, offset, false)
  6692. }
  6693. return offset + 2
  6694. }
  6695. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6696. if (value < 0) value = 0xffffffff + value + 1
  6697. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6698. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6699. }
  6700. }
  6701. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6702. value = +value
  6703. offset = offset | 0
  6704. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6705. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6706. this[offset + 3] = (value >>> 24)
  6707. this[offset + 2] = (value >>> 16)
  6708. this[offset + 1] = (value >>> 8)
  6709. this[offset] = (value & 0xff)
  6710. } else {
  6711. objectWriteUInt32(this, value, offset, true)
  6712. }
  6713. return offset + 4
  6714. }
  6715. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6716. value = +value
  6717. offset = offset | 0
  6718. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6719. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6720. this[offset] = (value >>> 24)
  6721. this[offset + 1] = (value >>> 16)
  6722. this[offset + 2] = (value >>> 8)
  6723. this[offset + 3] = (value & 0xff)
  6724. } else {
  6725. objectWriteUInt32(this, value, offset, false)
  6726. }
  6727. return offset + 4
  6728. }
  6729. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  6730. value = +value
  6731. offset = offset | 0
  6732. if (!noAssert) {
  6733. var limit = Math.pow(2, 8 * byteLength - 1)
  6734. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6735. }
  6736. var i = 0
  6737. var mul = 1
  6738. var sub = 0
  6739. this[offset] = value & 0xFF
  6740. while (++i < byteLength && (mul *= 0x100)) {
  6741. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  6742. sub = 1
  6743. }
  6744. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6745. }
  6746. return offset + byteLength
  6747. }
  6748. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  6749. value = +value
  6750. offset = offset | 0
  6751. if (!noAssert) {
  6752. var limit = Math.pow(2, 8 * byteLength - 1)
  6753. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  6754. }
  6755. var i = byteLength - 1
  6756. var mul = 1
  6757. var sub = 0
  6758. this[offset + i] = value & 0xFF
  6759. while (--i >= 0 && (mul *= 0x100)) {
  6760. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  6761. sub = 1
  6762. }
  6763. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  6764. }
  6765. return offset + byteLength
  6766. }
  6767. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  6768. value = +value
  6769. offset = offset | 0
  6770. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  6771. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6772. if (value < 0) value = 0xff + value + 1
  6773. this[offset] = (value & 0xff)
  6774. return offset + 1
  6775. }
  6776. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  6777. value = +value
  6778. offset = offset | 0
  6779. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6780. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6781. this[offset] = (value & 0xff)
  6782. this[offset + 1] = (value >>> 8)
  6783. } else {
  6784. objectWriteUInt16(this, value, offset, true)
  6785. }
  6786. return offset + 2
  6787. }
  6788. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  6789. value = +value
  6790. offset = offset | 0
  6791. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  6792. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6793. this[offset] = (value >>> 8)
  6794. this[offset + 1] = (value & 0xff)
  6795. } else {
  6796. objectWriteUInt16(this, value, offset, false)
  6797. }
  6798. return offset + 2
  6799. }
  6800. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  6801. value = +value
  6802. offset = offset | 0
  6803. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6804. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6805. this[offset] = (value & 0xff)
  6806. this[offset + 1] = (value >>> 8)
  6807. this[offset + 2] = (value >>> 16)
  6808. this[offset + 3] = (value >>> 24)
  6809. } else {
  6810. objectWriteUInt32(this, value, offset, true)
  6811. }
  6812. return offset + 4
  6813. }
  6814. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  6815. value = +value
  6816. offset = offset | 0
  6817. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  6818. if (value < 0) value = 0xffffffff + value + 1
  6819. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6820. this[offset] = (value >>> 24)
  6821. this[offset + 1] = (value >>> 16)
  6822. this[offset + 2] = (value >>> 8)
  6823. this[offset + 3] = (value & 0xff)
  6824. } else {
  6825. objectWriteUInt32(this, value, offset, false)
  6826. }
  6827. return offset + 4
  6828. }
  6829. function checkIEEE754 (buf, value, offset, ext, max, min) {
  6830. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6831. if (offset < 0) throw new RangeError('Index out of range')
  6832. }
  6833. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  6834. if (!noAssert) {
  6835. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  6836. }
  6837. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  6838. return offset + 4
  6839. }
  6840. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  6841. return writeFloat(this, value, offset, true, noAssert)
  6842. }
  6843. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  6844. return writeFloat(this, value, offset, false, noAssert)
  6845. }
  6846. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  6847. if (!noAssert) {
  6848. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  6849. }
  6850. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  6851. return offset + 8
  6852. }
  6853. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  6854. return writeDouble(this, value, offset, true, noAssert)
  6855. }
  6856. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  6857. return writeDouble(this, value, offset, false, noAssert)
  6858. }
  6859. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  6860. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  6861. if (!start) start = 0
  6862. if (!end && end !== 0) end = this.length
  6863. if (targetStart >= target.length) targetStart = target.length
  6864. if (!targetStart) targetStart = 0
  6865. if (end > 0 && end < start) end = start
  6866. // Copy 0 bytes; we're done
  6867. if (end === start) return 0
  6868. if (target.length === 0 || this.length === 0) return 0
  6869. // Fatal error conditions
  6870. if (targetStart < 0) {
  6871. throw new RangeError('targetStart out of bounds')
  6872. }
  6873. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  6874. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  6875. // Are we oob?
  6876. if (end > this.length) end = this.length
  6877. if (target.length - targetStart < end - start) {
  6878. end = target.length - targetStart + start
  6879. }
  6880. var len = end - start
  6881. var i
  6882. if (this === target && start < targetStart && targetStart < end) {
  6883. // descending copy from end
  6884. for (i = len - 1; i >= 0; --i) {
  6885. target[i + targetStart] = this[i + start]
  6886. }
  6887. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  6888. // ascending copy from start
  6889. for (i = 0; i < len; ++i) {
  6890. target[i + targetStart] = this[i + start]
  6891. }
  6892. } else {
  6893. Uint8Array.prototype.set.call(
  6894. target,
  6895. this.subarray(start, start + len),
  6896. targetStart
  6897. )
  6898. }
  6899. return len
  6900. }
  6901. // Usage:
  6902. // buffer.fill(number[, offset[, end]])
  6903. // buffer.fill(buffer[, offset[, end]])
  6904. // buffer.fill(string[, offset[, end]][, encoding])
  6905. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  6906. // Handle string cases:
  6907. if (typeof val === 'string') {
  6908. if (typeof start === 'string') {
  6909. encoding = start
  6910. start = 0
  6911. end = this.length
  6912. } else if (typeof end === 'string') {
  6913. encoding = end
  6914. end = this.length
  6915. }
  6916. if (val.length === 1) {
  6917. var code = val.charCodeAt(0)
  6918. if (code < 256) {
  6919. val = code
  6920. }
  6921. }
  6922. if (encoding !== undefined && typeof encoding !== 'string') {
  6923. throw new TypeError('encoding must be a string')
  6924. }
  6925. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  6926. throw new TypeError('Unknown encoding: ' + encoding)
  6927. }
  6928. } else if (typeof val === 'number') {
  6929. val = val & 255
  6930. }
  6931. // Invalid ranges are not set to a default, so can range check early.
  6932. if (start < 0 || this.length < start || this.length < end) {
  6933. throw new RangeError('Out of range index')
  6934. }
  6935. if (end <= start) {
  6936. return this
  6937. }
  6938. start = start >>> 0
  6939. end = end === undefined ? this.length : end >>> 0
  6940. if (!val) val = 0
  6941. var i
  6942. if (typeof val === 'number') {
  6943. for (i = start; i < end; ++i) {
  6944. this[i] = val
  6945. }
  6946. } else {
  6947. var bytes = Buffer.isBuffer(val)
  6948. ? val
  6949. : utf8ToBytes(new Buffer(val, encoding).toString())
  6950. var len = bytes.length
  6951. for (i = 0; i < end - start; ++i) {
  6952. this[i + start] = bytes[i % len]
  6953. }
  6954. }
  6955. return this
  6956. }
  6957. // HELPER FUNCTIONS
  6958. // ================
  6959. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  6960. function base64clean (str) {
  6961. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  6962. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  6963. // Node converts strings with length < 2 to ''
  6964. if (str.length < 2) return ''
  6965. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  6966. while (str.length % 4 !== 0) {
  6967. str = str + '='
  6968. }
  6969. return str
  6970. }
  6971. function stringtrim (str) {
  6972. if (str.trim) return str.trim()
  6973. return str.replace(/^\s+|\s+$/g, '')
  6974. }
  6975. function toHex (n) {
  6976. if (n < 16) return '0' + n.toString(16)
  6977. return n.toString(16)
  6978. }
  6979. function utf8ToBytes (string, units) {
  6980. units = units || Infinity
  6981. var codePoint
  6982. var length = string.length
  6983. var leadSurrogate = null
  6984. var bytes = []
  6985. for (var i = 0; i < length; ++i) {
  6986. codePoint = string.charCodeAt(i)
  6987. // is surrogate component
  6988. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  6989. // last char was a lead
  6990. if (!leadSurrogate) {
  6991. // no lead yet
  6992. if (codePoint > 0xDBFF) {
  6993. // unexpected trail
  6994. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  6995. continue
  6996. } else if (i + 1 === length) {
  6997. // unpaired lead
  6998. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  6999. continue
  7000. }
  7001. // valid lead
  7002. leadSurrogate = codePoint
  7003. continue
  7004. }
  7005. // 2 leads in a row
  7006. if (codePoint < 0xDC00) {
  7007. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7008. leadSurrogate = codePoint
  7009. continue
  7010. }
  7011. // valid surrogate pair
  7012. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7013. } else if (leadSurrogate) {
  7014. // valid bmp char, but last char was a lead
  7015. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7016. }
  7017. leadSurrogate = null
  7018. // encode utf8
  7019. if (codePoint < 0x80) {
  7020. if ((units -= 1) < 0) break
  7021. bytes.push(codePoint)
  7022. } else if (codePoint < 0x800) {
  7023. if ((units -= 2) < 0) break
  7024. bytes.push(
  7025. codePoint >> 0x6 | 0xC0,
  7026. codePoint & 0x3F | 0x80
  7027. )
  7028. } else if (codePoint < 0x10000) {
  7029. if ((units -= 3) < 0) break
  7030. bytes.push(
  7031. codePoint >> 0xC | 0xE0,
  7032. codePoint >> 0x6 & 0x3F | 0x80,
  7033. codePoint & 0x3F | 0x80
  7034. )
  7035. } else if (codePoint < 0x110000) {
  7036. if ((units -= 4) < 0) break
  7037. bytes.push(
  7038. codePoint >> 0x12 | 0xF0,
  7039. codePoint >> 0xC & 0x3F | 0x80,
  7040. codePoint >> 0x6 & 0x3F | 0x80,
  7041. codePoint & 0x3F | 0x80
  7042. )
  7043. } else {
  7044. throw new Error('Invalid code point')
  7045. }
  7046. }
  7047. return bytes
  7048. }
  7049. function asciiToBytes (str) {
  7050. var byteArray = []
  7051. for (var i = 0; i < str.length; ++i) {
  7052. // Node's code seems to be doing this and not & 0x7F..
  7053. byteArray.push(str.charCodeAt(i) & 0xFF)
  7054. }
  7055. return byteArray
  7056. }
  7057. function utf16leToBytes (str, units) {
  7058. var c, hi, lo
  7059. var byteArray = []
  7060. for (var i = 0; i < str.length; ++i) {
  7061. if ((units -= 2) < 0) break
  7062. c = str.charCodeAt(i)
  7063. hi = c >> 8
  7064. lo = c % 256
  7065. byteArray.push(lo)
  7066. byteArray.push(hi)
  7067. }
  7068. return byteArray
  7069. }
  7070. function base64ToBytes (str) {
  7071. return base64.toByteArray(base64clean(str))
  7072. }
  7073. function blitBuffer (src, dst, offset, length) {
  7074. for (var i = 0; i < length; ++i) {
  7075. if ((i + offset >= dst.length) || (i >= src.length)) break
  7076. dst[i + offset] = src[i]
  7077. }
  7078. return i
  7079. }
  7080. function isnan (val) {
  7081. return val !== val // eslint-disable-line no-self-compare
  7082. }
  7083. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7084. /***/ }),
  7085. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7086. /*!**************************************************!*\
  7087. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7088. \**************************************************/
  7089. /*! no static exports found */
  7090. /***/ (function(module, exports, __webpack_require__) {
  7091. /*!
  7092. * clipboard.js v2.0.4
  7093. * https://zenorocha.github.io/clipboard.js
  7094. *
  7095. * Licensed MIT © Zeno Rocha
  7096. */
  7097. (function webpackUniversalModuleDefinition(root, factory) {
  7098. if(true)
  7099. module.exports = factory();
  7100. else {}
  7101. })(this, function() {
  7102. return /******/ (function(modules) { // webpackBootstrap
  7103. /******/ // The module cache
  7104. /******/ var installedModules = {};
  7105. /******/
  7106. /******/ // The require function
  7107. /******/ function __webpack_require__(moduleId) {
  7108. /******/
  7109. /******/ // Check if module is in cache
  7110. /******/ if(installedModules[moduleId]) {
  7111. /******/ return installedModules[moduleId].exports;
  7112. /******/ }
  7113. /******/ // Create a new module (and put it into the cache)
  7114. /******/ var module = installedModules[moduleId] = {
  7115. /******/ i: moduleId,
  7116. /******/ l: false,
  7117. /******/ exports: {}
  7118. /******/ };
  7119. /******/
  7120. /******/ // Execute the module function
  7121. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7122. /******/
  7123. /******/ // Flag the module as loaded
  7124. /******/ module.l = true;
  7125. /******/
  7126. /******/ // Return the exports of the module
  7127. /******/ return module.exports;
  7128. /******/ }
  7129. /******/
  7130. /******/
  7131. /******/ // expose the modules object (__webpack_modules__)
  7132. /******/ __webpack_require__.m = modules;
  7133. /******/
  7134. /******/ // expose the module cache
  7135. /******/ __webpack_require__.c = installedModules;
  7136. /******/
  7137. /******/ // define getter function for harmony exports
  7138. /******/ __webpack_require__.d = function(exports, name, getter) {
  7139. /******/ if(!__webpack_require__.o(exports, name)) {
  7140. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7141. /******/ }
  7142. /******/ };
  7143. /******/
  7144. /******/ // define __esModule on exports
  7145. /******/ __webpack_require__.r = function(exports) {
  7146. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7147. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7148. /******/ }
  7149. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7150. /******/ };
  7151. /******/
  7152. /******/ // create a fake namespace object
  7153. /******/ // mode & 1: value is a module id, require it
  7154. /******/ // mode & 2: merge all properties of value into the ns
  7155. /******/ // mode & 4: return value when already ns object
  7156. /******/ // mode & 8|1: behave like require
  7157. /******/ __webpack_require__.t = function(value, mode) {
  7158. /******/ if(mode & 1) value = __webpack_require__(value);
  7159. /******/ if(mode & 8) return value;
  7160. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7161. /******/ var ns = Object.create(null);
  7162. /******/ __webpack_require__.r(ns);
  7163. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7164. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7165. /******/ return ns;
  7166. /******/ };
  7167. /******/
  7168. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7169. /******/ __webpack_require__.n = function(module) {
  7170. /******/ var getter = module && module.__esModule ?
  7171. /******/ function getDefault() { return module['default']; } :
  7172. /******/ function getModuleExports() { return module; };
  7173. /******/ __webpack_require__.d(getter, 'a', getter);
  7174. /******/ return getter;
  7175. /******/ };
  7176. /******/
  7177. /******/ // Object.prototype.hasOwnProperty.call
  7178. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7179. /******/
  7180. /******/ // __webpack_public_path__
  7181. /******/ __webpack_require__.p = "";
  7182. /******/
  7183. /******/
  7184. /******/ // Load entry module and return exports
  7185. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7186. /******/ })
  7187. /************************************************************************/
  7188. /******/ ([
  7189. /* 0 */
  7190. /***/ (function(module, exports, __webpack_require__) {
  7191. "use strict";
  7192. 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; };
  7193. 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; }; }();
  7194. var _clipboardAction = __webpack_require__(1);
  7195. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7196. var _tinyEmitter = __webpack_require__(3);
  7197. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7198. var _goodListener = __webpack_require__(4);
  7199. var _goodListener2 = _interopRequireDefault(_goodListener);
  7200. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7201. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7202. 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; }
  7203. 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; }
  7204. /**
  7205. * Base class which takes one or more elements, adds event listeners to them,
  7206. * and instantiates a new `ClipboardAction` on each click.
  7207. */
  7208. var Clipboard = function (_Emitter) {
  7209. _inherits(Clipboard, _Emitter);
  7210. /**
  7211. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7212. * @param {Object} options
  7213. */
  7214. function Clipboard(trigger, options) {
  7215. _classCallCheck(this, Clipboard);
  7216. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7217. _this.resolveOptions(options);
  7218. _this.listenClick(trigger);
  7219. return _this;
  7220. }
  7221. /**
  7222. * Defines if attributes would be resolved using internal setter functions
  7223. * or custom functions that were passed in the constructor.
  7224. * @param {Object} options
  7225. */
  7226. _createClass(Clipboard, [{
  7227. key: 'resolveOptions',
  7228. value: function resolveOptions() {
  7229. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7230. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7231. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7232. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7233. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7234. }
  7235. /**
  7236. * Adds a click event listener to the passed trigger.
  7237. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7238. */
  7239. }, {
  7240. key: 'listenClick',
  7241. value: function listenClick(trigger) {
  7242. var _this2 = this;
  7243. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7244. return _this2.onClick(e);
  7245. });
  7246. }
  7247. /**
  7248. * Defines a new `ClipboardAction` on each click event.
  7249. * @param {Event} e
  7250. */
  7251. }, {
  7252. key: 'onClick',
  7253. value: function onClick(e) {
  7254. var trigger = e.delegateTarget || e.currentTarget;
  7255. if (this.clipboardAction) {
  7256. this.clipboardAction = null;
  7257. }
  7258. this.clipboardAction = new _clipboardAction2.default({
  7259. action: this.action(trigger),
  7260. target: this.target(trigger),
  7261. text: this.text(trigger),
  7262. container: this.container,
  7263. trigger: trigger,
  7264. emitter: this
  7265. });
  7266. }
  7267. /**
  7268. * Default `action` lookup function.
  7269. * @param {Element} trigger
  7270. */
  7271. }, {
  7272. key: 'defaultAction',
  7273. value: function defaultAction(trigger) {
  7274. return getAttributeValue('action', trigger);
  7275. }
  7276. /**
  7277. * Default `target` lookup function.
  7278. * @param {Element} trigger
  7279. */
  7280. }, {
  7281. key: 'defaultTarget',
  7282. value: function defaultTarget(trigger) {
  7283. var selector = getAttributeValue('target', trigger);
  7284. if (selector) {
  7285. return document.querySelector(selector);
  7286. }
  7287. }
  7288. /**
  7289. * Returns the support of the given action, or all actions if no action is
  7290. * given.
  7291. * @param {String} [action]
  7292. */
  7293. }, {
  7294. key: 'defaultText',
  7295. /**
  7296. * Default `text` lookup function.
  7297. * @param {Element} trigger
  7298. */
  7299. value: function defaultText(trigger) {
  7300. return getAttributeValue('text', trigger);
  7301. }
  7302. /**
  7303. * Destroy lifecycle.
  7304. */
  7305. }, {
  7306. key: 'destroy',
  7307. value: function destroy() {
  7308. this.listener.destroy();
  7309. if (this.clipboardAction) {
  7310. this.clipboardAction.destroy();
  7311. this.clipboardAction = null;
  7312. }
  7313. }
  7314. }], [{
  7315. key: 'isSupported',
  7316. value: function isSupported() {
  7317. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7318. var actions = typeof action === 'string' ? [action] : action;
  7319. var support = !!document.queryCommandSupported;
  7320. actions.forEach(function (action) {
  7321. support = support && !!document.queryCommandSupported(action);
  7322. });
  7323. return support;
  7324. }
  7325. }]);
  7326. return Clipboard;
  7327. }(_tinyEmitter2.default);
  7328. /**
  7329. * Helper function to retrieve attribute value.
  7330. * @param {String} suffix
  7331. * @param {Element} element
  7332. */
  7333. function getAttributeValue(suffix, element) {
  7334. var attribute = 'data-clipboard-' + suffix;
  7335. if (!element.hasAttribute(attribute)) {
  7336. return;
  7337. }
  7338. return element.getAttribute(attribute);
  7339. }
  7340. module.exports = Clipboard;
  7341. /***/ }),
  7342. /* 1 */
  7343. /***/ (function(module, exports, __webpack_require__) {
  7344. "use strict";
  7345. 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; };
  7346. 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; }; }();
  7347. var _select = __webpack_require__(2);
  7348. var _select2 = _interopRequireDefault(_select);
  7349. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7350. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7351. /**
  7352. * Inner class which performs selection from either `text` or `target`
  7353. * properties and then executes copy or cut operations.
  7354. */
  7355. var ClipboardAction = function () {
  7356. /**
  7357. * @param {Object} options
  7358. */
  7359. function ClipboardAction(options) {
  7360. _classCallCheck(this, ClipboardAction);
  7361. this.resolveOptions(options);
  7362. this.initSelection();
  7363. }
  7364. /**
  7365. * Defines base properties passed from constructor.
  7366. * @param {Object} options
  7367. */
  7368. _createClass(ClipboardAction, [{
  7369. key: 'resolveOptions',
  7370. value: function resolveOptions() {
  7371. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7372. this.action = options.action;
  7373. this.container = options.container;
  7374. this.emitter = options.emitter;
  7375. this.target = options.target;
  7376. this.text = options.text;
  7377. this.trigger = options.trigger;
  7378. this.selectedText = '';
  7379. }
  7380. /**
  7381. * Decides which selection strategy is going to be applied based
  7382. * on the existence of `text` and `target` properties.
  7383. */
  7384. }, {
  7385. key: 'initSelection',
  7386. value: function initSelection() {
  7387. if (this.text) {
  7388. this.selectFake();
  7389. } else if (this.target) {
  7390. this.selectTarget();
  7391. }
  7392. }
  7393. /**
  7394. * Creates a fake textarea element, sets its value from `text` property,
  7395. * and makes a selection on it.
  7396. */
  7397. }, {
  7398. key: 'selectFake',
  7399. value: function selectFake() {
  7400. var _this = this;
  7401. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7402. this.removeFake();
  7403. this.fakeHandlerCallback = function () {
  7404. return _this.removeFake();
  7405. };
  7406. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7407. this.fakeElem = document.createElement('textarea');
  7408. // Prevent zooming on iOS
  7409. this.fakeElem.style.fontSize = '12pt';
  7410. // Reset box model
  7411. this.fakeElem.style.border = '0';
  7412. this.fakeElem.style.padding = '0';
  7413. this.fakeElem.style.margin = '0';
  7414. // Move element out of screen horizontally
  7415. this.fakeElem.style.position = 'absolute';
  7416. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7417. // Move element to the same position vertically
  7418. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7419. this.fakeElem.style.top = yPosition + 'px';
  7420. this.fakeElem.setAttribute('readonly', '');
  7421. this.fakeElem.value = this.text;
  7422. this.container.appendChild(this.fakeElem);
  7423. this.selectedText = (0, _select2.default)(this.fakeElem);
  7424. this.copyText();
  7425. }
  7426. /**
  7427. * Only removes the fake element after another click event, that way
  7428. * a user can hit `Ctrl+C` to copy because selection still exists.
  7429. */
  7430. }, {
  7431. key: 'removeFake',
  7432. value: function removeFake() {
  7433. if (this.fakeHandler) {
  7434. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7435. this.fakeHandler = null;
  7436. this.fakeHandlerCallback = null;
  7437. }
  7438. if (this.fakeElem) {
  7439. this.container.removeChild(this.fakeElem);
  7440. this.fakeElem = null;
  7441. }
  7442. }
  7443. /**
  7444. * Selects the content from element passed on `target` property.
  7445. */
  7446. }, {
  7447. key: 'selectTarget',
  7448. value: function selectTarget() {
  7449. this.selectedText = (0, _select2.default)(this.target);
  7450. this.copyText();
  7451. }
  7452. /**
  7453. * Executes the copy operation based on the current selection.
  7454. */
  7455. }, {
  7456. key: 'copyText',
  7457. value: function copyText() {
  7458. var succeeded = void 0;
  7459. try {
  7460. succeeded = document.execCommand(this.action);
  7461. } catch (err) {
  7462. succeeded = false;
  7463. }
  7464. this.handleResult(succeeded);
  7465. }
  7466. /**
  7467. * Fires an event based on the copy operation result.
  7468. * @param {Boolean} succeeded
  7469. */
  7470. }, {
  7471. key: 'handleResult',
  7472. value: function handleResult(succeeded) {
  7473. this.emitter.emit(succeeded ? 'success' : 'error', {
  7474. action: this.action,
  7475. text: this.selectedText,
  7476. trigger: this.trigger,
  7477. clearSelection: this.clearSelection.bind(this)
  7478. });
  7479. }
  7480. /**
  7481. * Moves focus away from `target` and back to the trigger, removes current selection.
  7482. */
  7483. }, {
  7484. key: 'clearSelection',
  7485. value: function clearSelection() {
  7486. if (this.trigger) {
  7487. this.trigger.focus();
  7488. }
  7489. window.getSelection().removeAllRanges();
  7490. }
  7491. /**
  7492. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7493. * @param {String} action
  7494. */
  7495. }, {
  7496. key: 'destroy',
  7497. /**
  7498. * Destroy lifecycle.
  7499. */
  7500. value: function destroy() {
  7501. this.removeFake();
  7502. }
  7503. }, {
  7504. key: 'action',
  7505. set: function set() {
  7506. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7507. this._action = action;
  7508. if (this._action !== 'copy' && this._action !== 'cut') {
  7509. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7510. }
  7511. }
  7512. /**
  7513. * Gets the `action` property.
  7514. * @return {String}
  7515. */
  7516. ,
  7517. get: function get() {
  7518. return this._action;
  7519. }
  7520. /**
  7521. * Sets the `target` property using an element
  7522. * that will be have its content copied.
  7523. * @param {Element} target
  7524. */
  7525. }, {
  7526. key: 'target',
  7527. set: function set(target) {
  7528. if (target !== undefined) {
  7529. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7530. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7531. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7532. }
  7533. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7534. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7535. }
  7536. this._target = target;
  7537. } else {
  7538. throw new Error('Invalid "target" value, use a valid Element');
  7539. }
  7540. }
  7541. }
  7542. /**
  7543. * Gets the `target` property.
  7544. * @return {String|HTMLElement}
  7545. */
  7546. ,
  7547. get: function get() {
  7548. return this._target;
  7549. }
  7550. }]);
  7551. return ClipboardAction;
  7552. }();
  7553. module.exports = ClipboardAction;
  7554. /***/ }),
  7555. /* 2 */
  7556. /***/ (function(module, exports) {
  7557. function select(element) {
  7558. var selectedText;
  7559. if (element.nodeName === 'SELECT') {
  7560. element.focus();
  7561. selectedText = element.value;
  7562. }
  7563. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7564. var isReadOnly = element.hasAttribute('readonly');
  7565. if (!isReadOnly) {
  7566. element.setAttribute('readonly', '');
  7567. }
  7568. element.select();
  7569. element.setSelectionRange(0, element.value.length);
  7570. if (!isReadOnly) {
  7571. element.removeAttribute('readonly');
  7572. }
  7573. selectedText = element.value;
  7574. }
  7575. else {
  7576. if (element.hasAttribute('contenteditable')) {
  7577. element.focus();
  7578. }
  7579. var selection = window.getSelection();
  7580. var range = document.createRange();
  7581. range.selectNodeContents(element);
  7582. selection.removeAllRanges();
  7583. selection.addRange(range);
  7584. selectedText = selection.toString();
  7585. }
  7586. return selectedText;
  7587. }
  7588. module.exports = select;
  7589. /***/ }),
  7590. /* 3 */
  7591. /***/ (function(module, exports) {
  7592. function E () {
  7593. // Keep this empty so it's easier to inherit from
  7594. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7595. }
  7596. E.prototype = {
  7597. on: function (name, callback, ctx) {
  7598. var e = this.e || (this.e = {});
  7599. (e[name] || (e[name] = [])).push({
  7600. fn: callback,
  7601. ctx: ctx
  7602. });
  7603. return this;
  7604. },
  7605. once: function (name, callback, ctx) {
  7606. var self = this;
  7607. function listener () {
  7608. self.off(name, listener);
  7609. callback.apply(ctx, arguments);
  7610. };
  7611. listener._ = callback
  7612. return this.on(name, listener, ctx);
  7613. },
  7614. emit: function (name) {
  7615. var data = [].slice.call(arguments, 1);
  7616. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7617. var i = 0;
  7618. var len = evtArr.length;
  7619. for (i; i < len; i++) {
  7620. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7621. }
  7622. return this;
  7623. },
  7624. off: function (name, callback) {
  7625. var e = this.e || (this.e = {});
  7626. var evts = e[name];
  7627. var liveEvents = [];
  7628. if (evts && callback) {
  7629. for (var i = 0, len = evts.length; i < len; i++) {
  7630. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7631. liveEvents.push(evts[i]);
  7632. }
  7633. }
  7634. // Remove event from queue to prevent memory leak
  7635. // Suggested by https://github.com/lazd
  7636. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7637. (liveEvents.length)
  7638. ? e[name] = liveEvents
  7639. : delete e[name];
  7640. return this;
  7641. }
  7642. };
  7643. module.exports = E;
  7644. /***/ }),
  7645. /* 4 */
  7646. /***/ (function(module, exports, __webpack_require__) {
  7647. var is = __webpack_require__(5);
  7648. var delegate = __webpack_require__(6);
  7649. /**
  7650. * Validates all params and calls the right
  7651. * listener function based on its target type.
  7652. *
  7653. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7654. * @param {String} type
  7655. * @param {Function} callback
  7656. * @return {Object}
  7657. */
  7658. function listen(target, type, callback) {
  7659. if (!target && !type && !callback) {
  7660. throw new Error('Missing required arguments');
  7661. }
  7662. if (!is.string(type)) {
  7663. throw new TypeError('Second argument must be a String');
  7664. }
  7665. if (!is.fn(callback)) {
  7666. throw new TypeError('Third argument must be a Function');
  7667. }
  7668. if (is.node(target)) {
  7669. return listenNode(target, type, callback);
  7670. }
  7671. else if (is.nodeList(target)) {
  7672. return listenNodeList(target, type, callback);
  7673. }
  7674. else if (is.string(target)) {
  7675. return listenSelector(target, type, callback);
  7676. }
  7677. else {
  7678. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7679. }
  7680. }
  7681. /**
  7682. * Adds an event listener to a HTML element
  7683. * and returns a remove listener function.
  7684. *
  7685. * @param {HTMLElement} node
  7686. * @param {String} type
  7687. * @param {Function} callback
  7688. * @return {Object}
  7689. */
  7690. function listenNode(node, type, callback) {
  7691. node.addEventListener(type, callback);
  7692. return {
  7693. destroy: function() {
  7694. node.removeEventListener(type, callback);
  7695. }
  7696. }
  7697. }
  7698. /**
  7699. * Add an event listener to a list of HTML elements
  7700. * and returns a remove listener function.
  7701. *
  7702. * @param {NodeList|HTMLCollection} nodeList
  7703. * @param {String} type
  7704. * @param {Function} callback
  7705. * @return {Object}
  7706. */
  7707. function listenNodeList(nodeList, type, callback) {
  7708. Array.prototype.forEach.call(nodeList, function(node) {
  7709. node.addEventListener(type, callback);
  7710. });
  7711. return {
  7712. destroy: function() {
  7713. Array.prototype.forEach.call(nodeList, function(node) {
  7714. node.removeEventListener(type, callback);
  7715. });
  7716. }
  7717. }
  7718. }
  7719. /**
  7720. * Add an event listener to a selector
  7721. * and returns a remove listener function.
  7722. *
  7723. * @param {String} selector
  7724. * @param {String} type
  7725. * @param {Function} callback
  7726. * @return {Object}
  7727. */
  7728. function listenSelector(selector, type, callback) {
  7729. return delegate(document.body, selector, type, callback);
  7730. }
  7731. module.exports = listen;
  7732. /***/ }),
  7733. /* 5 */
  7734. /***/ (function(module, exports) {
  7735. /**
  7736. * Check if argument is a HTML element.
  7737. *
  7738. * @param {Object} value
  7739. * @return {Boolean}
  7740. */
  7741. exports.node = function(value) {
  7742. return value !== undefined
  7743. && value instanceof HTMLElement
  7744. && value.nodeType === 1;
  7745. };
  7746. /**
  7747. * Check if argument is a list of HTML elements.
  7748. *
  7749. * @param {Object} value
  7750. * @return {Boolean}
  7751. */
  7752. exports.nodeList = function(value) {
  7753. var type = Object.prototype.toString.call(value);
  7754. return value !== undefined
  7755. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  7756. && ('length' in value)
  7757. && (value.length === 0 || exports.node(value[0]));
  7758. };
  7759. /**
  7760. * Check if argument is a string.
  7761. *
  7762. * @param {Object} value
  7763. * @return {Boolean}
  7764. */
  7765. exports.string = function(value) {
  7766. return typeof value === 'string'
  7767. || value instanceof String;
  7768. };
  7769. /**
  7770. * Check if argument is a function.
  7771. *
  7772. * @param {Object} value
  7773. * @return {Boolean}
  7774. */
  7775. exports.fn = function(value) {
  7776. var type = Object.prototype.toString.call(value);
  7777. return type === '[object Function]';
  7778. };
  7779. /***/ }),
  7780. /* 6 */
  7781. /***/ (function(module, exports, __webpack_require__) {
  7782. var closest = __webpack_require__(7);
  7783. /**
  7784. * Delegates event to a selector.
  7785. *
  7786. * @param {Element} element
  7787. * @param {String} selector
  7788. * @param {String} type
  7789. * @param {Function} callback
  7790. * @param {Boolean} useCapture
  7791. * @return {Object}
  7792. */
  7793. function _delegate(element, selector, type, callback, useCapture) {
  7794. var listenerFn = listener.apply(this, arguments);
  7795. element.addEventListener(type, listenerFn, useCapture);
  7796. return {
  7797. destroy: function() {
  7798. element.removeEventListener(type, listenerFn, useCapture);
  7799. }
  7800. }
  7801. }
  7802. /**
  7803. * Delegates event to a selector.
  7804. *
  7805. * @param {Element|String|Array} [elements]
  7806. * @param {String} selector
  7807. * @param {String} type
  7808. * @param {Function} callback
  7809. * @param {Boolean} useCapture
  7810. * @return {Object}
  7811. */
  7812. function delegate(elements, selector, type, callback, useCapture) {
  7813. // Handle the regular Element usage
  7814. if (typeof elements.addEventListener === 'function') {
  7815. return _delegate.apply(null, arguments);
  7816. }
  7817. // Handle Element-less usage, it defaults to global delegation
  7818. if (typeof type === 'function') {
  7819. // Use `document` as the first parameter, then apply arguments
  7820. // This is a short way to .unshift `arguments` without running into deoptimizations
  7821. return _delegate.bind(null, document).apply(null, arguments);
  7822. }
  7823. // Handle Selector-based usage
  7824. if (typeof elements === 'string') {
  7825. elements = document.querySelectorAll(elements);
  7826. }
  7827. // Handle Array-like based usage
  7828. return Array.prototype.map.call(elements, function (element) {
  7829. return _delegate(element, selector, type, callback, useCapture);
  7830. });
  7831. }
  7832. /**
  7833. * Finds closest match and invokes callback.
  7834. *
  7835. * @param {Element} element
  7836. * @param {String} selector
  7837. * @param {String} type
  7838. * @param {Function} callback
  7839. * @return {Function}
  7840. */
  7841. function listener(element, selector, type, callback) {
  7842. return function(e) {
  7843. e.delegateTarget = closest(e.target, selector);
  7844. if (e.delegateTarget) {
  7845. callback.call(element, e);
  7846. }
  7847. }
  7848. }
  7849. module.exports = delegate;
  7850. /***/ }),
  7851. /* 7 */
  7852. /***/ (function(module, exports) {
  7853. var DOCUMENT_NODE_TYPE = 9;
  7854. /**
  7855. * A polyfill for Element.matches()
  7856. */
  7857. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  7858. var proto = Element.prototype;
  7859. proto.matches = proto.matchesSelector ||
  7860. proto.mozMatchesSelector ||
  7861. proto.msMatchesSelector ||
  7862. proto.oMatchesSelector ||
  7863. proto.webkitMatchesSelector;
  7864. }
  7865. /**
  7866. * Finds the closest parent that matches a selector.
  7867. *
  7868. * @param {Element} element
  7869. * @param {String} selector
  7870. * @return {Function}
  7871. */
  7872. function closest (element, selector) {
  7873. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  7874. if (typeof element.matches === 'function' &&
  7875. element.matches(selector)) {
  7876. return element;
  7877. }
  7878. element = element.parentNode;
  7879. }
  7880. }
  7881. module.exports = closest;
  7882. /***/ })
  7883. /******/ ]);
  7884. });
  7885. /***/ }),
  7886. /***/ "./node_modules/ieee754/index.js":
  7887. /*!***************************************!*\
  7888. !*** ./node_modules/ieee754/index.js ***!
  7889. \***************************************/
  7890. /*! no static exports found */
  7891. /***/ (function(module, exports) {
  7892. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  7893. var e, m
  7894. var eLen = (nBytes * 8) - mLen - 1
  7895. var eMax = (1 << eLen) - 1
  7896. var eBias = eMax >> 1
  7897. var nBits = -7
  7898. var i = isLE ? (nBytes - 1) : 0
  7899. var d = isLE ? -1 : 1
  7900. var s = buffer[offset + i]
  7901. i += d
  7902. e = s & ((1 << (-nBits)) - 1)
  7903. s >>= (-nBits)
  7904. nBits += eLen
  7905. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  7906. m = e & ((1 << (-nBits)) - 1)
  7907. e >>= (-nBits)
  7908. nBits += mLen
  7909. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  7910. if (e === 0) {
  7911. e = 1 - eBias
  7912. } else if (e === eMax) {
  7913. return m ? NaN : ((s ? -1 : 1) * Infinity)
  7914. } else {
  7915. m = m + Math.pow(2, mLen)
  7916. e = e - eBias
  7917. }
  7918. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  7919. }
  7920. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  7921. var e, m, c
  7922. var eLen = (nBytes * 8) - mLen - 1
  7923. var eMax = (1 << eLen) - 1
  7924. var eBias = eMax >> 1
  7925. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  7926. var i = isLE ? 0 : (nBytes - 1)
  7927. var d = isLE ? 1 : -1
  7928. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  7929. value = Math.abs(value)
  7930. if (isNaN(value) || value === Infinity) {
  7931. m = isNaN(value) ? 1 : 0
  7932. e = eMax
  7933. } else {
  7934. e = Math.floor(Math.log(value) / Math.LN2)
  7935. if (value * (c = Math.pow(2, -e)) < 1) {
  7936. e--
  7937. c *= 2
  7938. }
  7939. if (e + eBias >= 1) {
  7940. value += rt / c
  7941. } else {
  7942. value += rt * Math.pow(2, 1 - eBias)
  7943. }
  7944. if (value * c >= 2) {
  7945. e++
  7946. c /= 2
  7947. }
  7948. if (e + eBias >= eMax) {
  7949. m = 0
  7950. e = eMax
  7951. } else if (e + eBias >= 1) {
  7952. m = ((value * c) - 1) * Math.pow(2, mLen)
  7953. e = e + eBias
  7954. } else {
  7955. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  7956. e = 0
  7957. }
  7958. }
  7959. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  7960. e = (e << mLen) | m
  7961. eLen += mLen
  7962. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  7963. buffer[offset + i - d] |= s * 128
  7964. }
  7965. /***/ }),
  7966. /***/ "./node_modules/isarray/index.js":
  7967. /*!***************************************!*\
  7968. !*** ./node_modules/isarray/index.js ***!
  7969. \***************************************/
  7970. /*! no static exports found */
  7971. /***/ (function(module, exports) {
  7972. var toString = {}.toString;
  7973. module.exports = Array.isArray || function (arr) {
  7974. return toString.call(arr) == '[object Array]';
  7975. };
  7976. /***/ }),
  7977. /***/ "./node_modules/jquery/dist/jquery.js":
  7978. /*!********************************************!*\
  7979. !*** ./node_modules/jquery/dist/jquery.js ***!
  7980. \********************************************/
  7981. /*! no static exports found */
  7982. /***/ (function(module, exports, __webpack_require__) {
  7983. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  7984. * jQuery JavaScript Library v3.4.1
  7985. * https://jquery.com/
  7986. *
  7987. * Includes Sizzle.js
  7988. * https://sizzlejs.com/
  7989. *
  7990. * Copyright JS Foundation and other contributors
  7991. * Released under the MIT license
  7992. * https://jquery.org/license
  7993. *
  7994. * Date: 2019-05-01T21:04Z
  7995. */
  7996. ( function( global, factory ) {
  7997. "use strict";
  7998. if ( true && typeof module.exports === "object" ) {
  7999. // For CommonJS and CommonJS-like environments where a proper `window`
  8000. // is present, execute the factory and get jQuery.
  8001. // For environments that do not have a `window` with a `document`
  8002. // (such as Node.js), expose a factory as module.exports.
  8003. // This accentuates the need for the creation of a real `window`.
  8004. // e.g. var jQuery = require("jquery")(window);
  8005. // See ticket #14549 for more info.
  8006. module.exports = global.document ?
  8007. factory( global, true ) :
  8008. function( w ) {
  8009. if ( !w.document ) {
  8010. throw new Error( "jQuery requires a window with a document" );
  8011. }
  8012. return factory( w );
  8013. };
  8014. } else {
  8015. factory( global );
  8016. }
  8017. // Pass this if window is not defined yet
  8018. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8019. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8020. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8021. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8022. // enough that all such attempts are guarded in a try block.
  8023. "use strict";
  8024. var arr = [];
  8025. var document = window.document;
  8026. var getProto = Object.getPrototypeOf;
  8027. var slice = arr.slice;
  8028. var concat = arr.concat;
  8029. var push = arr.push;
  8030. var indexOf = arr.indexOf;
  8031. var class2type = {};
  8032. var toString = class2type.toString;
  8033. var hasOwn = class2type.hasOwnProperty;
  8034. var fnToString = hasOwn.toString;
  8035. var ObjectFunctionString = fnToString.call( Object );
  8036. var support = {};
  8037. var isFunction = function isFunction( obj ) {
  8038. // Support: Chrome <=57, Firefox <=52
  8039. // In some browsers, typeof returns "function" for HTML <object> elements
  8040. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8041. // We don't want to classify *any* DOM node as a function.
  8042. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8043. };
  8044. var isWindow = function isWindow( obj ) {
  8045. return obj != null && obj === obj.window;
  8046. };
  8047. var preservedScriptAttributes = {
  8048. type: true,
  8049. src: true,
  8050. nonce: true,
  8051. noModule: true
  8052. };
  8053. function DOMEval( code, node, doc ) {
  8054. doc = doc || document;
  8055. var i, val,
  8056. script = doc.createElement( "script" );
  8057. script.text = code;
  8058. if ( node ) {
  8059. for ( i in preservedScriptAttributes ) {
  8060. // Support: Firefox 64+, Edge 18+
  8061. // Some browsers don't support the "nonce" property on scripts.
  8062. // On the other hand, just using `getAttribute` is not enough as
  8063. // the `nonce` attribute is reset to an empty string whenever it
  8064. // becomes browsing-context connected.
  8065. // See https://github.com/whatwg/html/issues/2369
  8066. // See https://html.spec.whatwg.org/#nonce-attributes
  8067. // The `node.getAttribute` check was added for the sake of
  8068. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8069. // via an object.
  8070. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8071. if ( val ) {
  8072. script.setAttribute( i, val );
  8073. }
  8074. }
  8075. }
  8076. doc.head.appendChild( script ).parentNode.removeChild( script );
  8077. }
  8078. function toType( obj ) {
  8079. if ( obj == null ) {
  8080. return obj + "";
  8081. }
  8082. // Support: Android <=2.3 only (functionish RegExp)
  8083. return typeof obj === "object" || typeof obj === "function" ?
  8084. class2type[ toString.call( obj ) ] || "object" :
  8085. typeof obj;
  8086. }
  8087. /* global Symbol */
  8088. // Defining this global in .eslintrc.json would create a danger of using the global
  8089. // unguarded in another place, it seems safer to define global only for this module
  8090. var
  8091. version = "3.4.1",
  8092. // Define a local copy of jQuery
  8093. jQuery = function( selector, context ) {
  8094. // The jQuery object is actually just the init constructor 'enhanced'
  8095. // Need init if jQuery is called (just allow error to be thrown if not included)
  8096. return new jQuery.fn.init( selector, context );
  8097. },
  8098. // Support: Android <=4.0 only
  8099. // Make sure we trim BOM and NBSP
  8100. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8101. jQuery.fn = jQuery.prototype = {
  8102. // The current version of jQuery being used
  8103. jquery: version,
  8104. constructor: jQuery,
  8105. // The default length of a jQuery object is 0
  8106. length: 0,
  8107. toArray: function() {
  8108. return slice.call( this );
  8109. },
  8110. // Get the Nth element in the matched element set OR
  8111. // Get the whole matched element set as a clean array
  8112. get: function( num ) {
  8113. // Return all the elements in a clean array
  8114. if ( num == null ) {
  8115. return slice.call( this );
  8116. }
  8117. // Return just the one element from the set
  8118. return num < 0 ? this[ num + this.length ] : this[ num ];
  8119. },
  8120. // Take an array of elements and push it onto the stack
  8121. // (returning the new matched element set)
  8122. pushStack: function( elems ) {
  8123. // Build a new jQuery matched element set
  8124. var ret = jQuery.merge( this.constructor(), elems );
  8125. // Add the old object onto the stack (as a reference)
  8126. ret.prevObject = this;
  8127. // Return the newly-formed element set
  8128. return ret;
  8129. },
  8130. // Execute a callback for every element in the matched set.
  8131. each: function( callback ) {
  8132. return jQuery.each( this, callback );
  8133. },
  8134. map: function( callback ) {
  8135. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8136. return callback.call( elem, i, elem );
  8137. } ) );
  8138. },
  8139. slice: function() {
  8140. return this.pushStack( slice.apply( this, arguments ) );
  8141. },
  8142. first: function() {
  8143. return this.eq( 0 );
  8144. },
  8145. last: function() {
  8146. return this.eq( -1 );
  8147. },
  8148. eq: function( i ) {
  8149. var len = this.length,
  8150. j = +i + ( i < 0 ? len : 0 );
  8151. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8152. },
  8153. end: function() {
  8154. return this.prevObject || this.constructor();
  8155. },
  8156. // For internal use only.
  8157. // Behaves like an Array's method, not like a jQuery method.
  8158. push: push,
  8159. sort: arr.sort,
  8160. splice: arr.splice
  8161. };
  8162. jQuery.extend = jQuery.fn.extend = function() {
  8163. var options, name, src, copy, copyIsArray, clone,
  8164. target = arguments[ 0 ] || {},
  8165. i = 1,
  8166. length = arguments.length,
  8167. deep = false;
  8168. // Handle a deep copy situation
  8169. if ( typeof target === "boolean" ) {
  8170. deep = target;
  8171. // Skip the boolean and the target
  8172. target = arguments[ i ] || {};
  8173. i++;
  8174. }
  8175. // Handle case when target is a string or something (possible in deep copy)
  8176. if ( typeof target !== "object" && !isFunction( target ) ) {
  8177. target = {};
  8178. }
  8179. // Extend jQuery itself if only one argument is passed
  8180. if ( i === length ) {
  8181. target = this;
  8182. i--;
  8183. }
  8184. for ( ; i < length; i++ ) {
  8185. // Only deal with non-null/undefined values
  8186. if ( ( options = arguments[ i ] ) != null ) {
  8187. // Extend the base object
  8188. for ( name in options ) {
  8189. copy = options[ name ];
  8190. // Prevent Object.prototype pollution
  8191. // Prevent never-ending loop
  8192. if ( name === "__proto__" || target === copy ) {
  8193. continue;
  8194. }
  8195. // Recurse if we're merging plain objects or arrays
  8196. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8197. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8198. src = target[ name ];
  8199. // Ensure proper type for the source value
  8200. if ( copyIsArray && !Array.isArray( src ) ) {
  8201. clone = [];
  8202. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8203. clone = {};
  8204. } else {
  8205. clone = src;
  8206. }
  8207. copyIsArray = false;
  8208. // Never move original objects, clone them
  8209. target[ name ] = jQuery.extend( deep, clone, copy );
  8210. // Don't bring in undefined values
  8211. } else if ( copy !== undefined ) {
  8212. target[ name ] = copy;
  8213. }
  8214. }
  8215. }
  8216. }
  8217. // Return the modified object
  8218. return target;
  8219. };
  8220. jQuery.extend( {
  8221. // Unique for each copy of jQuery on the page
  8222. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8223. // Assume jQuery is ready without the ready module
  8224. isReady: true,
  8225. error: function( msg ) {
  8226. throw new Error( msg );
  8227. },
  8228. noop: function() {},
  8229. isPlainObject: function( obj ) {
  8230. var proto, Ctor;
  8231. // Detect obvious negatives
  8232. // Use toString instead of jQuery.type to catch host objects
  8233. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8234. return false;
  8235. }
  8236. proto = getProto( obj );
  8237. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8238. if ( !proto ) {
  8239. return true;
  8240. }
  8241. // Objects with prototype are plain iff they were constructed by a global Object function
  8242. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8243. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8244. },
  8245. isEmptyObject: function( obj ) {
  8246. var name;
  8247. for ( name in obj ) {
  8248. return false;
  8249. }
  8250. return true;
  8251. },
  8252. // Evaluates a script in a global context
  8253. globalEval: function( code, options ) {
  8254. DOMEval( code, { nonce: options && options.nonce } );
  8255. },
  8256. each: function( obj, callback ) {
  8257. var length, i = 0;
  8258. if ( isArrayLike( obj ) ) {
  8259. length = obj.length;
  8260. for ( ; i < length; i++ ) {
  8261. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8262. break;
  8263. }
  8264. }
  8265. } else {
  8266. for ( i in obj ) {
  8267. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8268. break;
  8269. }
  8270. }
  8271. }
  8272. return obj;
  8273. },
  8274. // Support: Android <=4.0 only
  8275. trim: function( text ) {
  8276. return text == null ?
  8277. "" :
  8278. ( text + "" ).replace( rtrim, "" );
  8279. },
  8280. // results is for internal usage only
  8281. makeArray: function( arr, results ) {
  8282. var ret = results || [];
  8283. if ( arr != null ) {
  8284. if ( isArrayLike( Object( arr ) ) ) {
  8285. jQuery.merge( ret,
  8286. typeof arr === "string" ?
  8287. [ arr ] : arr
  8288. );
  8289. } else {
  8290. push.call( ret, arr );
  8291. }
  8292. }
  8293. return ret;
  8294. },
  8295. inArray: function( elem, arr, i ) {
  8296. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8297. },
  8298. // Support: Android <=4.0 only, PhantomJS 1 only
  8299. // push.apply(_, arraylike) throws on ancient WebKit
  8300. merge: function( first, second ) {
  8301. var len = +second.length,
  8302. j = 0,
  8303. i = first.length;
  8304. for ( ; j < len; j++ ) {
  8305. first[ i++ ] = second[ j ];
  8306. }
  8307. first.length = i;
  8308. return first;
  8309. },
  8310. grep: function( elems, callback, invert ) {
  8311. var callbackInverse,
  8312. matches = [],
  8313. i = 0,
  8314. length = elems.length,
  8315. callbackExpect = !invert;
  8316. // Go through the array, only saving the items
  8317. // that pass the validator function
  8318. for ( ; i < length; i++ ) {
  8319. callbackInverse = !callback( elems[ i ], i );
  8320. if ( callbackInverse !== callbackExpect ) {
  8321. matches.push( elems[ i ] );
  8322. }
  8323. }
  8324. return matches;
  8325. },
  8326. // arg is for internal usage only
  8327. map: function( elems, callback, arg ) {
  8328. var length, value,
  8329. i = 0,
  8330. ret = [];
  8331. // Go through the array, translating each of the items to their new values
  8332. if ( isArrayLike( elems ) ) {
  8333. length = elems.length;
  8334. for ( ; i < length; i++ ) {
  8335. value = callback( elems[ i ], i, arg );
  8336. if ( value != null ) {
  8337. ret.push( value );
  8338. }
  8339. }
  8340. // Go through every key on the object,
  8341. } else {
  8342. for ( i in elems ) {
  8343. value = callback( elems[ i ], i, arg );
  8344. if ( value != null ) {
  8345. ret.push( value );
  8346. }
  8347. }
  8348. }
  8349. // Flatten any nested arrays
  8350. return concat.apply( [], ret );
  8351. },
  8352. // A global GUID counter for objects
  8353. guid: 1,
  8354. // jQuery.support is not used in Core but other projects attach their
  8355. // properties to it so it needs to exist.
  8356. support: support
  8357. } );
  8358. if ( typeof Symbol === "function" ) {
  8359. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8360. }
  8361. // Populate the class2type map
  8362. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8363. function( i, name ) {
  8364. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8365. } );
  8366. function isArrayLike( obj ) {
  8367. // Support: real iOS 8.2 only (not reproducible in simulator)
  8368. // `in` check used to prevent JIT error (gh-2145)
  8369. // hasOwn isn't used here due to false negatives
  8370. // regarding Nodelist length in IE
  8371. var length = !!obj && "length" in obj && obj.length,
  8372. type = toType( obj );
  8373. if ( isFunction( obj ) || isWindow( obj ) ) {
  8374. return false;
  8375. }
  8376. return type === "array" || length === 0 ||
  8377. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8378. }
  8379. var Sizzle =
  8380. /*!
  8381. * Sizzle CSS Selector Engine v2.3.4
  8382. * https://sizzlejs.com/
  8383. *
  8384. * Copyright JS Foundation and other contributors
  8385. * Released under the MIT license
  8386. * https://js.foundation/
  8387. *
  8388. * Date: 2019-04-08
  8389. */
  8390. (function( window ) {
  8391. var i,
  8392. support,
  8393. Expr,
  8394. getText,
  8395. isXML,
  8396. tokenize,
  8397. compile,
  8398. select,
  8399. outermostContext,
  8400. sortInput,
  8401. hasDuplicate,
  8402. // Local document vars
  8403. setDocument,
  8404. document,
  8405. docElem,
  8406. documentIsHTML,
  8407. rbuggyQSA,
  8408. rbuggyMatches,
  8409. matches,
  8410. contains,
  8411. // Instance-specific data
  8412. expando = "sizzle" + 1 * new Date(),
  8413. preferredDoc = window.document,
  8414. dirruns = 0,
  8415. done = 0,
  8416. classCache = createCache(),
  8417. tokenCache = createCache(),
  8418. compilerCache = createCache(),
  8419. nonnativeSelectorCache = createCache(),
  8420. sortOrder = function( a, b ) {
  8421. if ( a === b ) {
  8422. hasDuplicate = true;
  8423. }
  8424. return 0;
  8425. },
  8426. // Instance methods
  8427. hasOwn = ({}).hasOwnProperty,
  8428. arr = [],
  8429. pop = arr.pop,
  8430. push_native = arr.push,
  8431. push = arr.push,
  8432. slice = arr.slice,
  8433. // Use a stripped-down indexOf as it's faster than native
  8434. // https://jsperf.com/thor-indexof-vs-for/5
  8435. indexOf = function( list, elem ) {
  8436. var i = 0,
  8437. len = list.length;
  8438. for ( ; i < len; i++ ) {
  8439. if ( list[i] === elem ) {
  8440. return i;
  8441. }
  8442. }
  8443. return -1;
  8444. },
  8445. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8446. // Regular expressions
  8447. // http://www.w3.org/TR/css3-selectors/#whitespace
  8448. whitespace = "[\\x20\\t\\r\\n\\f]",
  8449. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8450. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8451. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8452. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8453. // Operator (capture 2)
  8454. "*([*^$|!~]?=)" + whitespace +
  8455. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8456. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8457. "*\\]",
  8458. pseudos = ":(" + identifier + ")(?:\\((" +
  8459. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8460. // 1. quoted (capture 3; capture 4 or capture 5)
  8461. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8462. // 2. simple (capture 6)
  8463. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8464. // 3. anything else (capture 2)
  8465. ".*" +
  8466. ")\\)|)",
  8467. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8468. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8469. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8470. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8471. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8472. rdescend = new RegExp( whitespace + "|>" ),
  8473. rpseudo = new RegExp( pseudos ),
  8474. ridentifier = new RegExp( "^" + identifier + "$" ),
  8475. matchExpr = {
  8476. "ID": new RegExp( "^#(" + identifier + ")" ),
  8477. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8478. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8479. "ATTR": new RegExp( "^" + attributes ),
  8480. "PSEUDO": new RegExp( "^" + pseudos ),
  8481. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8482. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8483. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8484. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8485. // For use in libraries implementing .is()
  8486. // We use this for POS matching in `select`
  8487. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8488. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8489. },
  8490. rhtml = /HTML$/i,
  8491. rinputs = /^(?:input|select|textarea|button)$/i,
  8492. rheader = /^h\d$/i,
  8493. rnative = /^[^{]+\{\s*\[native \w/,
  8494. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8495. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8496. rsibling = /[+~]/,
  8497. // CSS escapes
  8498. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8499. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8500. funescape = function( _, escaped, escapedWhitespace ) {
  8501. var high = "0x" + escaped - 0x10000;
  8502. // NaN means non-codepoint
  8503. // Support: Firefox<24
  8504. // Workaround erroneous numeric interpretation of +"0x"
  8505. return high !== high || escapedWhitespace ?
  8506. escaped :
  8507. high < 0 ?
  8508. // BMP codepoint
  8509. String.fromCharCode( high + 0x10000 ) :
  8510. // Supplemental Plane codepoint (surrogate pair)
  8511. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8512. },
  8513. // CSS string/identifier serialization
  8514. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8515. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8516. fcssescape = function( ch, asCodePoint ) {
  8517. if ( asCodePoint ) {
  8518. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8519. if ( ch === "\0" ) {
  8520. return "\uFFFD";
  8521. }
  8522. // Control characters and (dependent upon position) numbers get escaped as code points
  8523. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8524. }
  8525. // Other potentially-special ASCII characters get backslash-escaped
  8526. return "\\" + ch;
  8527. },
  8528. // Used for iframes
  8529. // See setDocument()
  8530. // Removing the function wrapper causes a "Permission Denied"
  8531. // error in IE
  8532. unloadHandler = function() {
  8533. setDocument();
  8534. },
  8535. inDisabledFieldset = addCombinator(
  8536. function( elem ) {
  8537. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8538. },
  8539. { dir: "parentNode", next: "legend" }
  8540. );
  8541. // Optimize for push.apply( _, NodeList )
  8542. try {
  8543. push.apply(
  8544. (arr = slice.call( preferredDoc.childNodes )),
  8545. preferredDoc.childNodes
  8546. );
  8547. // Support: Android<4.0
  8548. // Detect silently failing push.apply
  8549. arr[ preferredDoc.childNodes.length ].nodeType;
  8550. } catch ( e ) {
  8551. push = { apply: arr.length ?
  8552. // Leverage slice if possible
  8553. function( target, els ) {
  8554. push_native.apply( target, slice.call(els) );
  8555. } :
  8556. // Support: IE<9
  8557. // Otherwise append directly
  8558. function( target, els ) {
  8559. var j = target.length,
  8560. i = 0;
  8561. // Can't trust NodeList.length
  8562. while ( (target[j++] = els[i++]) ) {}
  8563. target.length = j - 1;
  8564. }
  8565. };
  8566. }
  8567. function Sizzle( selector, context, results, seed ) {
  8568. var m, i, elem, nid, match, groups, newSelector,
  8569. newContext = context && context.ownerDocument,
  8570. // nodeType defaults to 9, since context defaults to document
  8571. nodeType = context ? context.nodeType : 9;
  8572. results = results || [];
  8573. // Return early from calls with invalid selector or context
  8574. if ( typeof selector !== "string" || !selector ||
  8575. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8576. return results;
  8577. }
  8578. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8579. if ( !seed ) {
  8580. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8581. setDocument( context );
  8582. }
  8583. context = context || document;
  8584. if ( documentIsHTML ) {
  8585. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8586. // (excepting DocumentFragment context, where the methods don't exist)
  8587. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8588. // ID selector
  8589. if ( (m = match[1]) ) {
  8590. // Document context
  8591. if ( nodeType === 9 ) {
  8592. if ( (elem = context.getElementById( m )) ) {
  8593. // Support: IE, Opera, Webkit
  8594. // TODO: identify versions
  8595. // getElementById can match elements by name instead of ID
  8596. if ( elem.id === m ) {
  8597. results.push( elem );
  8598. return results;
  8599. }
  8600. } else {
  8601. return results;
  8602. }
  8603. // Element context
  8604. } else {
  8605. // Support: IE, Opera, Webkit
  8606. // TODO: identify versions
  8607. // getElementById can match elements by name instead of ID
  8608. if ( newContext && (elem = newContext.getElementById( m )) &&
  8609. contains( context, elem ) &&
  8610. elem.id === m ) {
  8611. results.push( elem );
  8612. return results;
  8613. }
  8614. }
  8615. // Type selector
  8616. } else if ( match[2] ) {
  8617. push.apply( results, context.getElementsByTagName( selector ) );
  8618. return results;
  8619. // Class selector
  8620. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8621. context.getElementsByClassName ) {
  8622. push.apply( results, context.getElementsByClassName( m ) );
  8623. return results;
  8624. }
  8625. }
  8626. // Take advantage of querySelectorAll
  8627. if ( support.qsa &&
  8628. !nonnativeSelectorCache[ selector + " " ] &&
  8629. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8630. // Support: IE 8 only
  8631. // Exclude object elements
  8632. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8633. newSelector = selector;
  8634. newContext = context;
  8635. // qSA considers elements outside a scoping root when evaluating child or
  8636. // descendant combinators, which is not what we want.
  8637. // In such cases, we work around the behavior by prefixing every selector in the
  8638. // list with an ID selector referencing the scope context.
  8639. // Thanks to Andrew Dupont for this technique.
  8640. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8641. // Capture the context ID, setting it first if necessary
  8642. if ( (nid = context.getAttribute( "id" )) ) {
  8643. nid = nid.replace( rcssescape, fcssescape );
  8644. } else {
  8645. context.setAttribute( "id", (nid = expando) );
  8646. }
  8647. // Prefix every selector in the list
  8648. groups = tokenize( selector );
  8649. i = groups.length;
  8650. while ( i-- ) {
  8651. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8652. }
  8653. newSelector = groups.join( "," );
  8654. // Expand context for sibling selectors
  8655. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8656. context;
  8657. }
  8658. try {
  8659. push.apply( results,
  8660. newContext.querySelectorAll( newSelector )
  8661. );
  8662. return results;
  8663. } catch ( qsaError ) {
  8664. nonnativeSelectorCache( selector, true );
  8665. } finally {
  8666. if ( nid === expando ) {
  8667. context.removeAttribute( "id" );
  8668. }
  8669. }
  8670. }
  8671. }
  8672. }
  8673. // All others
  8674. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8675. }
  8676. /**
  8677. * Create key-value caches of limited size
  8678. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8679. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8680. * deleting the oldest entry
  8681. */
  8682. function createCache() {
  8683. var keys = [];
  8684. function cache( key, value ) {
  8685. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8686. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8687. // Only keep the most recent entries
  8688. delete cache[ keys.shift() ];
  8689. }
  8690. return (cache[ key + " " ] = value);
  8691. }
  8692. return cache;
  8693. }
  8694. /**
  8695. * Mark a function for special use by Sizzle
  8696. * @param {Function} fn The function to mark
  8697. */
  8698. function markFunction( fn ) {
  8699. fn[ expando ] = true;
  8700. return fn;
  8701. }
  8702. /**
  8703. * Support testing using an element
  8704. * @param {Function} fn Passed the created element and returns a boolean result
  8705. */
  8706. function assert( fn ) {
  8707. var el = document.createElement("fieldset");
  8708. try {
  8709. return !!fn( el );
  8710. } catch (e) {
  8711. return false;
  8712. } finally {
  8713. // Remove from its parent by default
  8714. if ( el.parentNode ) {
  8715. el.parentNode.removeChild( el );
  8716. }
  8717. // release memory in IE
  8718. el = null;
  8719. }
  8720. }
  8721. /**
  8722. * Adds the same handler for all of the specified attrs
  8723. * @param {String} attrs Pipe-separated list of attributes
  8724. * @param {Function} handler The method that will be applied
  8725. */
  8726. function addHandle( attrs, handler ) {
  8727. var arr = attrs.split("|"),
  8728. i = arr.length;
  8729. while ( i-- ) {
  8730. Expr.attrHandle[ arr[i] ] = handler;
  8731. }
  8732. }
  8733. /**
  8734. * Checks document order of two siblings
  8735. * @param {Element} a
  8736. * @param {Element} b
  8737. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  8738. */
  8739. function siblingCheck( a, b ) {
  8740. var cur = b && a,
  8741. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  8742. a.sourceIndex - b.sourceIndex;
  8743. // Use IE sourceIndex if available on both nodes
  8744. if ( diff ) {
  8745. return diff;
  8746. }
  8747. // Check if b follows a
  8748. if ( cur ) {
  8749. while ( (cur = cur.nextSibling) ) {
  8750. if ( cur === b ) {
  8751. return -1;
  8752. }
  8753. }
  8754. }
  8755. return a ? 1 : -1;
  8756. }
  8757. /**
  8758. * Returns a function to use in pseudos for input types
  8759. * @param {String} type
  8760. */
  8761. function createInputPseudo( type ) {
  8762. return function( elem ) {
  8763. var name = elem.nodeName.toLowerCase();
  8764. return name === "input" && elem.type === type;
  8765. };
  8766. }
  8767. /**
  8768. * Returns a function to use in pseudos for buttons
  8769. * @param {String} type
  8770. */
  8771. function createButtonPseudo( type ) {
  8772. return function( elem ) {
  8773. var name = elem.nodeName.toLowerCase();
  8774. return (name === "input" || name === "button") && elem.type === type;
  8775. };
  8776. }
  8777. /**
  8778. * Returns a function to use in pseudos for :enabled/:disabled
  8779. * @param {Boolean} disabled true for :disabled; false for :enabled
  8780. */
  8781. function createDisabledPseudo( disabled ) {
  8782. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  8783. return function( elem ) {
  8784. // Only certain elements can match :enabled or :disabled
  8785. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  8786. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  8787. if ( "form" in elem ) {
  8788. // Check for inherited disabledness on relevant non-disabled elements:
  8789. // * listed form-associated elements in a disabled fieldset
  8790. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  8791. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  8792. // * option elements in a disabled optgroup
  8793. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  8794. // All such elements have a "form" property.
  8795. if ( elem.parentNode && elem.disabled === false ) {
  8796. // Option elements defer to a parent optgroup if present
  8797. if ( "label" in elem ) {
  8798. if ( "label" in elem.parentNode ) {
  8799. return elem.parentNode.disabled === disabled;
  8800. } else {
  8801. return elem.disabled === disabled;
  8802. }
  8803. }
  8804. // Support: IE 6 - 11
  8805. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  8806. return elem.isDisabled === disabled ||
  8807. // Where there is no isDisabled, check manually
  8808. /* jshint -W018 */
  8809. elem.isDisabled !== !disabled &&
  8810. inDisabledFieldset( elem ) === disabled;
  8811. }
  8812. return elem.disabled === disabled;
  8813. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  8814. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  8815. // even exist on them, let alone have a boolean value.
  8816. } else if ( "label" in elem ) {
  8817. return elem.disabled === disabled;
  8818. }
  8819. // Remaining elements are neither :enabled nor :disabled
  8820. return false;
  8821. };
  8822. }
  8823. /**
  8824. * Returns a function to use in pseudos for positionals
  8825. * @param {Function} fn
  8826. */
  8827. function createPositionalPseudo( fn ) {
  8828. return markFunction(function( argument ) {
  8829. argument = +argument;
  8830. return markFunction(function( seed, matches ) {
  8831. var j,
  8832. matchIndexes = fn( [], seed.length, argument ),
  8833. i = matchIndexes.length;
  8834. // Match elements found at the specified indexes
  8835. while ( i-- ) {
  8836. if ( seed[ (j = matchIndexes[i]) ] ) {
  8837. seed[j] = !(matches[j] = seed[j]);
  8838. }
  8839. }
  8840. });
  8841. });
  8842. }
  8843. /**
  8844. * Checks a node for validity as a Sizzle context
  8845. * @param {Element|Object=} context
  8846. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  8847. */
  8848. function testContext( context ) {
  8849. return context && typeof context.getElementsByTagName !== "undefined" && context;
  8850. }
  8851. // Expose support vars for convenience
  8852. support = Sizzle.support = {};
  8853. /**
  8854. * Detects XML nodes
  8855. * @param {Element|Object} elem An element or a document
  8856. * @returns {Boolean} True iff elem is a non-HTML XML node
  8857. */
  8858. isXML = Sizzle.isXML = function( elem ) {
  8859. var namespace = elem.namespaceURI,
  8860. docElem = (elem.ownerDocument || elem).documentElement;
  8861. // Support: IE <=8
  8862. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  8863. // https://bugs.jquery.com/ticket/4833
  8864. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  8865. };
  8866. /**
  8867. * Sets document-related variables once based on the current document
  8868. * @param {Element|Object} [doc] An element or document object to use to set the document
  8869. * @returns {Object} Returns the current document
  8870. */
  8871. setDocument = Sizzle.setDocument = function( node ) {
  8872. var hasCompare, subWindow,
  8873. doc = node ? node.ownerDocument || node : preferredDoc;
  8874. // Return early if doc is invalid or already selected
  8875. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  8876. return document;
  8877. }
  8878. // Update global variables
  8879. document = doc;
  8880. docElem = document.documentElement;
  8881. documentIsHTML = !isXML( document );
  8882. // Support: IE 9-11, Edge
  8883. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  8884. if ( preferredDoc !== document &&
  8885. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  8886. // Support: IE 11, Edge
  8887. if ( subWindow.addEventListener ) {
  8888. subWindow.addEventListener( "unload", unloadHandler, false );
  8889. // Support: IE 9 - 10 only
  8890. } else if ( subWindow.attachEvent ) {
  8891. subWindow.attachEvent( "onunload", unloadHandler );
  8892. }
  8893. }
  8894. /* Attributes
  8895. ---------------------------------------------------------------------- */
  8896. // Support: IE<8
  8897. // Verify that getAttribute really returns attributes and not properties
  8898. // (excepting IE8 booleans)
  8899. support.attributes = assert(function( el ) {
  8900. el.className = "i";
  8901. return !el.getAttribute("className");
  8902. });
  8903. /* getElement(s)By*
  8904. ---------------------------------------------------------------------- */
  8905. // Check if getElementsByTagName("*") returns only elements
  8906. support.getElementsByTagName = assert(function( el ) {
  8907. el.appendChild( document.createComment("") );
  8908. return !el.getElementsByTagName("*").length;
  8909. });
  8910. // Support: IE<9
  8911. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  8912. // Support: IE<10
  8913. // Check if getElementById returns elements by name
  8914. // The broken getElementById methods don't pick up programmatically-set names,
  8915. // so use a roundabout getElementsByName test
  8916. support.getById = assert(function( el ) {
  8917. docElem.appendChild( el ).id = expando;
  8918. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  8919. });
  8920. // ID filter and find
  8921. if ( support.getById ) {
  8922. Expr.filter["ID"] = function( id ) {
  8923. var attrId = id.replace( runescape, funescape );
  8924. return function( elem ) {
  8925. return elem.getAttribute("id") === attrId;
  8926. };
  8927. };
  8928. Expr.find["ID"] = function( id, context ) {
  8929. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  8930. var elem = context.getElementById( id );
  8931. return elem ? [ elem ] : [];
  8932. }
  8933. };
  8934. } else {
  8935. Expr.filter["ID"] = function( id ) {
  8936. var attrId = id.replace( runescape, funescape );
  8937. return function( elem ) {
  8938. var node = typeof elem.getAttributeNode !== "undefined" &&
  8939. elem.getAttributeNode("id");
  8940. return node && node.value === attrId;
  8941. };
  8942. };
  8943. // Support: IE 6 - 7 only
  8944. // getElementById is not reliable as a find shortcut
  8945. Expr.find["ID"] = function( id, context ) {
  8946. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  8947. var node, i, elems,
  8948. elem = context.getElementById( id );
  8949. if ( elem ) {
  8950. // Verify the id attribute
  8951. node = elem.getAttributeNode("id");
  8952. if ( node && node.value === id ) {
  8953. return [ elem ];
  8954. }
  8955. // Fall back on getElementsByName
  8956. elems = context.getElementsByName( id );
  8957. i = 0;
  8958. while ( (elem = elems[i++]) ) {
  8959. node = elem.getAttributeNode("id");
  8960. if ( node && node.value === id ) {
  8961. return [ elem ];
  8962. }
  8963. }
  8964. }
  8965. return [];
  8966. }
  8967. };
  8968. }
  8969. // Tag
  8970. Expr.find["TAG"] = support.getElementsByTagName ?
  8971. function( tag, context ) {
  8972. if ( typeof context.getElementsByTagName !== "undefined" ) {
  8973. return context.getElementsByTagName( tag );
  8974. // DocumentFragment nodes don't have gEBTN
  8975. } else if ( support.qsa ) {
  8976. return context.querySelectorAll( tag );
  8977. }
  8978. } :
  8979. function( tag, context ) {
  8980. var elem,
  8981. tmp = [],
  8982. i = 0,
  8983. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  8984. results = context.getElementsByTagName( tag );
  8985. // Filter out possible comments
  8986. if ( tag === "*" ) {
  8987. while ( (elem = results[i++]) ) {
  8988. if ( elem.nodeType === 1 ) {
  8989. tmp.push( elem );
  8990. }
  8991. }
  8992. return tmp;
  8993. }
  8994. return results;
  8995. };
  8996. // Class
  8997. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  8998. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  8999. return context.getElementsByClassName( className );
  9000. }
  9001. };
  9002. /* QSA/matchesSelector
  9003. ---------------------------------------------------------------------- */
  9004. // QSA and matchesSelector support
  9005. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9006. rbuggyMatches = [];
  9007. // qSa(:focus) reports false when true (Chrome 21)
  9008. // We allow this because of a bug in IE8/9 that throws an error
  9009. // whenever `document.activeElement` is accessed on an iframe
  9010. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9011. // See https://bugs.jquery.com/ticket/13378
  9012. rbuggyQSA = [];
  9013. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9014. // Build QSA regex
  9015. // Regex strategy adopted from Diego Perini
  9016. assert(function( el ) {
  9017. // Select is set to empty string on purpose
  9018. // This is to test IE's treatment of not explicitly
  9019. // setting a boolean content attribute,
  9020. // since its presence should be enough
  9021. // https://bugs.jquery.com/ticket/12359
  9022. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9023. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9024. "<option selected=''></option></select>";
  9025. // Support: IE8, Opera 11-12.16
  9026. // Nothing should be selected when empty strings follow ^= or $= or *=
  9027. // The test attribute must be unknown in Opera but "safe" for WinRT
  9028. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9029. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9030. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9031. }
  9032. // Support: IE8
  9033. // Boolean attributes and "value" are not treated correctly
  9034. if ( !el.querySelectorAll("[selected]").length ) {
  9035. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9036. }
  9037. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9038. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9039. rbuggyQSA.push("~=");
  9040. }
  9041. // Webkit/Opera - :checked should return selected option elements
  9042. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9043. // IE8 throws error here and will not see later tests
  9044. if ( !el.querySelectorAll(":checked").length ) {
  9045. rbuggyQSA.push(":checked");
  9046. }
  9047. // Support: Safari 8+, iOS 8+
  9048. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9049. // In-page `selector#id sibling-combinator selector` fails
  9050. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9051. rbuggyQSA.push(".#.+[+~]");
  9052. }
  9053. });
  9054. assert(function( el ) {
  9055. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9056. "<select disabled='disabled'><option/></select>";
  9057. // Support: Windows 8 Native Apps
  9058. // The type and name attributes are restricted during .innerHTML assignment
  9059. var input = document.createElement("input");
  9060. input.setAttribute( "type", "hidden" );
  9061. el.appendChild( input ).setAttribute( "name", "D" );
  9062. // Support: IE8
  9063. // Enforce case-sensitivity of name attribute
  9064. if ( el.querySelectorAll("[name=d]").length ) {
  9065. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9066. }
  9067. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9068. // IE8 throws error here and will not see later tests
  9069. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9070. rbuggyQSA.push( ":enabled", ":disabled" );
  9071. }
  9072. // Support: IE9-11+
  9073. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9074. docElem.appendChild( el ).disabled = true;
  9075. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9076. rbuggyQSA.push( ":enabled", ":disabled" );
  9077. }
  9078. // Opera 10-11 does not throw on post-comma invalid pseudos
  9079. el.querySelectorAll("*,:x");
  9080. rbuggyQSA.push(",.*:");
  9081. });
  9082. }
  9083. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9084. docElem.webkitMatchesSelector ||
  9085. docElem.mozMatchesSelector ||
  9086. docElem.oMatchesSelector ||
  9087. docElem.msMatchesSelector) )) ) {
  9088. assert(function( el ) {
  9089. // Check to see if it's possible to do matchesSelector
  9090. // on a disconnected node (IE 9)
  9091. support.disconnectedMatch = matches.call( el, "*" );
  9092. // This should fail with an exception
  9093. // Gecko does not error, returns false instead
  9094. matches.call( el, "[s!='']:x" );
  9095. rbuggyMatches.push( "!=", pseudos );
  9096. });
  9097. }
  9098. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9099. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9100. /* Contains
  9101. ---------------------------------------------------------------------- */
  9102. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9103. // Element contains another
  9104. // Purposefully self-exclusive
  9105. // As in, an element does not contain itself
  9106. contains = hasCompare || rnative.test( docElem.contains ) ?
  9107. function( a, b ) {
  9108. var adown = a.nodeType === 9 ? a.documentElement : a,
  9109. bup = b && b.parentNode;
  9110. return a === bup || !!( bup && bup.nodeType === 1 && (
  9111. adown.contains ?
  9112. adown.contains( bup ) :
  9113. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9114. ));
  9115. } :
  9116. function( a, b ) {
  9117. if ( b ) {
  9118. while ( (b = b.parentNode) ) {
  9119. if ( b === a ) {
  9120. return true;
  9121. }
  9122. }
  9123. }
  9124. return false;
  9125. };
  9126. /* Sorting
  9127. ---------------------------------------------------------------------- */
  9128. // Document order sorting
  9129. sortOrder = hasCompare ?
  9130. function( a, b ) {
  9131. // Flag for duplicate removal
  9132. if ( a === b ) {
  9133. hasDuplicate = true;
  9134. return 0;
  9135. }
  9136. // Sort on method existence if only one input has compareDocumentPosition
  9137. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9138. if ( compare ) {
  9139. return compare;
  9140. }
  9141. // Calculate position if both inputs belong to the same document
  9142. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9143. a.compareDocumentPosition( b ) :
  9144. // Otherwise we know they are disconnected
  9145. 1;
  9146. // Disconnected nodes
  9147. if ( compare & 1 ||
  9148. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9149. // Choose the first element that is related to our preferred document
  9150. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9151. return -1;
  9152. }
  9153. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9154. return 1;
  9155. }
  9156. // Maintain original order
  9157. return sortInput ?
  9158. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9159. 0;
  9160. }
  9161. return compare & 4 ? -1 : 1;
  9162. } :
  9163. function( a, b ) {
  9164. // Exit early if the nodes are identical
  9165. if ( a === b ) {
  9166. hasDuplicate = true;
  9167. return 0;
  9168. }
  9169. var cur,
  9170. i = 0,
  9171. aup = a.parentNode,
  9172. bup = b.parentNode,
  9173. ap = [ a ],
  9174. bp = [ b ];
  9175. // Parentless nodes are either documents or disconnected
  9176. if ( !aup || !bup ) {
  9177. return a === document ? -1 :
  9178. b === document ? 1 :
  9179. aup ? -1 :
  9180. bup ? 1 :
  9181. sortInput ?
  9182. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9183. 0;
  9184. // If the nodes are siblings, we can do a quick check
  9185. } else if ( aup === bup ) {
  9186. return siblingCheck( a, b );
  9187. }
  9188. // Otherwise we need full lists of their ancestors for comparison
  9189. cur = a;
  9190. while ( (cur = cur.parentNode) ) {
  9191. ap.unshift( cur );
  9192. }
  9193. cur = b;
  9194. while ( (cur = cur.parentNode) ) {
  9195. bp.unshift( cur );
  9196. }
  9197. // Walk down the tree looking for a discrepancy
  9198. while ( ap[i] === bp[i] ) {
  9199. i++;
  9200. }
  9201. return i ?
  9202. // Do a sibling check if the nodes have a common ancestor
  9203. siblingCheck( ap[i], bp[i] ) :
  9204. // Otherwise nodes in our document sort first
  9205. ap[i] === preferredDoc ? -1 :
  9206. bp[i] === preferredDoc ? 1 :
  9207. 0;
  9208. };
  9209. return document;
  9210. };
  9211. Sizzle.matches = function( expr, elements ) {
  9212. return Sizzle( expr, null, null, elements );
  9213. };
  9214. Sizzle.matchesSelector = function( elem, expr ) {
  9215. // Set document vars if needed
  9216. if ( ( elem.ownerDocument || elem ) !== document ) {
  9217. setDocument( elem );
  9218. }
  9219. if ( support.matchesSelector && documentIsHTML &&
  9220. !nonnativeSelectorCache[ expr + " " ] &&
  9221. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9222. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9223. try {
  9224. var ret = matches.call( elem, expr );
  9225. // IE 9's matchesSelector returns false on disconnected nodes
  9226. if ( ret || support.disconnectedMatch ||
  9227. // As well, disconnected nodes are said to be in a document
  9228. // fragment in IE 9
  9229. elem.document && elem.document.nodeType !== 11 ) {
  9230. return ret;
  9231. }
  9232. } catch (e) {
  9233. nonnativeSelectorCache( expr, true );
  9234. }
  9235. }
  9236. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9237. };
  9238. Sizzle.contains = function( context, elem ) {
  9239. // Set document vars if needed
  9240. if ( ( context.ownerDocument || context ) !== document ) {
  9241. setDocument( context );
  9242. }
  9243. return contains( context, elem );
  9244. };
  9245. Sizzle.attr = function( elem, name ) {
  9246. // Set document vars if needed
  9247. if ( ( elem.ownerDocument || elem ) !== document ) {
  9248. setDocument( elem );
  9249. }
  9250. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9251. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9252. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9253. fn( elem, name, !documentIsHTML ) :
  9254. undefined;
  9255. return val !== undefined ?
  9256. val :
  9257. support.attributes || !documentIsHTML ?
  9258. elem.getAttribute( name ) :
  9259. (val = elem.getAttributeNode(name)) && val.specified ?
  9260. val.value :
  9261. null;
  9262. };
  9263. Sizzle.escape = function( sel ) {
  9264. return (sel + "").replace( rcssescape, fcssescape );
  9265. };
  9266. Sizzle.error = function( msg ) {
  9267. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9268. };
  9269. /**
  9270. * Document sorting and removing duplicates
  9271. * @param {ArrayLike} results
  9272. */
  9273. Sizzle.uniqueSort = function( results ) {
  9274. var elem,
  9275. duplicates = [],
  9276. j = 0,
  9277. i = 0;
  9278. // Unless we *know* we can detect duplicates, assume their presence
  9279. hasDuplicate = !support.detectDuplicates;
  9280. sortInput = !support.sortStable && results.slice( 0 );
  9281. results.sort( sortOrder );
  9282. if ( hasDuplicate ) {
  9283. while ( (elem = results[i++]) ) {
  9284. if ( elem === results[ i ] ) {
  9285. j = duplicates.push( i );
  9286. }
  9287. }
  9288. while ( j-- ) {
  9289. results.splice( duplicates[ j ], 1 );
  9290. }
  9291. }
  9292. // Clear input after sorting to release objects
  9293. // See https://github.com/jquery/sizzle/pull/225
  9294. sortInput = null;
  9295. return results;
  9296. };
  9297. /**
  9298. * Utility function for retrieving the text value of an array of DOM nodes
  9299. * @param {Array|Element} elem
  9300. */
  9301. getText = Sizzle.getText = function( elem ) {
  9302. var node,
  9303. ret = "",
  9304. i = 0,
  9305. nodeType = elem.nodeType;
  9306. if ( !nodeType ) {
  9307. // If no nodeType, this is expected to be an array
  9308. while ( (node = elem[i++]) ) {
  9309. // Do not traverse comment nodes
  9310. ret += getText( node );
  9311. }
  9312. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9313. // Use textContent for elements
  9314. // innerText usage removed for consistency of new lines (jQuery #11153)
  9315. if ( typeof elem.textContent === "string" ) {
  9316. return elem.textContent;
  9317. } else {
  9318. // Traverse its children
  9319. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9320. ret += getText( elem );
  9321. }
  9322. }
  9323. } else if ( nodeType === 3 || nodeType === 4 ) {
  9324. return elem.nodeValue;
  9325. }
  9326. // Do not include comment or processing instruction nodes
  9327. return ret;
  9328. };
  9329. Expr = Sizzle.selectors = {
  9330. // Can be adjusted by the user
  9331. cacheLength: 50,
  9332. createPseudo: markFunction,
  9333. match: matchExpr,
  9334. attrHandle: {},
  9335. find: {},
  9336. relative: {
  9337. ">": { dir: "parentNode", first: true },
  9338. " ": { dir: "parentNode" },
  9339. "+": { dir: "previousSibling", first: true },
  9340. "~": { dir: "previousSibling" }
  9341. },
  9342. preFilter: {
  9343. "ATTR": function( match ) {
  9344. match[1] = match[1].replace( runescape, funescape );
  9345. // Move the given value to match[3] whether quoted or unquoted
  9346. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9347. if ( match[2] === "~=" ) {
  9348. match[3] = " " + match[3] + " ";
  9349. }
  9350. return match.slice( 0, 4 );
  9351. },
  9352. "CHILD": function( match ) {
  9353. /* matches from matchExpr["CHILD"]
  9354. 1 type (only|nth|...)
  9355. 2 what (child|of-type)
  9356. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9357. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9358. 5 sign of xn-component
  9359. 6 x of xn-component
  9360. 7 sign of y-component
  9361. 8 y of y-component
  9362. */
  9363. match[1] = match[1].toLowerCase();
  9364. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9365. // nth-* requires argument
  9366. if ( !match[3] ) {
  9367. Sizzle.error( match[0] );
  9368. }
  9369. // numeric x and y parameters for Expr.filter.CHILD
  9370. // remember that false/true cast respectively to 0/1
  9371. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9372. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9373. // other types prohibit arguments
  9374. } else if ( match[3] ) {
  9375. Sizzle.error( match[0] );
  9376. }
  9377. return match;
  9378. },
  9379. "PSEUDO": function( match ) {
  9380. var excess,
  9381. unquoted = !match[6] && match[2];
  9382. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9383. return null;
  9384. }
  9385. // Accept quoted arguments as-is
  9386. if ( match[3] ) {
  9387. match[2] = match[4] || match[5] || "";
  9388. // Strip excess characters from unquoted arguments
  9389. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9390. // Get excess from tokenize (recursively)
  9391. (excess = tokenize( unquoted, true )) &&
  9392. // advance to the next closing parenthesis
  9393. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9394. // excess is a negative index
  9395. match[0] = match[0].slice( 0, excess );
  9396. match[2] = unquoted.slice( 0, excess );
  9397. }
  9398. // Return only captures needed by the pseudo filter method (type and argument)
  9399. return match.slice( 0, 3 );
  9400. }
  9401. },
  9402. filter: {
  9403. "TAG": function( nodeNameSelector ) {
  9404. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9405. return nodeNameSelector === "*" ?
  9406. function() { return true; } :
  9407. function( elem ) {
  9408. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9409. };
  9410. },
  9411. "CLASS": function( className ) {
  9412. var pattern = classCache[ className + " " ];
  9413. return pattern ||
  9414. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9415. classCache( className, function( elem ) {
  9416. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9417. });
  9418. },
  9419. "ATTR": function( name, operator, check ) {
  9420. return function( elem ) {
  9421. var result = Sizzle.attr( elem, name );
  9422. if ( result == null ) {
  9423. return operator === "!=";
  9424. }
  9425. if ( !operator ) {
  9426. return true;
  9427. }
  9428. result += "";
  9429. return operator === "=" ? result === check :
  9430. operator === "!=" ? result !== check :
  9431. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9432. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9433. operator === "$=" ? check && result.slice( -check.length ) === check :
  9434. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9435. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9436. false;
  9437. };
  9438. },
  9439. "CHILD": function( type, what, argument, first, last ) {
  9440. var simple = type.slice( 0, 3 ) !== "nth",
  9441. forward = type.slice( -4 ) !== "last",
  9442. ofType = what === "of-type";
  9443. return first === 1 && last === 0 ?
  9444. // Shortcut for :nth-*(n)
  9445. function( elem ) {
  9446. return !!elem.parentNode;
  9447. } :
  9448. function( elem, context, xml ) {
  9449. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9450. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9451. parent = elem.parentNode,
  9452. name = ofType && elem.nodeName.toLowerCase(),
  9453. useCache = !xml && !ofType,
  9454. diff = false;
  9455. if ( parent ) {
  9456. // :(first|last|only)-(child|of-type)
  9457. if ( simple ) {
  9458. while ( dir ) {
  9459. node = elem;
  9460. while ( (node = node[ dir ]) ) {
  9461. if ( ofType ?
  9462. node.nodeName.toLowerCase() === name :
  9463. node.nodeType === 1 ) {
  9464. return false;
  9465. }
  9466. }
  9467. // Reverse direction for :only-* (if we haven't yet done so)
  9468. start = dir = type === "only" && !start && "nextSibling";
  9469. }
  9470. return true;
  9471. }
  9472. start = [ forward ? parent.firstChild : parent.lastChild ];
  9473. // non-xml :nth-child(...) stores cache data on `parent`
  9474. if ( forward && useCache ) {
  9475. // Seek `elem` from a previously-cached index
  9476. // ...in a gzip-friendly way
  9477. node = parent;
  9478. outerCache = node[ expando ] || (node[ expando ] = {});
  9479. // Support: IE <9 only
  9480. // Defend against cloned attroperties (jQuery gh-1709)
  9481. uniqueCache = outerCache[ node.uniqueID ] ||
  9482. (outerCache[ node.uniqueID ] = {});
  9483. cache = uniqueCache[ type ] || [];
  9484. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9485. diff = nodeIndex && cache[ 2 ];
  9486. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9487. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9488. // Fallback to seeking `elem` from the start
  9489. (diff = nodeIndex = 0) || start.pop()) ) {
  9490. // When found, cache indexes on `parent` and break
  9491. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9492. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9493. break;
  9494. }
  9495. }
  9496. } else {
  9497. // Use previously-cached element index if available
  9498. if ( useCache ) {
  9499. // ...in a gzip-friendly way
  9500. node = elem;
  9501. outerCache = node[ expando ] || (node[ expando ] = {});
  9502. // Support: IE <9 only
  9503. // Defend against cloned attroperties (jQuery gh-1709)
  9504. uniqueCache = outerCache[ node.uniqueID ] ||
  9505. (outerCache[ node.uniqueID ] = {});
  9506. cache = uniqueCache[ type ] || [];
  9507. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9508. diff = nodeIndex;
  9509. }
  9510. // xml :nth-child(...)
  9511. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9512. if ( diff === false ) {
  9513. // Use the same loop as above to seek `elem` from the start
  9514. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9515. (diff = nodeIndex = 0) || start.pop()) ) {
  9516. if ( ( ofType ?
  9517. node.nodeName.toLowerCase() === name :
  9518. node.nodeType === 1 ) &&
  9519. ++diff ) {
  9520. // Cache the index of each encountered element
  9521. if ( useCache ) {
  9522. outerCache = node[ expando ] || (node[ expando ] = {});
  9523. // Support: IE <9 only
  9524. // Defend against cloned attroperties (jQuery gh-1709)
  9525. uniqueCache = outerCache[ node.uniqueID ] ||
  9526. (outerCache[ node.uniqueID ] = {});
  9527. uniqueCache[ type ] = [ dirruns, diff ];
  9528. }
  9529. if ( node === elem ) {
  9530. break;
  9531. }
  9532. }
  9533. }
  9534. }
  9535. }
  9536. // Incorporate the offset, then check against cycle size
  9537. diff -= last;
  9538. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9539. }
  9540. };
  9541. },
  9542. "PSEUDO": function( pseudo, argument ) {
  9543. // pseudo-class names are case-insensitive
  9544. // http://www.w3.org/TR/selectors/#pseudo-classes
  9545. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9546. // Remember that setFilters inherits from pseudos
  9547. var args,
  9548. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9549. Sizzle.error( "unsupported pseudo: " + pseudo );
  9550. // The user may use createPseudo to indicate that
  9551. // arguments are needed to create the filter function
  9552. // just as Sizzle does
  9553. if ( fn[ expando ] ) {
  9554. return fn( argument );
  9555. }
  9556. // But maintain support for old signatures
  9557. if ( fn.length > 1 ) {
  9558. args = [ pseudo, pseudo, "", argument ];
  9559. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9560. markFunction(function( seed, matches ) {
  9561. var idx,
  9562. matched = fn( seed, argument ),
  9563. i = matched.length;
  9564. while ( i-- ) {
  9565. idx = indexOf( seed, matched[i] );
  9566. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9567. }
  9568. }) :
  9569. function( elem ) {
  9570. return fn( elem, 0, args );
  9571. };
  9572. }
  9573. return fn;
  9574. }
  9575. },
  9576. pseudos: {
  9577. // Potentially complex pseudos
  9578. "not": markFunction(function( selector ) {
  9579. // Trim the selector passed to compile
  9580. // to avoid treating leading and trailing
  9581. // spaces as combinators
  9582. var input = [],
  9583. results = [],
  9584. matcher = compile( selector.replace( rtrim, "$1" ) );
  9585. return matcher[ expando ] ?
  9586. markFunction(function( seed, matches, context, xml ) {
  9587. var elem,
  9588. unmatched = matcher( seed, null, xml, [] ),
  9589. i = seed.length;
  9590. // Match elements unmatched by `matcher`
  9591. while ( i-- ) {
  9592. if ( (elem = unmatched[i]) ) {
  9593. seed[i] = !(matches[i] = elem);
  9594. }
  9595. }
  9596. }) :
  9597. function( elem, context, xml ) {
  9598. input[0] = elem;
  9599. matcher( input, null, xml, results );
  9600. // Don't keep the element (issue #299)
  9601. input[0] = null;
  9602. return !results.pop();
  9603. };
  9604. }),
  9605. "has": markFunction(function( selector ) {
  9606. return function( elem ) {
  9607. return Sizzle( selector, elem ).length > 0;
  9608. };
  9609. }),
  9610. "contains": markFunction(function( text ) {
  9611. text = text.replace( runescape, funescape );
  9612. return function( elem ) {
  9613. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9614. };
  9615. }),
  9616. // "Whether an element is represented by a :lang() selector
  9617. // is based solely on the element's language value
  9618. // being equal to the identifier C,
  9619. // or beginning with the identifier C immediately followed by "-".
  9620. // The matching of C against the element's language value is performed case-insensitively.
  9621. // The identifier C does not have to be a valid language name."
  9622. // http://www.w3.org/TR/selectors/#lang-pseudo
  9623. "lang": markFunction( function( lang ) {
  9624. // lang value must be a valid identifier
  9625. if ( !ridentifier.test(lang || "") ) {
  9626. Sizzle.error( "unsupported lang: " + lang );
  9627. }
  9628. lang = lang.replace( runescape, funescape ).toLowerCase();
  9629. return function( elem ) {
  9630. var elemLang;
  9631. do {
  9632. if ( (elemLang = documentIsHTML ?
  9633. elem.lang :
  9634. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9635. elemLang = elemLang.toLowerCase();
  9636. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9637. }
  9638. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9639. return false;
  9640. };
  9641. }),
  9642. // Miscellaneous
  9643. "target": function( elem ) {
  9644. var hash = window.location && window.location.hash;
  9645. return hash && hash.slice( 1 ) === elem.id;
  9646. },
  9647. "root": function( elem ) {
  9648. return elem === docElem;
  9649. },
  9650. "focus": function( elem ) {
  9651. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9652. },
  9653. // Boolean properties
  9654. "enabled": createDisabledPseudo( false ),
  9655. "disabled": createDisabledPseudo( true ),
  9656. "checked": function( elem ) {
  9657. // In CSS3, :checked should return both checked and selected elements
  9658. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9659. var nodeName = elem.nodeName.toLowerCase();
  9660. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9661. },
  9662. "selected": function( elem ) {
  9663. // Accessing this property makes selected-by-default
  9664. // options in Safari work properly
  9665. if ( elem.parentNode ) {
  9666. elem.parentNode.selectedIndex;
  9667. }
  9668. return elem.selected === true;
  9669. },
  9670. // Contents
  9671. "empty": function( elem ) {
  9672. // http://www.w3.org/TR/selectors/#empty-pseudo
  9673. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9674. // but not by others (comment: 8; processing instruction: 7; etc.)
  9675. // nodeType < 6 works because attributes (2) do not appear as children
  9676. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9677. if ( elem.nodeType < 6 ) {
  9678. return false;
  9679. }
  9680. }
  9681. return true;
  9682. },
  9683. "parent": function( elem ) {
  9684. return !Expr.pseudos["empty"]( elem );
  9685. },
  9686. // Element/input types
  9687. "header": function( elem ) {
  9688. return rheader.test( elem.nodeName );
  9689. },
  9690. "input": function( elem ) {
  9691. return rinputs.test( elem.nodeName );
  9692. },
  9693. "button": function( elem ) {
  9694. var name = elem.nodeName.toLowerCase();
  9695. return name === "input" && elem.type === "button" || name === "button";
  9696. },
  9697. "text": function( elem ) {
  9698. var attr;
  9699. return elem.nodeName.toLowerCase() === "input" &&
  9700. elem.type === "text" &&
  9701. // Support: IE<8
  9702. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9703. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9704. },
  9705. // Position-in-collection
  9706. "first": createPositionalPseudo(function() {
  9707. return [ 0 ];
  9708. }),
  9709. "last": createPositionalPseudo(function( matchIndexes, length ) {
  9710. return [ length - 1 ];
  9711. }),
  9712. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9713. return [ argument < 0 ? argument + length : argument ];
  9714. }),
  9715. "even": createPositionalPseudo(function( matchIndexes, length ) {
  9716. var i = 0;
  9717. for ( ; i < length; i += 2 ) {
  9718. matchIndexes.push( i );
  9719. }
  9720. return matchIndexes;
  9721. }),
  9722. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  9723. var i = 1;
  9724. for ( ; i < length; i += 2 ) {
  9725. matchIndexes.push( i );
  9726. }
  9727. return matchIndexes;
  9728. }),
  9729. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9730. var i = argument < 0 ?
  9731. argument + length :
  9732. argument > length ?
  9733. length :
  9734. argument;
  9735. for ( ; --i >= 0; ) {
  9736. matchIndexes.push( i );
  9737. }
  9738. return matchIndexes;
  9739. }),
  9740. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9741. var i = argument < 0 ? argument + length : argument;
  9742. for ( ; ++i < length; ) {
  9743. matchIndexes.push( i );
  9744. }
  9745. return matchIndexes;
  9746. })
  9747. }
  9748. };
  9749. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  9750. // Add button/input type pseudos
  9751. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  9752. Expr.pseudos[ i ] = createInputPseudo( i );
  9753. }
  9754. for ( i in { submit: true, reset: true } ) {
  9755. Expr.pseudos[ i ] = createButtonPseudo( i );
  9756. }
  9757. // Easy API for creating new setFilters
  9758. function setFilters() {}
  9759. setFilters.prototype = Expr.filters = Expr.pseudos;
  9760. Expr.setFilters = new setFilters();
  9761. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  9762. var matched, match, tokens, type,
  9763. soFar, groups, preFilters,
  9764. cached = tokenCache[ selector + " " ];
  9765. if ( cached ) {
  9766. return parseOnly ? 0 : cached.slice( 0 );
  9767. }
  9768. soFar = selector;
  9769. groups = [];
  9770. preFilters = Expr.preFilter;
  9771. while ( soFar ) {
  9772. // Comma and first run
  9773. if ( !matched || (match = rcomma.exec( soFar )) ) {
  9774. if ( match ) {
  9775. // Don't consume trailing commas as valid
  9776. soFar = soFar.slice( match[0].length ) || soFar;
  9777. }
  9778. groups.push( (tokens = []) );
  9779. }
  9780. matched = false;
  9781. // Combinators
  9782. if ( (match = rcombinators.exec( soFar )) ) {
  9783. matched = match.shift();
  9784. tokens.push({
  9785. value: matched,
  9786. // Cast descendant combinators to space
  9787. type: match[0].replace( rtrim, " " )
  9788. });
  9789. soFar = soFar.slice( matched.length );
  9790. }
  9791. // Filters
  9792. for ( type in Expr.filter ) {
  9793. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  9794. (match = preFilters[ type ]( match ))) ) {
  9795. matched = match.shift();
  9796. tokens.push({
  9797. value: matched,
  9798. type: type,
  9799. matches: match
  9800. });
  9801. soFar = soFar.slice( matched.length );
  9802. }
  9803. }
  9804. if ( !matched ) {
  9805. break;
  9806. }
  9807. }
  9808. // Return the length of the invalid excess
  9809. // if we're just parsing
  9810. // Otherwise, throw an error or return tokens
  9811. return parseOnly ?
  9812. soFar.length :
  9813. soFar ?
  9814. Sizzle.error( selector ) :
  9815. // Cache the tokens
  9816. tokenCache( selector, groups ).slice( 0 );
  9817. };
  9818. function toSelector( tokens ) {
  9819. var i = 0,
  9820. len = tokens.length,
  9821. selector = "";
  9822. for ( ; i < len; i++ ) {
  9823. selector += tokens[i].value;
  9824. }
  9825. return selector;
  9826. }
  9827. function addCombinator( matcher, combinator, base ) {
  9828. var dir = combinator.dir,
  9829. skip = combinator.next,
  9830. key = skip || dir,
  9831. checkNonElements = base && key === "parentNode",
  9832. doneName = done++;
  9833. return combinator.first ?
  9834. // Check against closest ancestor/preceding element
  9835. function( elem, context, xml ) {
  9836. while ( (elem = elem[ dir ]) ) {
  9837. if ( elem.nodeType === 1 || checkNonElements ) {
  9838. return matcher( elem, context, xml );
  9839. }
  9840. }
  9841. return false;
  9842. } :
  9843. // Check against all ancestor/preceding elements
  9844. function( elem, context, xml ) {
  9845. var oldCache, uniqueCache, outerCache,
  9846. newCache = [ dirruns, doneName ];
  9847. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  9848. if ( xml ) {
  9849. while ( (elem = elem[ dir ]) ) {
  9850. if ( elem.nodeType === 1 || checkNonElements ) {
  9851. if ( matcher( elem, context, xml ) ) {
  9852. return true;
  9853. }
  9854. }
  9855. }
  9856. } else {
  9857. while ( (elem = elem[ dir ]) ) {
  9858. if ( elem.nodeType === 1 || checkNonElements ) {
  9859. outerCache = elem[ expando ] || (elem[ expando ] = {});
  9860. // Support: IE <9 only
  9861. // Defend against cloned attroperties (jQuery gh-1709)
  9862. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  9863. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  9864. elem = elem[ dir ] || elem;
  9865. } else if ( (oldCache = uniqueCache[ key ]) &&
  9866. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  9867. // Assign to newCache so results back-propagate to previous elements
  9868. return (newCache[ 2 ] = oldCache[ 2 ]);
  9869. } else {
  9870. // Reuse newcache so results back-propagate to previous elements
  9871. uniqueCache[ key ] = newCache;
  9872. // A match means we're done; a fail means we have to keep checking
  9873. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  9874. return true;
  9875. }
  9876. }
  9877. }
  9878. }
  9879. }
  9880. return false;
  9881. };
  9882. }
  9883. function elementMatcher( matchers ) {
  9884. return matchers.length > 1 ?
  9885. function( elem, context, xml ) {
  9886. var i = matchers.length;
  9887. while ( i-- ) {
  9888. if ( !matchers[i]( elem, context, xml ) ) {
  9889. return false;
  9890. }
  9891. }
  9892. return true;
  9893. } :
  9894. matchers[0];
  9895. }
  9896. function multipleContexts( selector, contexts, results ) {
  9897. var i = 0,
  9898. len = contexts.length;
  9899. for ( ; i < len; i++ ) {
  9900. Sizzle( selector, contexts[i], results );
  9901. }
  9902. return results;
  9903. }
  9904. function condense( unmatched, map, filter, context, xml ) {
  9905. var elem,
  9906. newUnmatched = [],
  9907. i = 0,
  9908. len = unmatched.length,
  9909. mapped = map != null;
  9910. for ( ; i < len; i++ ) {
  9911. if ( (elem = unmatched[i]) ) {
  9912. if ( !filter || filter( elem, context, xml ) ) {
  9913. newUnmatched.push( elem );
  9914. if ( mapped ) {
  9915. map.push( i );
  9916. }
  9917. }
  9918. }
  9919. }
  9920. return newUnmatched;
  9921. }
  9922. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  9923. if ( postFilter && !postFilter[ expando ] ) {
  9924. postFilter = setMatcher( postFilter );
  9925. }
  9926. if ( postFinder && !postFinder[ expando ] ) {
  9927. postFinder = setMatcher( postFinder, postSelector );
  9928. }
  9929. return markFunction(function( seed, results, context, xml ) {
  9930. var temp, i, elem,
  9931. preMap = [],
  9932. postMap = [],
  9933. preexisting = results.length,
  9934. // Get initial elements from seed or context
  9935. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  9936. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  9937. matcherIn = preFilter && ( seed || !selector ) ?
  9938. condense( elems, preMap, preFilter, context, xml ) :
  9939. elems,
  9940. matcherOut = matcher ?
  9941. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  9942. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  9943. // ...intermediate processing is necessary
  9944. [] :
  9945. // ...otherwise use results directly
  9946. results :
  9947. matcherIn;
  9948. // Find primary matches
  9949. if ( matcher ) {
  9950. matcher( matcherIn, matcherOut, context, xml );
  9951. }
  9952. // Apply postFilter
  9953. if ( postFilter ) {
  9954. temp = condense( matcherOut, postMap );
  9955. postFilter( temp, [], context, xml );
  9956. // Un-match failing elements by moving them back to matcherIn
  9957. i = temp.length;
  9958. while ( i-- ) {
  9959. if ( (elem = temp[i]) ) {
  9960. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  9961. }
  9962. }
  9963. }
  9964. if ( seed ) {
  9965. if ( postFinder || preFilter ) {
  9966. if ( postFinder ) {
  9967. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  9968. temp = [];
  9969. i = matcherOut.length;
  9970. while ( i-- ) {
  9971. if ( (elem = matcherOut[i]) ) {
  9972. // Restore matcherIn since elem is not yet a final match
  9973. temp.push( (matcherIn[i] = elem) );
  9974. }
  9975. }
  9976. postFinder( null, (matcherOut = []), temp, xml );
  9977. }
  9978. // Move matched elements from seed to results to keep them synchronized
  9979. i = matcherOut.length;
  9980. while ( i-- ) {
  9981. if ( (elem = matcherOut[i]) &&
  9982. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  9983. seed[temp] = !(results[temp] = elem);
  9984. }
  9985. }
  9986. }
  9987. // Add elements to results, through postFinder if defined
  9988. } else {
  9989. matcherOut = condense(
  9990. matcherOut === results ?
  9991. matcherOut.splice( preexisting, matcherOut.length ) :
  9992. matcherOut
  9993. );
  9994. if ( postFinder ) {
  9995. postFinder( null, results, matcherOut, xml );
  9996. } else {
  9997. push.apply( results, matcherOut );
  9998. }
  9999. }
  10000. });
  10001. }
  10002. function matcherFromTokens( tokens ) {
  10003. var checkContext, matcher, j,
  10004. len = tokens.length,
  10005. leadingRelative = Expr.relative[ tokens[0].type ],
  10006. implicitRelative = leadingRelative || Expr.relative[" "],
  10007. i = leadingRelative ? 1 : 0,
  10008. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10009. matchContext = addCombinator( function( elem ) {
  10010. return elem === checkContext;
  10011. }, implicitRelative, true ),
  10012. matchAnyContext = addCombinator( function( elem ) {
  10013. return indexOf( checkContext, elem ) > -1;
  10014. }, implicitRelative, true ),
  10015. matchers = [ function( elem, context, xml ) {
  10016. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10017. (checkContext = context).nodeType ?
  10018. matchContext( elem, context, xml ) :
  10019. matchAnyContext( elem, context, xml ) );
  10020. // Avoid hanging onto element (issue #299)
  10021. checkContext = null;
  10022. return ret;
  10023. } ];
  10024. for ( ; i < len; i++ ) {
  10025. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10026. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10027. } else {
  10028. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10029. // Return special upon seeing a positional matcher
  10030. if ( matcher[ expando ] ) {
  10031. // Find the next relative operator (if any) for proper handling
  10032. j = ++i;
  10033. for ( ; j < len; j++ ) {
  10034. if ( Expr.relative[ tokens[j].type ] ) {
  10035. break;
  10036. }
  10037. }
  10038. return setMatcher(
  10039. i > 1 && elementMatcher( matchers ),
  10040. i > 1 && toSelector(
  10041. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10042. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10043. ).replace( rtrim, "$1" ),
  10044. matcher,
  10045. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10046. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10047. j < len && toSelector( tokens )
  10048. );
  10049. }
  10050. matchers.push( matcher );
  10051. }
  10052. }
  10053. return elementMatcher( matchers );
  10054. }
  10055. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10056. var bySet = setMatchers.length > 0,
  10057. byElement = elementMatchers.length > 0,
  10058. superMatcher = function( seed, context, xml, results, outermost ) {
  10059. var elem, j, matcher,
  10060. matchedCount = 0,
  10061. i = "0",
  10062. unmatched = seed && [],
  10063. setMatched = [],
  10064. contextBackup = outermostContext,
  10065. // We must always have either seed elements or outermost context
  10066. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10067. // Use integer dirruns iff this is the outermost matcher
  10068. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10069. len = elems.length;
  10070. if ( outermost ) {
  10071. outermostContext = context === document || context || outermost;
  10072. }
  10073. // Add elements passing elementMatchers directly to results
  10074. // Support: IE<9, Safari
  10075. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10076. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10077. if ( byElement && elem ) {
  10078. j = 0;
  10079. if ( !context && elem.ownerDocument !== document ) {
  10080. setDocument( elem );
  10081. xml = !documentIsHTML;
  10082. }
  10083. while ( (matcher = elementMatchers[j++]) ) {
  10084. if ( matcher( elem, context || document, xml) ) {
  10085. results.push( elem );
  10086. break;
  10087. }
  10088. }
  10089. if ( outermost ) {
  10090. dirruns = dirrunsUnique;
  10091. }
  10092. }
  10093. // Track unmatched elements for set filters
  10094. if ( bySet ) {
  10095. // They will have gone through all possible matchers
  10096. if ( (elem = !matcher && elem) ) {
  10097. matchedCount--;
  10098. }
  10099. // Lengthen the array for every element, matched or not
  10100. if ( seed ) {
  10101. unmatched.push( elem );
  10102. }
  10103. }
  10104. }
  10105. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10106. // makes the latter nonnegative.
  10107. matchedCount += i;
  10108. // Apply set filters to unmatched elements
  10109. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10110. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10111. // no element matchers and no seed.
  10112. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10113. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10114. // numerically zero.
  10115. if ( bySet && i !== matchedCount ) {
  10116. j = 0;
  10117. while ( (matcher = setMatchers[j++]) ) {
  10118. matcher( unmatched, setMatched, context, xml );
  10119. }
  10120. if ( seed ) {
  10121. // Reintegrate element matches to eliminate the need for sorting
  10122. if ( matchedCount > 0 ) {
  10123. while ( i-- ) {
  10124. if ( !(unmatched[i] || setMatched[i]) ) {
  10125. setMatched[i] = pop.call( results );
  10126. }
  10127. }
  10128. }
  10129. // Discard index placeholder values to get only actual matches
  10130. setMatched = condense( setMatched );
  10131. }
  10132. // Add matches to results
  10133. push.apply( results, setMatched );
  10134. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10135. if ( outermost && !seed && setMatched.length > 0 &&
  10136. ( matchedCount + setMatchers.length ) > 1 ) {
  10137. Sizzle.uniqueSort( results );
  10138. }
  10139. }
  10140. // Override manipulation of globals by nested matchers
  10141. if ( outermost ) {
  10142. dirruns = dirrunsUnique;
  10143. outermostContext = contextBackup;
  10144. }
  10145. return unmatched;
  10146. };
  10147. return bySet ?
  10148. markFunction( superMatcher ) :
  10149. superMatcher;
  10150. }
  10151. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10152. var i,
  10153. setMatchers = [],
  10154. elementMatchers = [],
  10155. cached = compilerCache[ selector + " " ];
  10156. if ( !cached ) {
  10157. // Generate a function of recursive functions that can be used to check each element
  10158. if ( !match ) {
  10159. match = tokenize( selector );
  10160. }
  10161. i = match.length;
  10162. while ( i-- ) {
  10163. cached = matcherFromTokens( match[i] );
  10164. if ( cached[ expando ] ) {
  10165. setMatchers.push( cached );
  10166. } else {
  10167. elementMatchers.push( cached );
  10168. }
  10169. }
  10170. // Cache the compiled function
  10171. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10172. // Save selector and tokenization
  10173. cached.selector = selector;
  10174. }
  10175. return cached;
  10176. };
  10177. /**
  10178. * A low-level selection function that works with Sizzle's compiled
  10179. * selector functions
  10180. * @param {String|Function} selector A selector or a pre-compiled
  10181. * selector function built with Sizzle.compile
  10182. * @param {Element} context
  10183. * @param {Array} [results]
  10184. * @param {Array} [seed] A set of elements to match against
  10185. */
  10186. select = Sizzle.select = function( selector, context, results, seed ) {
  10187. var i, tokens, token, type, find,
  10188. compiled = typeof selector === "function" && selector,
  10189. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10190. results = results || [];
  10191. // Try to minimize operations if there is only one selector in the list and no seed
  10192. // (the latter of which guarantees us context)
  10193. if ( match.length === 1 ) {
  10194. // Reduce context if the leading compound selector is an ID
  10195. tokens = match[0] = match[0].slice( 0 );
  10196. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10197. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10198. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10199. if ( !context ) {
  10200. return results;
  10201. // Precompiled matchers will still verify ancestry, so step up a level
  10202. } else if ( compiled ) {
  10203. context = context.parentNode;
  10204. }
  10205. selector = selector.slice( tokens.shift().value.length );
  10206. }
  10207. // Fetch a seed set for right-to-left matching
  10208. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10209. while ( i-- ) {
  10210. token = tokens[i];
  10211. // Abort if we hit a combinator
  10212. if ( Expr.relative[ (type = token.type) ] ) {
  10213. break;
  10214. }
  10215. if ( (find = Expr.find[ type ]) ) {
  10216. // Search, expanding context for leading sibling combinators
  10217. if ( (seed = find(
  10218. token.matches[0].replace( runescape, funescape ),
  10219. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10220. )) ) {
  10221. // If seed is empty or no tokens remain, we can return early
  10222. tokens.splice( i, 1 );
  10223. selector = seed.length && toSelector( tokens );
  10224. if ( !selector ) {
  10225. push.apply( results, seed );
  10226. return results;
  10227. }
  10228. break;
  10229. }
  10230. }
  10231. }
  10232. }
  10233. // Compile and execute a filtering function if one is not provided
  10234. // Provide `match` to avoid retokenization if we modified the selector above
  10235. ( compiled || compile( selector, match ) )(
  10236. seed,
  10237. context,
  10238. !documentIsHTML,
  10239. results,
  10240. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10241. );
  10242. return results;
  10243. };
  10244. // One-time assignments
  10245. // Sort stability
  10246. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10247. // Support: Chrome 14-35+
  10248. // Always assume duplicates if they aren't passed to the comparison function
  10249. support.detectDuplicates = !!hasDuplicate;
  10250. // Initialize against the default document
  10251. setDocument();
  10252. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10253. // Detached nodes confoundingly follow *each other*
  10254. support.sortDetached = assert(function( el ) {
  10255. // Should return 1, but returns 4 (following)
  10256. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10257. });
  10258. // Support: IE<8
  10259. // Prevent attribute/property "interpolation"
  10260. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10261. if ( !assert(function( el ) {
  10262. el.innerHTML = "<a href='#'></a>";
  10263. return el.firstChild.getAttribute("href") === "#" ;
  10264. }) ) {
  10265. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10266. if ( !isXML ) {
  10267. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10268. }
  10269. });
  10270. }
  10271. // Support: IE<9
  10272. // Use defaultValue in place of getAttribute("value")
  10273. if ( !support.attributes || !assert(function( el ) {
  10274. el.innerHTML = "<input/>";
  10275. el.firstChild.setAttribute( "value", "" );
  10276. return el.firstChild.getAttribute( "value" ) === "";
  10277. }) ) {
  10278. addHandle( "value", function( elem, name, isXML ) {
  10279. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10280. return elem.defaultValue;
  10281. }
  10282. });
  10283. }
  10284. // Support: IE<9
  10285. // Use getAttributeNode to fetch booleans when getAttribute lies
  10286. if ( !assert(function( el ) {
  10287. return el.getAttribute("disabled") == null;
  10288. }) ) {
  10289. addHandle( booleans, function( elem, name, isXML ) {
  10290. var val;
  10291. if ( !isXML ) {
  10292. return elem[ name ] === true ? name.toLowerCase() :
  10293. (val = elem.getAttributeNode( name )) && val.specified ?
  10294. val.value :
  10295. null;
  10296. }
  10297. });
  10298. }
  10299. return Sizzle;
  10300. })( window );
  10301. jQuery.find = Sizzle;
  10302. jQuery.expr = Sizzle.selectors;
  10303. // Deprecated
  10304. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10305. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10306. jQuery.text = Sizzle.getText;
  10307. jQuery.isXMLDoc = Sizzle.isXML;
  10308. jQuery.contains = Sizzle.contains;
  10309. jQuery.escapeSelector = Sizzle.escape;
  10310. var dir = function( elem, dir, until ) {
  10311. var matched = [],
  10312. truncate = until !== undefined;
  10313. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10314. if ( elem.nodeType === 1 ) {
  10315. if ( truncate && jQuery( elem ).is( until ) ) {
  10316. break;
  10317. }
  10318. matched.push( elem );
  10319. }
  10320. }
  10321. return matched;
  10322. };
  10323. var siblings = function( n, elem ) {
  10324. var matched = [];
  10325. for ( ; n; n = n.nextSibling ) {
  10326. if ( n.nodeType === 1 && n !== elem ) {
  10327. matched.push( n );
  10328. }
  10329. }
  10330. return matched;
  10331. };
  10332. var rneedsContext = jQuery.expr.match.needsContext;
  10333. function nodeName( elem, name ) {
  10334. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10335. };
  10336. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10337. // Implement the identical functionality for filter and not
  10338. function winnow( elements, qualifier, not ) {
  10339. if ( isFunction( qualifier ) ) {
  10340. return jQuery.grep( elements, function( elem, i ) {
  10341. return !!qualifier.call( elem, i, elem ) !== not;
  10342. } );
  10343. }
  10344. // Single element
  10345. if ( qualifier.nodeType ) {
  10346. return jQuery.grep( elements, function( elem ) {
  10347. return ( elem === qualifier ) !== not;
  10348. } );
  10349. }
  10350. // Arraylike of elements (jQuery, arguments, Array)
  10351. if ( typeof qualifier !== "string" ) {
  10352. return jQuery.grep( elements, function( elem ) {
  10353. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10354. } );
  10355. }
  10356. // Filtered directly for both simple and complex selectors
  10357. return jQuery.filter( qualifier, elements, not );
  10358. }
  10359. jQuery.filter = function( expr, elems, not ) {
  10360. var elem = elems[ 0 ];
  10361. if ( not ) {
  10362. expr = ":not(" + expr + ")";
  10363. }
  10364. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10365. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10366. }
  10367. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10368. return elem.nodeType === 1;
  10369. } ) );
  10370. };
  10371. jQuery.fn.extend( {
  10372. find: function( selector ) {
  10373. var i, ret,
  10374. len = this.length,
  10375. self = this;
  10376. if ( typeof selector !== "string" ) {
  10377. return this.pushStack( jQuery( selector ).filter( function() {
  10378. for ( i = 0; i < len; i++ ) {
  10379. if ( jQuery.contains( self[ i ], this ) ) {
  10380. return true;
  10381. }
  10382. }
  10383. } ) );
  10384. }
  10385. ret = this.pushStack( [] );
  10386. for ( i = 0; i < len; i++ ) {
  10387. jQuery.find( selector, self[ i ], ret );
  10388. }
  10389. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10390. },
  10391. filter: function( selector ) {
  10392. return this.pushStack( winnow( this, selector || [], false ) );
  10393. },
  10394. not: function( selector ) {
  10395. return this.pushStack( winnow( this, selector || [], true ) );
  10396. },
  10397. is: function( selector ) {
  10398. return !!winnow(
  10399. this,
  10400. // If this is a positional/relative selector, check membership in the returned set
  10401. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10402. typeof selector === "string" && rneedsContext.test( selector ) ?
  10403. jQuery( selector ) :
  10404. selector || [],
  10405. false
  10406. ).length;
  10407. }
  10408. } );
  10409. // Initialize a jQuery object
  10410. // A central reference to the root jQuery(document)
  10411. var rootjQuery,
  10412. // A simple way to check for HTML strings
  10413. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10414. // Strict HTML recognition (#11290: must start with <)
  10415. // Shortcut simple #id case for speed
  10416. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10417. init = jQuery.fn.init = function( selector, context, root ) {
  10418. var match, elem;
  10419. // HANDLE: $(""), $(null), $(undefined), $(false)
  10420. if ( !selector ) {
  10421. return this;
  10422. }
  10423. // Method init() accepts an alternate rootjQuery
  10424. // so migrate can support jQuery.sub (gh-2101)
  10425. root = root || rootjQuery;
  10426. // Handle HTML strings
  10427. if ( typeof selector === "string" ) {
  10428. if ( selector[ 0 ] === "<" &&
  10429. selector[ selector.length - 1 ] === ">" &&
  10430. selector.length >= 3 ) {
  10431. // Assume that strings that start and end with <> are HTML and skip the regex check
  10432. match = [ null, selector, null ];
  10433. } else {
  10434. match = rquickExpr.exec( selector );
  10435. }
  10436. // Match html or make sure no context is specified for #id
  10437. if ( match && ( match[ 1 ] || !context ) ) {
  10438. // HANDLE: $(html) -> $(array)
  10439. if ( match[ 1 ] ) {
  10440. context = context instanceof jQuery ? context[ 0 ] : context;
  10441. // Option to run scripts is true for back-compat
  10442. // Intentionally let the error be thrown if parseHTML is not present
  10443. jQuery.merge( this, jQuery.parseHTML(
  10444. match[ 1 ],
  10445. context && context.nodeType ? context.ownerDocument || context : document,
  10446. true
  10447. ) );
  10448. // HANDLE: $(html, props)
  10449. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10450. for ( match in context ) {
  10451. // Properties of context are called as methods if possible
  10452. if ( isFunction( this[ match ] ) ) {
  10453. this[ match ]( context[ match ] );
  10454. // ...and otherwise set as attributes
  10455. } else {
  10456. this.attr( match, context[ match ] );
  10457. }
  10458. }
  10459. }
  10460. return this;
  10461. // HANDLE: $(#id)
  10462. } else {
  10463. elem = document.getElementById( match[ 2 ] );
  10464. if ( elem ) {
  10465. // Inject the element directly into the jQuery object
  10466. this[ 0 ] = elem;
  10467. this.length = 1;
  10468. }
  10469. return this;
  10470. }
  10471. // HANDLE: $(expr, $(...))
  10472. } else if ( !context || context.jquery ) {
  10473. return ( context || root ).find( selector );
  10474. // HANDLE: $(expr, context)
  10475. // (which is just equivalent to: $(context).find(expr)
  10476. } else {
  10477. return this.constructor( context ).find( selector );
  10478. }
  10479. // HANDLE: $(DOMElement)
  10480. } else if ( selector.nodeType ) {
  10481. this[ 0 ] = selector;
  10482. this.length = 1;
  10483. return this;
  10484. // HANDLE: $(function)
  10485. // Shortcut for document ready
  10486. } else if ( isFunction( selector ) ) {
  10487. return root.ready !== undefined ?
  10488. root.ready( selector ) :
  10489. // Execute immediately if ready is not present
  10490. selector( jQuery );
  10491. }
  10492. return jQuery.makeArray( selector, this );
  10493. };
  10494. // Give the init function the jQuery prototype for later instantiation
  10495. init.prototype = jQuery.fn;
  10496. // Initialize central reference
  10497. rootjQuery = jQuery( document );
  10498. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10499. // Methods guaranteed to produce a unique set when starting from a unique set
  10500. guaranteedUnique = {
  10501. children: true,
  10502. contents: true,
  10503. next: true,
  10504. prev: true
  10505. };
  10506. jQuery.fn.extend( {
  10507. has: function( target ) {
  10508. var targets = jQuery( target, this ),
  10509. l = targets.length;
  10510. return this.filter( function() {
  10511. var i = 0;
  10512. for ( ; i < l; i++ ) {
  10513. if ( jQuery.contains( this, targets[ i ] ) ) {
  10514. return true;
  10515. }
  10516. }
  10517. } );
  10518. },
  10519. closest: function( selectors, context ) {
  10520. var cur,
  10521. i = 0,
  10522. l = this.length,
  10523. matched = [],
  10524. targets = typeof selectors !== "string" && jQuery( selectors );
  10525. // Positional selectors never match, since there's no _selection_ context
  10526. if ( !rneedsContext.test( selectors ) ) {
  10527. for ( ; i < l; i++ ) {
  10528. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10529. // Always skip document fragments
  10530. if ( cur.nodeType < 11 && ( targets ?
  10531. targets.index( cur ) > -1 :
  10532. // Don't pass non-elements to Sizzle
  10533. cur.nodeType === 1 &&
  10534. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10535. matched.push( cur );
  10536. break;
  10537. }
  10538. }
  10539. }
  10540. }
  10541. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10542. },
  10543. // Determine the position of an element within the set
  10544. index: function( elem ) {
  10545. // No argument, return index in parent
  10546. if ( !elem ) {
  10547. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10548. }
  10549. // Index in selector
  10550. if ( typeof elem === "string" ) {
  10551. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10552. }
  10553. // Locate the position of the desired element
  10554. return indexOf.call( this,
  10555. // If it receives a jQuery object, the first element is used
  10556. elem.jquery ? elem[ 0 ] : elem
  10557. );
  10558. },
  10559. add: function( selector, context ) {
  10560. return this.pushStack(
  10561. jQuery.uniqueSort(
  10562. jQuery.merge( this.get(), jQuery( selector, context ) )
  10563. )
  10564. );
  10565. },
  10566. addBack: function( selector ) {
  10567. return this.add( selector == null ?
  10568. this.prevObject : this.prevObject.filter( selector )
  10569. );
  10570. }
  10571. } );
  10572. function sibling( cur, dir ) {
  10573. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10574. return cur;
  10575. }
  10576. jQuery.each( {
  10577. parent: function( elem ) {
  10578. var parent = elem.parentNode;
  10579. return parent && parent.nodeType !== 11 ? parent : null;
  10580. },
  10581. parents: function( elem ) {
  10582. return dir( elem, "parentNode" );
  10583. },
  10584. parentsUntil: function( elem, i, until ) {
  10585. return dir( elem, "parentNode", until );
  10586. },
  10587. next: function( elem ) {
  10588. return sibling( elem, "nextSibling" );
  10589. },
  10590. prev: function( elem ) {
  10591. return sibling( elem, "previousSibling" );
  10592. },
  10593. nextAll: function( elem ) {
  10594. return dir( elem, "nextSibling" );
  10595. },
  10596. prevAll: function( elem ) {
  10597. return dir( elem, "previousSibling" );
  10598. },
  10599. nextUntil: function( elem, i, until ) {
  10600. return dir( elem, "nextSibling", until );
  10601. },
  10602. prevUntil: function( elem, i, until ) {
  10603. return dir( elem, "previousSibling", until );
  10604. },
  10605. siblings: function( elem ) {
  10606. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10607. },
  10608. children: function( elem ) {
  10609. return siblings( elem.firstChild );
  10610. },
  10611. contents: function( elem ) {
  10612. if ( typeof elem.contentDocument !== "undefined" ) {
  10613. return elem.contentDocument;
  10614. }
  10615. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10616. // Treat the template element as a regular one in browsers that
  10617. // don't support it.
  10618. if ( nodeName( elem, "template" ) ) {
  10619. elem = elem.content || elem;
  10620. }
  10621. return jQuery.merge( [], elem.childNodes );
  10622. }
  10623. }, function( name, fn ) {
  10624. jQuery.fn[ name ] = function( until, selector ) {
  10625. var matched = jQuery.map( this, fn, until );
  10626. if ( name.slice( -5 ) !== "Until" ) {
  10627. selector = until;
  10628. }
  10629. if ( selector && typeof selector === "string" ) {
  10630. matched = jQuery.filter( selector, matched );
  10631. }
  10632. if ( this.length > 1 ) {
  10633. // Remove duplicates
  10634. if ( !guaranteedUnique[ name ] ) {
  10635. jQuery.uniqueSort( matched );
  10636. }
  10637. // Reverse order for parents* and prev-derivatives
  10638. if ( rparentsprev.test( name ) ) {
  10639. matched.reverse();
  10640. }
  10641. }
  10642. return this.pushStack( matched );
  10643. };
  10644. } );
  10645. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10646. // Convert String-formatted options into Object-formatted ones
  10647. function createOptions( options ) {
  10648. var object = {};
  10649. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10650. object[ flag ] = true;
  10651. } );
  10652. return object;
  10653. }
  10654. /*
  10655. * Create a callback list using the following parameters:
  10656. *
  10657. * options: an optional list of space-separated options that will change how
  10658. * the callback list behaves or a more traditional option object
  10659. *
  10660. * By default a callback list will act like an event callback list and can be
  10661. * "fired" multiple times.
  10662. *
  10663. * Possible options:
  10664. *
  10665. * once: will ensure the callback list can only be fired once (like a Deferred)
  10666. *
  10667. * memory: will keep track of previous values and will call any callback added
  10668. * after the list has been fired right away with the latest "memorized"
  10669. * values (like a Deferred)
  10670. *
  10671. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10672. *
  10673. * stopOnFalse: interrupt callings when a callback returns false
  10674. *
  10675. */
  10676. jQuery.Callbacks = function( options ) {
  10677. // Convert options from String-formatted to Object-formatted if needed
  10678. // (we check in cache first)
  10679. options = typeof options === "string" ?
  10680. createOptions( options ) :
  10681. jQuery.extend( {}, options );
  10682. var // Flag to know if list is currently firing
  10683. firing,
  10684. // Last fire value for non-forgettable lists
  10685. memory,
  10686. // Flag to know if list was already fired
  10687. fired,
  10688. // Flag to prevent firing
  10689. locked,
  10690. // Actual callback list
  10691. list = [],
  10692. // Queue of execution data for repeatable lists
  10693. queue = [],
  10694. // Index of currently firing callback (modified by add/remove as needed)
  10695. firingIndex = -1,
  10696. // Fire callbacks
  10697. fire = function() {
  10698. // Enforce single-firing
  10699. locked = locked || options.once;
  10700. // Execute callbacks for all pending executions,
  10701. // respecting firingIndex overrides and runtime changes
  10702. fired = firing = true;
  10703. for ( ; queue.length; firingIndex = -1 ) {
  10704. memory = queue.shift();
  10705. while ( ++firingIndex < list.length ) {
  10706. // Run callback and check for early termination
  10707. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  10708. options.stopOnFalse ) {
  10709. // Jump to end and forget the data so .add doesn't re-fire
  10710. firingIndex = list.length;
  10711. memory = false;
  10712. }
  10713. }
  10714. }
  10715. // Forget the data if we're done with it
  10716. if ( !options.memory ) {
  10717. memory = false;
  10718. }
  10719. firing = false;
  10720. // Clean up if we're done firing for good
  10721. if ( locked ) {
  10722. // Keep an empty list if we have data for future add calls
  10723. if ( memory ) {
  10724. list = [];
  10725. // Otherwise, this object is spent
  10726. } else {
  10727. list = "";
  10728. }
  10729. }
  10730. },
  10731. // Actual Callbacks object
  10732. self = {
  10733. // Add a callback or a collection of callbacks to the list
  10734. add: function() {
  10735. if ( list ) {
  10736. // If we have memory from a past run, we should fire after adding
  10737. if ( memory && !firing ) {
  10738. firingIndex = list.length - 1;
  10739. queue.push( memory );
  10740. }
  10741. ( function add( args ) {
  10742. jQuery.each( args, function( _, arg ) {
  10743. if ( isFunction( arg ) ) {
  10744. if ( !options.unique || !self.has( arg ) ) {
  10745. list.push( arg );
  10746. }
  10747. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  10748. // Inspect recursively
  10749. add( arg );
  10750. }
  10751. } );
  10752. } )( arguments );
  10753. if ( memory && !firing ) {
  10754. fire();
  10755. }
  10756. }
  10757. return this;
  10758. },
  10759. // Remove a callback from the list
  10760. remove: function() {
  10761. jQuery.each( arguments, function( _, arg ) {
  10762. var index;
  10763. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  10764. list.splice( index, 1 );
  10765. // Handle firing indexes
  10766. if ( index <= firingIndex ) {
  10767. firingIndex--;
  10768. }
  10769. }
  10770. } );
  10771. return this;
  10772. },
  10773. // Check if a given callback is in the list.
  10774. // If no argument is given, return whether or not list has callbacks attached.
  10775. has: function( fn ) {
  10776. return fn ?
  10777. jQuery.inArray( fn, list ) > -1 :
  10778. list.length > 0;
  10779. },
  10780. // Remove all callbacks from the list
  10781. empty: function() {
  10782. if ( list ) {
  10783. list = [];
  10784. }
  10785. return this;
  10786. },
  10787. // Disable .fire and .add
  10788. // Abort any current/pending executions
  10789. // Clear all callbacks and values
  10790. disable: function() {
  10791. locked = queue = [];
  10792. list = memory = "";
  10793. return this;
  10794. },
  10795. disabled: function() {
  10796. return !list;
  10797. },
  10798. // Disable .fire
  10799. // Also disable .add unless we have memory (since it would have no effect)
  10800. // Abort any pending executions
  10801. lock: function() {
  10802. locked = queue = [];
  10803. if ( !memory && !firing ) {
  10804. list = memory = "";
  10805. }
  10806. return this;
  10807. },
  10808. locked: function() {
  10809. return !!locked;
  10810. },
  10811. // Call all callbacks with the given context and arguments
  10812. fireWith: function( context, args ) {
  10813. if ( !locked ) {
  10814. args = args || [];
  10815. args = [ context, args.slice ? args.slice() : args ];
  10816. queue.push( args );
  10817. if ( !firing ) {
  10818. fire();
  10819. }
  10820. }
  10821. return this;
  10822. },
  10823. // Call all the callbacks with the given arguments
  10824. fire: function() {
  10825. self.fireWith( this, arguments );
  10826. return this;
  10827. },
  10828. // To know if the callbacks have already been called at least once
  10829. fired: function() {
  10830. return !!fired;
  10831. }
  10832. };
  10833. return self;
  10834. };
  10835. function Identity( v ) {
  10836. return v;
  10837. }
  10838. function Thrower( ex ) {
  10839. throw ex;
  10840. }
  10841. function adoptValue( value, resolve, reject, noValue ) {
  10842. var method;
  10843. try {
  10844. // Check for promise aspect first to privilege synchronous behavior
  10845. if ( value && isFunction( ( method = value.promise ) ) ) {
  10846. method.call( value ).done( resolve ).fail( reject );
  10847. // Other thenables
  10848. } else if ( value && isFunction( ( method = value.then ) ) ) {
  10849. method.call( value, resolve, reject );
  10850. // Other non-thenables
  10851. } else {
  10852. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  10853. // * false: [ value ].slice( 0 ) => resolve( value )
  10854. // * true: [ value ].slice( 1 ) => resolve()
  10855. resolve.apply( undefined, [ value ].slice( noValue ) );
  10856. }
  10857. // For Promises/A+, convert exceptions into rejections
  10858. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  10859. // Deferred#then to conditionally suppress rejection.
  10860. } catch ( value ) {
  10861. // Support: Android 4.0 only
  10862. // Strict mode functions invoked without .call/.apply get global-object context
  10863. reject.apply( undefined, [ value ] );
  10864. }
  10865. }
  10866. jQuery.extend( {
  10867. Deferred: function( func ) {
  10868. var tuples = [
  10869. // action, add listener, callbacks,
  10870. // ... .then handlers, argument index, [final state]
  10871. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  10872. jQuery.Callbacks( "memory" ), 2 ],
  10873. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  10874. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  10875. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  10876. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  10877. ],
  10878. state = "pending",
  10879. promise = {
  10880. state: function() {
  10881. return state;
  10882. },
  10883. always: function() {
  10884. deferred.done( arguments ).fail( arguments );
  10885. return this;
  10886. },
  10887. "catch": function( fn ) {
  10888. return promise.then( null, fn );
  10889. },
  10890. // Keep pipe for back-compat
  10891. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  10892. var fns = arguments;
  10893. return jQuery.Deferred( function( newDefer ) {
  10894. jQuery.each( tuples, function( i, tuple ) {
  10895. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  10896. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  10897. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  10898. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  10899. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  10900. deferred[ tuple[ 1 ] ]( function() {
  10901. var returned = fn && fn.apply( this, arguments );
  10902. if ( returned && isFunction( returned.promise ) ) {
  10903. returned.promise()
  10904. .progress( newDefer.notify )
  10905. .done( newDefer.resolve )
  10906. .fail( newDefer.reject );
  10907. } else {
  10908. newDefer[ tuple[ 0 ] + "With" ](
  10909. this,
  10910. fn ? [ returned ] : arguments
  10911. );
  10912. }
  10913. } );
  10914. } );
  10915. fns = null;
  10916. } ).promise();
  10917. },
  10918. then: function( onFulfilled, onRejected, onProgress ) {
  10919. var maxDepth = 0;
  10920. function resolve( depth, deferred, handler, special ) {
  10921. return function() {
  10922. var that = this,
  10923. args = arguments,
  10924. mightThrow = function() {
  10925. var returned, then;
  10926. // Support: Promises/A+ section 2.3.3.3.3
  10927. // https://promisesaplus.com/#point-59
  10928. // Ignore double-resolution attempts
  10929. if ( depth < maxDepth ) {
  10930. return;
  10931. }
  10932. returned = handler.apply( that, args );
  10933. // Support: Promises/A+ section 2.3.1
  10934. // https://promisesaplus.com/#point-48
  10935. if ( returned === deferred.promise() ) {
  10936. throw new TypeError( "Thenable self-resolution" );
  10937. }
  10938. // Support: Promises/A+ sections 2.3.3.1, 3.5
  10939. // https://promisesaplus.com/#point-54
  10940. // https://promisesaplus.com/#point-75
  10941. // Retrieve `then` only once
  10942. then = returned &&
  10943. // Support: Promises/A+ section 2.3.4
  10944. // https://promisesaplus.com/#point-64
  10945. // Only check objects and functions for thenability
  10946. ( typeof returned === "object" ||
  10947. typeof returned === "function" ) &&
  10948. returned.then;
  10949. // Handle a returned thenable
  10950. if ( isFunction( then ) ) {
  10951. // Special processors (notify) just wait for resolution
  10952. if ( special ) {
  10953. then.call(
  10954. returned,
  10955. resolve( maxDepth, deferred, Identity, special ),
  10956. resolve( maxDepth, deferred, Thrower, special )
  10957. );
  10958. // Normal processors (resolve) also hook into progress
  10959. } else {
  10960. // ...and disregard older resolution values
  10961. maxDepth++;
  10962. then.call(
  10963. returned,
  10964. resolve( maxDepth, deferred, Identity, special ),
  10965. resolve( maxDepth, deferred, Thrower, special ),
  10966. resolve( maxDepth, deferred, Identity,
  10967. deferred.notifyWith )
  10968. );
  10969. }
  10970. // Handle all other returned values
  10971. } else {
  10972. // Only substitute handlers pass on context
  10973. // and multiple values (non-spec behavior)
  10974. if ( handler !== Identity ) {
  10975. that = undefined;
  10976. args = [ returned ];
  10977. }
  10978. // Process the value(s)
  10979. // Default process is resolve
  10980. ( special || deferred.resolveWith )( that, args );
  10981. }
  10982. },
  10983. // Only normal processors (resolve) catch and reject exceptions
  10984. process = special ?
  10985. mightThrow :
  10986. function() {
  10987. try {
  10988. mightThrow();
  10989. } catch ( e ) {
  10990. if ( jQuery.Deferred.exceptionHook ) {
  10991. jQuery.Deferred.exceptionHook( e,
  10992. process.stackTrace );
  10993. }
  10994. // Support: Promises/A+ section 2.3.3.3.4.1
  10995. // https://promisesaplus.com/#point-61
  10996. // Ignore post-resolution exceptions
  10997. if ( depth + 1 >= maxDepth ) {
  10998. // Only substitute handlers pass on context
  10999. // and multiple values (non-spec behavior)
  11000. if ( handler !== Thrower ) {
  11001. that = undefined;
  11002. args = [ e ];
  11003. }
  11004. deferred.rejectWith( that, args );
  11005. }
  11006. }
  11007. };
  11008. // Support: Promises/A+ section 2.3.3.3.1
  11009. // https://promisesaplus.com/#point-57
  11010. // Re-resolve promises immediately to dodge false rejection from
  11011. // subsequent errors
  11012. if ( depth ) {
  11013. process();
  11014. } else {
  11015. // Call an optional hook to record the stack, in case of exception
  11016. // since it's otherwise lost when execution goes async
  11017. if ( jQuery.Deferred.getStackHook ) {
  11018. process.stackTrace = jQuery.Deferred.getStackHook();
  11019. }
  11020. window.setTimeout( process );
  11021. }
  11022. };
  11023. }
  11024. return jQuery.Deferred( function( newDefer ) {
  11025. // progress_handlers.add( ... )
  11026. tuples[ 0 ][ 3 ].add(
  11027. resolve(
  11028. 0,
  11029. newDefer,
  11030. isFunction( onProgress ) ?
  11031. onProgress :
  11032. Identity,
  11033. newDefer.notifyWith
  11034. )
  11035. );
  11036. // fulfilled_handlers.add( ... )
  11037. tuples[ 1 ][ 3 ].add(
  11038. resolve(
  11039. 0,
  11040. newDefer,
  11041. isFunction( onFulfilled ) ?
  11042. onFulfilled :
  11043. Identity
  11044. )
  11045. );
  11046. // rejected_handlers.add( ... )
  11047. tuples[ 2 ][ 3 ].add(
  11048. resolve(
  11049. 0,
  11050. newDefer,
  11051. isFunction( onRejected ) ?
  11052. onRejected :
  11053. Thrower
  11054. )
  11055. );
  11056. } ).promise();
  11057. },
  11058. // Get a promise for this deferred
  11059. // If obj is provided, the promise aspect is added to the object
  11060. promise: function( obj ) {
  11061. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11062. }
  11063. },
  11064. deferred = {};
  11065. // Add list-specific methods
  11066. jQuery.each( tuples, function( i, tuple ) {
  11067. var list = tuple[ 2 ],
  11068. stateString = tuple[ 5 ];
  11069. // promise.progress = list.add
  11070. // promise.done = list.add
  11071. // promise.fail = list.add
  11072. promise[ tuple[ 1 ] ] = list.add;
  11073. // Handle state
  11074. if ( stateString ) {
  11075. list.add(
  11076. function() {
  11077. // state = "resolved" (i.e., fulfilled)
  11078. // state = "rejected"
  11079. state = stateString;
  11080. },
  11081. // rejected_callbacks.disable
  11082. // fulfilled_callbacks.disable
  11083. tuples[ 3 - i ][ 2 ].disable,
  11084. // rejected_handlers.disable
  11085. // fulfilled_handlers.disable
  11086. tuples[ 3 - i ][ 3 ].disable,
  11087. // progress_callbacks.lock
  11088. tuples[ 0 ][ 2 ].lock,
  11089. // progress_handlers.lock
  11090. tuples[ 0 ][ 3 ].lock
  11091. );
  11092. }
  11093. // progress_handlers.fire
  11094. // fulfilled_handlers.fire
  11095. // rejected_handlers.fire
  11096. list.add( tuple[ 3 ].fire );
  11097. // deferred.notify = function() { deferred.notifyWith(...) }
  11098. // deferred.resolve = function() { deferred.resolveWith(...) }
  11099. // deferred.reject = function() { deferred.rejectWith(...) }
  11100. deferred[ tuple[ 0 ] ] = function() {
  11101. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11102. return this;
  11103. };
  11104. // deferred.notifyWith = list.fireWith
  11105. // deferred.resolveWith = list.fireWith
  11106. // deferred.rejectWith = list.fireWith
  11107. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11108. } );
  11109. // Make the deferred a promise
  11110. promise.promise( deferred );
  11111. // Call given func if any
  11112. if ( func ) {
  11113. func.call( deferred, deferred );
  11114. }
  11115. // All done!
  11116. return deferred;
  11117. },
  11118. // Deferred helper
  11119. when: function( singleValue ) {
  11120. var
  11121. // count of uncompleted subordinates
  11122. remaining = arguments.length,
  11123. // count of unprocessed arguments
  11124. i = remaining,
  11125. // subordinate fulfillment data
  11126. resolveContexts = Array( i ),
  11127. resolveValues = slice.call( arguments ),
  11128. // the master Deferred
  11129. master = jQuery.Deferred(),
  11130. // subordinate callback factory
  11131. updateFunc = function( i ) {
  11132. return function( value ) {
  11133. resolveContexts[ i ] = this;
  11134. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11135. if ( !( --remaining ) ) {
  11136. master.resolveWith( resolveContexts, resolveValues );
  11137. }
  11138. };
  11139. };
  11140. // Single- and empty arguments are adopted like Promise.resolve
  11141. if ( remaining <= 1 ) {
  11142. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11143. !remaining );
  11144. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11145. if ( master.state() === "pending" ||
  11146. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11147. return master.then();
  11148. }
  11149. }
  11150. // Multiple arguments are aggregated like Promise.all array elements
  11151. while ( i-- ) {
  11152. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11153. }
  11154. return master.promise();
  11155. }
  11156. } );
  11157. // These usually indicate a programmer mistake during development,
  11158. // warn about them ASAP rather than swallowing them by default.
  11159. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11160. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11161. // Support: IE 8 - 9 only
  11162. // Console exists when dev tools are open, which can happen at any time
  11163. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11164. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11165. }
  11166. };
  11167. jQuery.readyException = function( error ) {
  11168. window.setTimeout( function() {
  11169. throw error;
  11170. } );
  11171. };
  11172. // The deferred used on DOM ready
  11173. var readyList = jQuery.Deferred();
  11174. jQuery.fn.ready = function( fn ) {
  11175. readyList
  11176. .then( fn )
  11177. // Wrap jQuery.readyException in a function so that the lookup
  11178. // happens at the time of error handling instead of callback
  11179. // registration.
  11180. .catch( function( error ) {
  11181. jQuery.readyException( error );
  11182. } );
  11183. return this;
  11184. };
  11185. jQuery.extend( {
  11186. // Is the DOM ready to be used? Set to true once it occurs.
  11187. isReady: false,
  11188. // A counter to track how many items to wait for before
  11189. // the ready event fires. See #6781
  11190. readyWait: 1,
  11191. // Handle when the DOM is ready
  11192. ready: function( wait ) {
  11193. // Abort if there are pending holds or we're already ready
  11194. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11195. return;
  11196. }
  11197. // Remember that the DOM is ready
  11198. jQuery.isReady = true;
  11199. // If a normal DOM Ready event fired, decrement, and wait if need be
  11200. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11201. return;
  11202. }
  11203. // If there are functions bound, to execute
  11204. readyList.resolveWith( document, [ jQuery ] );
  11205. }
  11206. } );
  11207. jQuery.ready.then = readyList.then;
  11208. // The ready event handler and self cleanup method
  11209. function completed() {
  11210. document.removeEventListener( "DOMContentLoaded", completed );
  11211. window.removeEventListener( "load", completed );
  11212. jQuery.ready();
  11213. }
  11214. // Catch cases where $(document).ready() is called
  11215. // after the browser event has already occurred.
  11216. // Support: IE <=9 - 10 only
  11217. // Older IE sometimes signals "interactive" too soon
  11218. if ( document.readyState === "complete" ||
  11219. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11220. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11221. window.setTimeout( jQuery.ready );
  11222. } else {
  11223. // Use the handy event callback
  11224. document.addEventListener( "DOMContentLoaded", completed );
  11225. // A fallback to window.onload, that will always work
  11226. window.addEventListener( "load", completed );
  11227. }
  11228. // Multifunctional method to get and set values of a collection
  11229. // The value/s can optionally be executed if it's a function
  11230. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11231. var i = 0,
  11232. len = elems.length,
  11233. bulk = key == null;
  11234. // Sets many values
  11235. if ( toType( key ) === "object" ) {
  11236. chainable = true;
  11237. for ( i in key ) {
  11238. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11239. }
  11240. // Sets one value
  11241. } else if ( value !== undefined ) {
  11242. chainable = true;
  11243. if ( !isFunction( value ) ) {
  11244. raw = true;
  11245. }
  11246. if ( bulk ) {
  11247. // Bulk operations run against the entire set
  11248. if ( raw ) {
  11249. fn.call( elems, value );
  11250. fn = null;
  11251. // ...except when executing function values
  11252. } else {
  11253. bulk = fn;
  11254. fn = function( elem, key, value ) {
  11255. return bulk.call( jQuery( elem ), value );
  11256. };
  11257. }
  11258. }
  11259. if ( fn ) {
  11260. for ( ; i < len; i++ ) {
  11261. fn(
  11262. elems[ i ], key, raw ?
  11263. value :
  11264. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11265. );
  11266. }
  11267. }
  11268. }
  11269. if ( chainable ) {
  11270. return elems;
  11271. }
  11272. // Gets
  11273. if ( bulk ) {
  11274. return fn.call( elems );
  11275. }
  11276. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11277. };
  11278. // Matches dashed string for camelizing
  11279. var rmsPrefix = /^-ms-/,
  11280. rdashAlpha = /-([a-z])/g;
  11281. // Used by camelCase as callback to replace()
  11282. function fcamelCase( all, letter ) {
  11283. return letter.toUpperCase();
  11284. }
  11285. // Convert dashed to camelCase; used by the css and data modules
  11286. // Support: IE <=9 - 11, Edge 12 - 15
  11287. // Microsoft forgot to hump their vendor prefix (#9572)
  11288. function camelCase( string ) {
  11289. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11290. }
  11291. var acceptData = function( owner ) {
  11292. // Accepts only:
  11293. // - Node
  11294. // - Node.ELEMENT_NODE
  11295. // - Node.DOCUMENT_NODE
  11296. // - Object
  11297. // - Any
  11298. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11299. };
  11300. function Data() {
  11301. this.expando = jQuery.expando + Data.uid++;
  11302. }
  11303. Data.uid = 1;
  11304. Data.prototype = {
  11305. cache: function( owner ) {
  11306. // Check if the owner object already has a cache
  11307. var value = owner[ this.expando ];
  11308. // If not, create one
  11309. if ( !value ) {
  11310. value = {};
  11311. // We can accept data for non-element nodes in modern browsers,
  11312. // but we should not, see #8335.
  11313. // Always return an empty object.
  11314. if ( acceptData( owner ) ) {
  11315. // If it is a node unlikely to be stringify-ed or looped over
  11316. // use plain assignment
  11317. if ( owner.nodeType ) {
  11318. owner[ this.expando ] = value;
  11319. // Otherwise secure it in a non-enumerable property
  11320. // configurable must be true to allow the property to be
  11321. // deleted when data is removed
  11322. } else {
  11323. Object.defineProperty( owner, this.expando, {
  11324. value: value,
  11325. configurable: true
  11326. } );
  11327. }
  11328. }
  11329. }
  11330. return value;
  11331. },
  11332. set: function( owner, data, value ) {
  11333. var prop,
  11334. cache = this.cache( owner );
  11335. // Handle: [ owner, key, value ] args
  11336. // Always use camelCase key (gh-2257)
  11337. if ( typeof data === "string" ) {
  11338. cache[ camelCase( data ) ] = value;
  11339. // Handle: [ owner, { properties } ] args
  11340. } else {
  11341. // Copy the properties one-by-one to the cache object
  11342. for ( prop in data ) {
  11343. cache[ camelCase( prop ) ] = data[ prop ];
  11344. }
  11345. }
  11346. return cache;
  11347. },
  11348. get: function( owner, key ) {
  11349. return key === undefined ?
  11350. this.cache( owner ) :
  11351. // Always use camelCase key (gh-2257)
  11352. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11353. },
  11354. access: function( owner, key, value ) {
  11355. // In cases where either:
  11356. //
  11357. // 1. No key was specified
  11358. // 2. A string key was specified, but no value provided
  11359. //
  11360. // Take the "read" path and allow the get method to determine
  11361. // which value to return, respectively either:
  11362. //
  11363. // 1. The entire cache object
  11364. // 2. The data stored at the key
  11365. //
  11366. if ( key === undefined ||
  11367. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11368. return this.get( owner, key );
  11369. }
  11370. // When the key is not a string, or both a key and value
  11371. // are specified, set or extend (existing objects) with either:
  11372. //
  11373. // 1. An object of properties
  11374. // 2. A key and value
  11375. //
  11376. this.set( owner, key, value );
  11377. // Since the "set" path can have two possible entry points
  11378. // return the expected data based on which path was taken[*]
  11379. return value !== undefined ? value : key;
  11380. },
  11381. remove: function( owner, key ) {
  11382. var i,
  11383. cache = owner[ this.expando ];
  11384. if ( cache === undefined ) {
  11385. return;
  11386. }
  11387. if ( key !== undefined ) {
  11388. // Support array or space separated string of keys
  11389. if ( Array.isArray( key ) ) {
  11390. // If key is an array of keys...
  11391. // We always set camelCase keys, so remove that.
  11392. key = key.map( camelCase );
  11393. } else {
  11394. key = camelCase( key );
  11395. // If a key with the spaces exists, use it.
  11396. // Otherwise, create an array by matching non-whitespace
  11397. key = key in cache ?
  11398. [ key ] :
  11399. ( key.match( rnothtmlwhite ) || [] );
  11400. }
  11401. i = key.length;
  11402. while ( i-- ) {
  11403. delete cache[ key[ i ] ];
  11404. }
  11405. }
  11406. // Remove the expando if there's no more data
  11407. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11408. // Support: Chrome <=35 - 45
  11409. // Webkit & Blink performance suffers when deleting properties
  11410. // from DOM nodes, so set to undefined instead
  11411. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11412. if ( owner.nodeType ) {
  11413. owner[ this.expando ] = undefined;
  11414. } else {
  11415. delete owner[ this.expando ];
  11416. }
  11417. }
  11418. },
  11419. hasData: function( owner ) {
  11420. var cache = owner[ this.expando ];
  11421. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11422. }
  11423. };
  11424. var dataPriv = new Data();
  11425. var dataUser = new Data();
  11426. // Implementation Summary
  11427. //
  11428. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11429. // 2. Improve the module's maintainability by reducing the storage
  11430. // paths to a single mechanism.
  11431. // 3. Use the same single mechanism to support "private" and "user" data.
  11432. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11433. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11434. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11435. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11436. rmultiDash = /[A-Z]/g;
  11437. function getData( data ) {
  11438. if ( data === "true" ) {
  11439. return true;
  11440. }
  11441. if ( data === "false" ) {
  11442. return false;
  11443. }
  11444. if ( data === "null" ) {
  11445. return null;
  11446. }
  11447. // Only convert to a number if it doesn't change the string
  11448. if ( data === +data + "" ) {
  11449. return +data;
  11450. }
  11451. if ( rbrace.test( data ) ) {
  11452. return JSON.parse( data );
  11453. }
  11454. return data;
  11455. }
  11456. function dataAttr( elem, key, data ) {
  11457. var name;
  11458. // If nothing was found internally, try to fetch any
  11459. // data from the HTML5 data-* attribute
  11460. if ( data === undefined && elem.nodeType === 1 ) {
  11461. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11462. data = elem.getAttribute( name );
  11463. if ( typeof data === "string" ) {
  11464. try {
  11465. data = getData( data );
  11466. } catch ( e ) {}
  11467. // Make sure we set the data so it isn't changed later
  11468. dataUser.set( elem, key, data );
  11469. } else {
  11470. data = undefined;
  11471. }
  11472. }
  11473. return data;
  11474. }
  11475. jQuery.extend( {
  11476. hasData: function( elem ) {
  11477. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11478. },
  11479. data: function( elem, name, data ) {
  11480. return dataUser.access( elem, name, data );
  11481. },
  11482. removeData: function( elem, name ) {
  11483. dataUser.remove( elem, name );
  11484. },
  11485. // TODO: Now that all calls to _data and _removeData have been replaced
  11486. // with direct calls to dataPriv methods, these can be deprecated.
  11487. _data: function( elem, name, data ) {
  11488. return dataPriv.access( elem, name, data );
  11489. },
  11490. _removeData: function( elem, name ) {
  11491. dataPriv.remove( elem, name );
  11492. }
  11493. } );
  11494. jQuery.fn.extend( {
  11495. data: function( key, value ) {
  11496. var i, name, data,
  11497. elem = this[ 0 ],
  11498. attrs = elem && elem.attributes;
  11499. // Gets all values
  11500. if ( key === undefined ) {
  11501. if ( this.length ) {
  11502. data = dataUser.get( elem );
  11503. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11504. i = attrs.length;
  11505. while ( i-- ) {
  11506. // Support: IE 11 only
  11507. // The attrs elements can be null (#14894)
  11508. if ( attrs[ i ] ) {
  11509. name = attrs[ i ].name;
  11510. if ( name.indexOf( "data-" ) === 0 ) {
  11511. name = camelCase( name.slice( 5 ) );
  11512. dataAttr( elem, name, data[ name ] );
  11513. }
  11514. }
  11515. }
  11516. dataPriv.set( elem, "hasDataAttrs", true );
  11517. }
  11518. }
  11519. return data;
  11520. }
  11521. // Sets multiple values
  11522. if ( typeof key === "object" ) {
  11523. return this.each( function() {
  11524. dataUser.set( this, key );
  11525. } );
  11526. }
  11527. return access( this, function( value ) {
  11528. var data;
  11529. // The calling jQuery object (element matches) is not empty
  11530. // (and therefore has an element appears at this[ 0 ]) and the
  11531. // `value` parameter was not undefined. An empty jQuery object
  11532. // will result in `undefined` for elem = this[ 0 ] which will
  11533. // throw an exception if an attempt to read a data cache is made.
  11534. if ( elem && value === undefined ) {
  11535. // Attempt to get data from the cache
  11536. // The key will always be camelCased in Data
  11537. data = dataUser.get( elem, key );
  11538. if ( data !== undefined ) {
  11539. return data;
  11540. }
  11541. // Attempt to "discover" the data in
  11542. // HTML5 custom data-* attrs
  11543. data = dataAttr( elem, key );
  11544. if ( data !== undefined ) {
  11545. return data;
  11546. }
  11547. // We tried really hard, but the data doesn't exist.
  11548. return;
  11549. }
  11550. // Set the data...
  11551. this.each( function() {
  11552. // We always store the camelCased key
  11553. dataUser.set( this, key, value );
  11554. } );
  11555. }, null, value, arguments.length > 1, null, true );
  11556. },
  11557. removeData: function( key ) {
  11558. return this.each( function() {
  11559. dataUser.remove( this, key );
  11560. } );
  11561. }
  11562. } );
  11563. jQuery.extend( {
  11564. queue: function( elem, type, data ) {
  11565. var queue;
  11566. if ( elem ) {
  11567. type = ( type || "fx" ) + "queue";
  11568. queue = dataPriv.get( elem, type );
  11569. // Speed up dequeue by getting out quickly if this is just a lookup
  11570. if ( data ) {
  11571. if ( !queue || Array.isArray( data ) ) {
  11572. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11573. } else {
  11574. queue.push( data );
  11575. }
  11576. }
  11577. return queue || [];
  11578. }
  11579. },
  11580. dequeue: function( elem, type ) {
  11581. type = type || "fx";
  11582. var queue = jQuery.queue( elem, type ),
  11583. startLength = queue.length,
  11584. fn = queue.shift(),
  11585. hooks = jQuery._queueHooks( elem, type ),
  11586. next = function() {
  11587. jQuery.dequeue( elem, type );
  11588. };
  11589. // If the fx queue is dequeued, always remove the progress sentinel
  11590. if ( fn === "inprogress" ) {
  11591. fn = queue.shift();
  11592. startLength--;
  11593. }
  11594. if ( fn ) {
  11595. // Add a progress sentinel to prevent the fx queue from being
  11596. // automatically dequeued
  11597. if ( type === "fx" ) {
  11598. queue.unshift( "inprogress" );
  11599. }
  11600. // Clear up the last queue stop function
  11601. delete hooks.stop;
  11602. fn.call( elem, next, hooks );
  11603. }
  11604. if ( !startLength && hooks ) {
  11605. hooks.empty.fire();
  11606. }
  11607. },
  11608. // Not public - generate a queueHooks object, or return the current one
  11609. _queueHooks: function( elem, type ) {
  11610. var key = type + "queueHooks";
  11611. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11612. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11613. dataPriv.remove( elem, [ type + "queue", key ] );
  11614. } )
  11615. } );
  11616. }
  11617. } );
  11618. jQuery.fn.extend( {
  11619. queue: function( type, data ) {
  11620. var setter = 2;
  11621. if ( typeof type !== "string" ) {
  11622. data = type;
  11623. type = "fx";
  11624. setter--;
  11625. }
  11626. if ( arguments.length < setter ) {
  11627. return jQuery.queue( this[ 0 ], type );
  11628. }
  11629. return data === undefined ?
  11630. this :
  11631. this.each( function() {
  11632. var queue = jQuery.queue( this, type, data );
  11633. // Ensure a hooks for this queue
  11634. jQuery._queueHooks( this, type );
  11635. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11636. jQuery.dequeue( this, type );
  11637. }
  11638. } );
  11639. },
  11640. dequeue: function( type ) {
  11641. return this.each( function() {
  11642. jQuery.dequeue( this, type );
  11643. } );
  11644. },
  11645. clearQueue: function( type ) {
  11646. return this.queue( type || "fx", [] );
  11647. },
  11648. // Get a promise resolved when queues of a certain type
  11649. // are emptied (fx is the type by default)
  11650. promise: function( type, obj ) {
  11651. var tmp,
  11652. count = 1,
  11653. defer = jQuery.Deferred(),
  11654. elements = this,
  11655. i = this.length,
  11656. resolve = function() {
  11657. if ( !( --count ) ) {
  11658. defer.resolveWith( elements, [ elements ] );
  11659. }
  11660. };
  11661. if ( typeof type !== "string" ) {
  11662. obj = type;
  11663. type = undefined;
  11664. }
  11665. type = type || "fx";
  11666. while ( i-- ) {
  11667. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11668. if ( tmp && tmp.empty ) {
  11669. count++;
  11670. tmp.empty.add( resolve );
  11671. }
  11672. }
  11673. resolve();
  11674. return defer.promise( obj );
  11675. }
  11676. } );
  11677. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11678. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11679. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11680. var documentElement = document.documentElement;
  11681. var isAttached = function( elem ) {
  11682. return jQuery.contains( elem.ownerDocument, elem );
  11683. },
  11684. composed = { composed: true };
  11685. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11686. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11687. // Support: iOS 10.0-10.2 only
  11688. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11689. // leading to errors. We need to check for `getRootNode`.
  11690. if ( documentElement.getRootNode ) {
  11691. isAttached = function( elem ) {
  11692. return jQuery.contains( elem.ownerDocument, elem ) ||
  11693. elem.getRootNode( composed ) === elem.ownerDocument;
  11694. };
  11695. }
  11696. var isHiddenWithinTree = function( elem, el ) {
  11697. // isHiddenWithinTree might be called from jQuery#filter function;
  11698. // in that case, element will be second argument
  11699. elem = el || elem;
  11700. // Inline style trumps all
  11701. return elem.style.display === "none" ||
  11702. elem.style.display === "" &&
  11703. // Otherwise, check computed style
  11704. // Support: Firefox <=43 - 45
  11705. // Disconnected elements can have computed display: none, so first confirm that elem is
  11706. // in the document.
  11707. isAttached( elem ) &&
  11708. jQuery.css( elem, "display" ) === "none";
  11709. };
  11710. var swap = function( elem, options, callback, args ) {
  11711. var ret, name,
  11712. old = {};
  11713. // Remember the old values, and insert the new ones
  11714. for ( name in options ) {
  11715. old[ name ] = elem.style[ name ];
  11716. elem.style[ name ] = options[ name ];
  11717. }
  11718. ret = callback.apply( elem, args || [] );
  11719. // Revert the old values
  11720. for ( name in options ) {
  11721. elem.style[ name ] = old[ name ];
  11722. }
  11723. return ret;
  11724. };
  11725. function adjustCSS( elem, prop, valueParts, tween ) {
  11726. var adjusted, scale,
  11727. maxIterations = 20,
  11728. currentValue = tween ?
  11729. function() {
  11730. return tween.cur();
  11731. } :
  11732. function() {
  11733. return jQuery.css( elem, prop, "" );
  11734. },
  11735. initial = currentValue(),
  11736. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  11737. // Starting value computation is required for potential unit mismatches
  11738. initialInUnit = elem.nodeType &&
  11739. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  11740. rcssNum.exec( jQuery.css( elem, prop ) );
  11741. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  11742. // Support: Firefox <=54
  11743. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  11744. initial = initial / 2;
  11745. // Trust units reported by jQuery.css
  11746. unit = unit || initialInUnit[ 3 ];
  11747. // Iteratively approximate from a nonzero starting point
  11748. initialInUnit = +initial || 1;
  11749. while ( maxIterations-- ) {
  11750. // Evaluate and update our best guess (doubling guesses that zero out).
  11751. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  11752. jQuery.style( elem, prop, initialInUnit + unit );
  11753. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  11754. maxIterations = 0;
  11755. }
  11756. initialInUnit = initialInUnit / scale;
  11757. }
  11758. initialInUnit = initialInUnit * 2;
  11759. jQuery.style( elem, prop, initialInUnit + unit );
  11760. // Make sure we update the tween properties later on
  11761. valueParts = valueParts || [];
  11762. }
  11763. if ( valueParts ) {
  11764. initialInUnit = +initialInUnit || +initial || 0;
  11765. // Apply relative offset (+=/-=) if specified
  11766. adjusted = valueParts[ 1 ] ?
  11767. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  11768. +valueParts[ 2 ];
  11769. if ( tween ) {
  11770. tween.unit = unit;
  11771. tween.start = initialInUnit;
  11772. tween.end = adjusted;
  11773. }
  11774. }
  11775. return adjusted;
  11776. }
  11777. var defaultDisplayMap = {};
  11778. function getDefaultDisplay( elem ) {
  11779. var temp,
  11780. doc = elem.ownerDocument,
  11781. nodeName = elem.nodeName,
  11782. display = defaultDisplayMap[ nodeName ];
  11783. if ( display ) {
  11784. return display;
  11785. }
  11786. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  11787. display = jQuery.css( temp, "display" );
  11788. temp.parentNode.removeChild( temp );
  11789. if ( display === "none" ) {
  11790. display = "block";
  11791. }
  11792. defaultDisplayMap[ nodeName ] = display;
  11793. return display;
  11794. }
  11795. function showHide( elements, show ) {
  11796. var display, elem,
  11797. values = [],
  11798. index = 0,
  11799. length = elements.length;
  11800. // Determine new display value for elements that need to change
  11801. for ( ; index < length; index++ ) {
  11802. elem = elements[ index ];
  11803. if ( !elem.style ) {
  11804. continue;
  11805. }
  11806. display = elem.style.display;
  11807. if ( show ) {
  11808. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  11809. // check is required in this first loop unless we have a nonempty display value (either
  11810. // inline or about-to-be-restored)
  11811. if ( display === "none" ) {
  11812. values[ index ] = dataPriv.get( elem, "display" ) || null;
  11813. if ( !values[ index ] ) {
  11814. elem.style.display = "";
  11815. }
  11816. }
  11817. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  11818. values[ index ] = getDefaultDisplay( elem );
  11819. }
  11820. } else {
  11821. if ( display !== "none" ) {
  11822. values[ index ] = "none";
  11823. // Remember what we're overwriting
  11824. dataPriv.set( elem, "display", display );
  11825. }
  11826. }
  11827. }
  11828. // Set the display of the elements in a second loop to avoid constant reflow
  11829. for ( index = 0; index < length; index++ ) {
  11830. if ( values[ index ] != null ) {
  11831. elements[ index ].style.display = values[ index ];
  11832. }
  11833. }
  11834. return elements;
  11835. }
  11836. jQuery.fn.extend( {
  11837. show: function() {
  11838. return showHide( this, true );
  11839. },
  11840. hide: function() {
  11841. return showHide( this );
  11842. },
  11843. toggle: function( state ) {
  11844. if ( typeof state === "boolean" ) {
  11845. return state ? this.show() : this.hide();
  11846. }
  11847. return this.each( function() {
  11848. if ( isHiddenWithinTree( this ) ) {
  11849. jQuery( this ).show();
  11850. } else {
  11851. jQuery( this ).hide();
  11852. }
  11853. } );
  11854. }
  11855. } );
  11856. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  11857. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  11858. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  11859. // We have to close these tags to support XHTML (#13200)
  11860. var wrapMap = {
  11861. // Support: IE <=9 only
  11862. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  11863. // XHTML parsers do not magically insert elements in the
  11864. // same way that tag soup parsers do. So we cannot shorten
  11865. // this by omitting <tbody> or other required elements.
  11866. thead: [ 1, "<table>", "</table>" ],
  11867. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  11868. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  11869. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  11870. _default: [ 0, "", "" ]
  11871. };
  11872. // Support: IE <=9 only
  11873. wrapMap.optgroup = wrapMap.option;
  11874. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  11875. wrapMap.th = wrapMap.td;
  11876. function getAll( context, tag ) {
  11877. // Support: IE <=9 - 11 only
  11878. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  11879. var ret;
  11880. if ( typeof context.getElementsByTagName !== "undefined" ) {
  11881. ret = context.getElementsByTagName( tag || "*" );
  11882. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  11883. ret = context.querySelectorAll( tag || "*" );
  11884. } else {
  11885. ret = [];
  11886. }
  11887. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  11888. return jQuery.merge( [ context ], ret );
  11889. }
  11890. return ret;
  11891. }
  11892. // Mark scripts as having already been evaluated
  11893. function setGlobalEval( elems, refElements ) {
  11894. var i = 0,
  11895. l = elems.length;
  11896. for ( ; i < l; i++ ) {
  11897. dataPriv.set(
  11898. elems[ i ],
  11899. "globalEval",
  11900. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  11901. );
  11902. }
  11903. }
  11904. var rhtml = /<|&#?\w+;/;
  11905. function buildFragment( elems, context, scripts, selection, ignored ) {
  11906. var elem, tmp, tag, wrap, attached, j,
  11907. fragment = context.createDocumentFragment(),
  11908. nodes = [],
  11909. i = 0,
  11910. l = elems.length;
  11911. for ( ; i < l; i++ ) {
  11912. elem = elems[ i ];
  11913. if ( elem || elem === 0 ) {
  11914. // Add nodes directly
  11915. if ( toType( elem ) === "object" ) {
  11916. // Support: Android <=4.0 only, PhantomJS 1 only
  11917. // push.apply(_, arraylike) throws on ancient WebKit
  11918. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  11919. // Convert non-html into a text node
  11920. } else if ( !rhtml.test( elem ) ) {
  11921. nodes.push( context.createTextNode( elem ) );
  11922. // Convert html into DOM nodes
  11923. } else {
  11924. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  11925. // Deserialize a standard representation
  11926. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  11927. wrap = wrapMap[ tag ] || wrapMap._default;
  11928. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  11929. // Descend through wrappers to the right content
  11930. j = wrap[ 0 ];
  11931. while ( j-- ) {
  11932. tmp = tmp.lastChild;
  11933. }
  11934. // Support: Android <=4.0 only, PhantomJS 1 only
  11935. // push.apply(_, arraylike) throws on ancient WebKit
  11936. jQuery.merge( nodes, tmp.childNodes );
  11937. // Remember the top-level container
  11938. tmp = fragment.firstChild;
  11939. // Ensure the created nodes are orphaned (#12392)
  11940. tmp.textContent = "";
  11941. }
  11942. }
  11943. }
  11944. // Remove wrapper from fragment
  11945. fragment.textContent = "";
  11946. i = 0;
  11947. while ( ( elem = nodes[ i++ ] ) ) {
  11948. // Skip elements already in the context collection (trac-4087)
  11949. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  11950. if ( ignored ) {
  11951. ignored.push( elem );
  11952. }
  11953. continue;
  11954. }
  11955. attached = isAttached( elem );
  11956. // Append to fragment
  11957. tmp = getAll( fragment.appendChild( elem ), "script" );
  11958. // Preserve script evaluation history
  11959. if ( attached ) {
  11960. setGlobalEval( tmp );
  11961. }
  11962. // Capture executables
  11963. if ( scripts ) {
  11964. j = 0;
  11965. while ( ( elem = tmp[ j++ ] ) ) {
  11966. if ( rscriptType.test( elem.type || "" ) ) {
  11967. scripts.push( elem );
  11968. }
  11969. }
  11970. }
  11971. }
  11972. return fragment;
  11973. }
  11974. ( function() {
  11975. var fragment = document.createDocumentFragment(),
  11976. div = fragment.appendChild( document.createElement( "div" ) ),
  11977. input = document.createElement( "input" );
  11978. // Support: Android 4.0 - 4.3 only
  11979. // Check state lost if the name is set (#11217)
  11980. // Support: Windows Web Apps (WWA)
  11981. // `name` and `type` must use .setAttribute for WWA (#14901)
  11982. input.setAttribute( "type", "radio" );
  11983. input.setAttribute( "checked", "checked" );
  11984. input.setAttribute( "name", "t" );
  11985. div.appendChild( input );
  11986. // Support: Android <=4.1 only
  11987. // Older WebKit doesn't clone checked state correctly in fragments
  11988. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  11989. // Support: IE <=11 only
  11990. // Make sure textarea (and checkbox) defaultValue is properly cloned
  11991. div.innerHTML = "<textarea>x</textarea>";
  11992. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  11993. } )();
  11994. var
  11995. rkeyEvent = /^key/,
  11996. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  11997. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  11998. function returnTrue() {
  11999. return true;
  12000. }
  12001. function returnFalse() {
  12002. return false;
  12003. }
  12004. // Support: IE <=9 - 11+
  12005. // focus() and blur() are asynchronous, except when they are no-op.
  12006. // So expect focus to be synchronous when the element is already active,
  12007. // and blur to be synchronous when the element is not already active.
  12008. // (focus and blur are always synchronous in other supported browsers,
  12009. // this just defines when we can count on it).
  12010. function expectSync( elem, type ) {
  12011. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12012. }
  12013. // Support: IE <=9 only
  12014. // Accessing document.activeElement can throw unexpectedly
  12015. // https://bugs.jquery.com/ticket/13393
  12016. function safeActiveElement() {
  12017. try {
  12018. return document.activeElement;
  12019. } catch ( err ) { }
  12020. }
  12021. function on( elem, types, selector, data, fn, one ) {
  12022. var origFn, type;
  12023. // Types can be a map of types/handlers
  12024. if ( typeof types === "object" ) {
  12025. // ( types-Object, selector, data )
  12026. if ( typeof selector !== "string" ) {
  12027. // ( types-Object, data )
  12028. data = data || selector;
  12029. selector = undefined;
  12030. }
  12031. for ( type in types ) {
  12032. on( elem, type, selector, data, types[ type ], one );
  12033. }
  12034. return elem;
  12035. }
  12036. if ( data == null && fn == null ) {
  12037. // ( types, fn )
  12038. fn = selector;
  12039. data = selector = undefined;
  12040. } else if ( fn == null ) {
  12041. if ( typeof selector === "string" ) {
  12042. // ( types, selector, fn )
  12043. fn = data;
  12044. data = undefined;
  12045. } else {
  12046. // ( types, data, fn )
  12047. fn = data;
  12048. data = selector;
  12049. selector = undefined;
  12050. }
  12051. }
  12052. if ( fn === false ) {
  12053. fn = returnFalse;
  12054. } else if ( !fn ) {
  12055. return elem;
  12056. }
  12057. if ( one === 1 ) {
  12058. origFn = fn;
  12059. fn = function( event ) {
  12060. // Can use an empty set, since event contains the info
  12061. jQuery().off( event );
  12062. return origFn.apply( this, arguments );
  12063. };
  12064. // Use same guid so caller can remove using origFn
  12065. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12066. }
  12067. return elem.each( function() {
  12068. jQuery.event.add( this, types, fn, data, selector );
  12069. } );
  12070. }
  12071. /*
  12072. * Helper functions for managing events -- not part of the public interface.
  12073. * Props to Dean Edwards' addEvent library for many of the ideas.
  12074. */
  12075. jQuery.event = {
  12076. global: {},
  12077. add: function( elem, types, handler, data, selector ) {
  12078. var handleObjIn, eventHandle, tmp,
  12079. events, t, handleObj,
  12080. special, handlers, type, namespaces, origType,
  12081. elemData = dataPriv.get( elem );
  12082. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12083. if ( !elemData ) {
  12084. return;
  12085. }
  12086. // Caller can pass in an object of custom data in lieu of the handler
  12087. if ( handler.handler ) {
  12088. handleObjIn = handler;
  12089. handler = handleObjIn.handler;
  12090. selector = handleObjIn.selector;
  12091. }
  12092. // Ensure that invalid selectors throw exceptions at attach time
  12093. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12094. if ( selector ) {
  12095. jQuery.find.matchesSelector( documentElement, selector );
  12096. }
  12097. // Make sure that the handler has a unique ID, used to find/remove it later
  12098. if ( !handler.guid ) {
  12099. handler.guid = jQuery.guid++;
  12100. }
  12101. // Init the element's event structure and main handler, if this is the first
  12102. if ( !( events = elemData.events ) ) {
  12103. events = elemData.events = {};
  12104. }
  12105. if ( !( eventHandle = elemData.handle ) ) {
  12106. eventHandle = elemData.handle = function( e ) {
  12107. // Discard the second event of a jQuery.event.trigger() and
  12108. // when an event is called after a page has unloaded
  12109. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12110. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12111. };
  12112. }
  12113. // Handle multiple events separated by a space
  12114. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12115. t = types.length;
  12116. while ( t-- ) {
  12117. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12118. type = origType = tmp[ 1 ];
  12119. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12120. // There *must* be a type, no attaching namespace-only handlers
  12121. if ( !type ) {
  12122. continue;
  12123. }
  12124. // If event changes its type, use the special event handlers for the changed type
  12125. special = jQuery.event.special[ type ] || {};
  12126. // If selector defined, determine special event api type, otherwise given type
  12127. type = ( selector ? special.delegateType : special.bindType ) || type;
  12128. // Update special based on newly reset type
  12129. special = jQuery.event.special[ type ] || {};
  12130. // handleObj is passed to all event handlers
  12131. handleObj = jQuery.extend( {
  12132. type: type,
  12133. origType: origType,
  12134. data: data,
  12135. handler: handler,
  12136. guid: handler.guid,
  12137. selector: selector,
  12138. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12139. namespace: namespaces.join( "." )
  12140. }, handleObjIn );
  12141. // Init the event handler queue if we're the first
  12142. if ( !( handlers = events[ type ] ) ) {
  12143. handlers = events[ type ] = [];
  12144. handlers.delegateCount = 0;
  12145. // Only use addEventListener if the special events handler returns false
  12146. if ( !special.setup ||
  12147. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12148. if ( elem.addEventListener ) {
  12149. elem.addEventListener( type, eventHandle );
  12150. }
  12151. }
  12152. }
  12153. if ( special.add ) {
  12154. special.add.call( elem, handleObj );
  12155. if ( !handleObj.handler.guid ) {
  12156. handleObj.handler.guid = handler.guid;
  12157. }
  12158. }
  12159. // Add to the element's handler list, delegates in front
  12160. if ( selector ) {
  12161. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12162. } else {
  12163. handlers.push( handleObj );
  12164. }
  12165. // Keep track of which events have ever been used, for event optimization
  12166. jQuery.event.global[ type ] = true;
  12167. }
  12168. },
  12169. // Detach an event or set of events from an element
  12170. remove: function( elem, types, handler, selector, mappedTypes ) {
  12171. var j, origCount, tmp,
  12172. events, t, handleObj,
  12173. special, handlers, type, namespaces, origType,
  12174. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12175. if ( !elemData || !( events = elemData.events ) ) {
  12176. return;
  12177. }
  12178. // Once for each type.namespace in types; type may be omitted
  12179. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12180. t = types.length;
  12181. while ( t-- ) {
  12182. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12183. type = origType = tmp[ 1 ];
  12184. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12185. // Unbind all events (on this namespace, if provided) for the element
  12186. if ( !type ) {
  12187. for ( type in events ) {
  12188. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12189. }
  12190. continue;
  12191. }
  12192. special = jQuery.event.special[ type ] || {};
  12193. type = ( selector ? special.delegateType : special.bindType ) || type;
  12194. handlers = events[ type ] || [];
  12195. tmp = tmp[ 2 ] &&
  12196. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12197. // Remove matching events
  12198. origCount = j = handlers.length;
  12199. while ( j-- ) {
  12200. handleObj = handlers[ j ];
  12201. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12202. ( !handler || handler.guid === handleObj.guid ) &&
  12203. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12204. ( !selector || selector === handleObj.selector ||
  12205. selector === "**" && handleObj.selector ) ) {
  12206. handlers.splice( j, 1 );
  12207. if ( handleObj.selector ) {
  12208. handlers.delegateCount--;
  12209. }
  12210. if ( special.remove ) {
  12211. special.remove.call( elem, handleObj );
  12212. }
  12213. }
  12214. }
  12215. // Remove generic event handler if we removed something and no more handlers exist
  12216. // (avoids potential for endless recursion during removal of special event handlers)
  12217. if ( origCount && !handlers.length ) {
  12218. if ( !special.teardown ||
  12219. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12220. jQuery.removeEvent( elem, type, elemData.handle );
  12221. }
  12222. delete events[ type ];
  12223. }
  12224. }
  12225. // Remove data and the expando if it's no longer used
  12226. if ( jQuery.isEmptyObject( events ) ) {
  12227. dataPriv.remove( elem, "handle events" );
  12228. }
  12229. },
  12230. dispatch: function( nativeEvent ) {
  12231. // Make a writable jQuery.Event from the native event object
  12232. var event = jQuery.event.fix( nativeEvent );
  12233. var i, j, ret, matched, handleObj, handlerQueue,
  12234. args = new Array( arguments.length ),
  12235. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12236. special = jQuery.event.special[ event.type ] || {};
  12237. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12238. args[ 0 ] = event;
  12239. for ( i = 1; i < arguments.length; i++ ) {
  12240. args[ i ] = arguments[ i ];
  12241. }
  12242. event.delegateTarget = this;
  12243. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12244. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12245. return;
  12246. }
  12247. // Determine handlers
  12248. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12249. // Run delegates first; they may want to stop propagation beneath us
  12250. i = 0;
  12251. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12252. event.currentTarget = matched.elem;
  12253. j = 0;
  12254. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12255. !event.isImmediatePropagationStopped() ) {
  12256. // If the event is namespaced, then each handler is only invoked if it is
  12257. // specially universal or its namespaces are a superset of the event's.
  12258. if ( !event.rnamespace || handleObj.namespace === false ||
  12259. event.rnamespace.test( handleObj.namespace ) ) {
  12260. event.handleObj = handleObj;
  12261. event.data = handleObj.data;
  12262. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12263. handleObj.handler ).apply( matched.elem, args );
  12264. if ( ret !== undefined ) {
  12265. if ( ( event.result = ret ) === false ) {
  12266. event.preventDefault();
  12267. event.stopPropagation();
  12268. }
  12269. }
  12270. }
  12271. }
  12272. }
  12273. // Call the postDispatch hook for the mapped type
  12274. if ( special.postDispatch ) {
  12275. special.postDispatch.call( this, event );
  12276. }
  12277. return event.result;
  12278. },
  12279. handlers: function( event, handlers ) {
  12280. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12281. handlerQueue = [],
  12282. delegateCount = handlers.delegateCount,
  12283. cur = event.target;
  12284. // Find delegate handlers
  12285. if ( delegateCount &&
  12286. // Support: IE <=9
  12287. // Black-hole SVG <use> instance trees (trac-13180)
  12288. cur.nodeType &&
  12289. // Support: Firefox <=42
  12290. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12291. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12292. // Support: IE 11 only
  12293. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12294. !( event.type === "click" && event.button >= 1 ) ) {
  12295. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12296. // Don't check non-elements (#13208)
  12297. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12298. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12299. matchedHandlers = [];
  12300. matchedSelectors = {};
  12301. for ( i = 0; i < delegateCount; i++ ) {
  12302. handleObj = handlers[ i ];
  12303. // Don't conflict with Object.prototype properties (#13203)
  12304. sel = handleObj.selector + " ";
  12305. if ( matchedSelectors[ sel ] === undefined ) {
  12306. matchedSelectors[ sel ] = handleObj.needsContext ?
  12307. jQuery( sel, this ).index( cur ) > -1 :
  12308. jQuery.find( sel, this, null, [ cur ] ).length;
  12309. }
  12310. if ( matchedSelectors[ sel ] ) {
  12311. matchedHandlers.push( handleObj );
  12312. }
  12313. }
  12314. if ( matchedHandlers.length ) {
  12315. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12316. }
  12317. }
  12318. }
  12319. }
  12320. // Add the remaining (directly-bound) handlers
  12321. cur = this;
  12322. if ( delegateCount < handlers.length ) {
  12323. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12324. }
  12325. return handlerQueue;
  12326. },
  12327. addProp: function( name, hook ) {
  12328. Object.defineProperty( jQuery.Event.prototype, name, {
  12329. enumerable: true,
  12330. configurable: true,
  12331. get: isFunction( hook ) ?
  12332. function() {
  12333. if ( this.originalEvent ) {
  12334. return hook( this.originalEvent );
  12335. }
  12336. } :
  12337. function() {
  12338. if ( this.originalEvent ) {
  12339. return this.originalEvent[ name ];
  12340. }
  12341. },
  12342. set: function( value ) {
  12343. Object.defineProperty( this, name, {
  12344. enumerable: true,
  12345. configurable: true,
  12346. writable: true,
  12347. value: value
  12348. } );
  12349. }
  12350. } );
  12351. },
  12352. fix: function( originalEvent ) {
  12353. return originalEvent[ jQuery.expando ] ?
  12354. originalEvent :
  12355. new jQuery.Event( originalEvent );
  12356. },
  12357. special: {
  12358. load: {
  12359. // Prevent triggered image.load events from bubbling to window.load
  12360. noBubble: true
  12361. },
  12362. click: {
  12363. // Utilize native event to ensure correct state for checkable inputs
  12364. setup: function( data ) {
  12365. // For mutual compressibility with _default, replace `this` access with a local var.
  12366. // `|| data` is dead code meant only to preserve the variable through minification.
  12367. var el = this || data;
  12368. // Claim the first handler
  12369. if ( rcheckableType.test( el.type ) &&
  12370. el.click && nodeName( el, "input" ) ) {
  12371. // dataPriv.set( el, "click", ... )
  12372. leverageNative( el, "click", returnTrue );
  12373. }
  12374. // Return false to allow normal processing in the caller
  12375. return false;
  12376. },
  12377. trigger: function( data ) {
  12378. // For mutual compressibility with _default, replace `this` access with a local var.
  12379. // `|| data` is dead code meant only to preserve the variable through minification.
  12380. var el = this || data;
  12381. // Force setup before triggering a click
  12382. if ( rcheckableType.test( el.type ) &&
  12383. el.click && nodeName( el, "input" ) ) {
  12384. leverageNative( el, "click" );
  12385. }
  12386. // Return non-false to allow normal event-path propagation
  12387. return true;
  12388. },
  12389. // For cross-browser consistency, suppress native .click() on links
  12390. // Also prevent it if we're currently inside a leveraged native-event stack
  12391. _default: function( event ) {
  12392. var target = event.target;
  12393. return rcheckableType.test( target.type ) &&
  12394. target.click && nodeName( target, "input" ) &&
  12395. dataPriv.get( target, "click" ) ||
  12396. nodeName( target, "a" );
  12397. }
  12398. },
  12399. beforeunload: {
  12400. postDispatch: function( event ) {
  12401. // Support: Firefox 20+
  12402. // Firefox doesn't alert if the returnValue field is not set.
  12403. if ( event.result !== undefined && event.originalEvent ) {
  12404. event.originalEvent.returnValue = event.result;
  12405. }
  12406. }
  12407. }
  12408. }
  12409. };
  12410. // Ensure the presence of an event listener that handles manually-triggered
  12411. // synthetic events by interrupting progress until reinvoked in response to
  12412. // *native* events that it fires directly, ensuring that state changes have
  12413. // already occurred before other listeners are invoked.
  12414. function leverageNative( el, type, expectSync ) {
  12415. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12416. if ( !expectSync ) {
  12417. if ( dataPriv.get( el, type ) === undefined ) {
  12418. jQuery.event.add( el, type, returnTrue );
  12419. }
  12420. return;
  12421. }
  12422. // Register the controller as a special universal handler for all event namespaces
  12423. dataPriv.set( el, type, false );
  12424. jQuery.event.add( el, type, {
  12425. namespace: false,
  12426. handler: function( event ) {
  12427. var notAsync, result,
  12428. saved = dataPriv.get( this, type );
  12429. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12430. // Interrupt processing of the outer synthetic .trigger()ed event
  12431. // Saved data should be false in such cases, but might be a leftover capture object
  12432. // from an async native handler (gh-4350)
  12433. if ( !saved.length ) {
  12434. // Store arguments for use when handling the inner native event
  12435. // There will always be at least one argument (an event object), so this array
  12436. // will not be confused with a leftover capture object.
  12437. saved = slice.call( arguments );
  12438. dataPriv.set( this, type, saved );
  12439. // Trigger the native event and capture its result
  12440. // Support: IE <=9 - 11+
  12441. // focus() and blur() are asynchronous
  12442. notAsync = expectSync( this, type );
  12443. this[ type ]();
  12444. result = dataPriv.get( this, type );
  12445. if ( saved !== result || notAsync ) {
  12446. dataPriv.set( this, type, false );
  12447. } else {
  12448. result = {};
  12449. }
  12450. if ( saved !== result ) {
  12451. // Cancel the outer synthetic event
  12452. event.stopImmediatePropagation();
  12453. event.preventDefault();
  12454. return result.value;
  12455. }
  12456. // If this is an inner synthetic event for an event with a bubbling surrogate
  12457. // (focus or blur), assume that the surrogate already propagated from triggering the
  12458. // native event and prevent that from happening again here.
  12459. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12460. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12461. // less bad than duplication.
  12462. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12463. event.stopPropagation();
  12464. }
  12465. // If this is a native event triggered above, everything is now in order
  12466. // Fire an inner synthetic event with the original arguments
  12467. } else if ( saved.length ) {
  12468. // ...and capture the result
  12469. dataPriv.set( this, type, {
  12470. value: jQuery.event.trigger(
  12471. // Support: IE <=9 - 11+
  12472. // Extend with the prototype to reset the above stopImmediatePropagation()
  12473. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12474. saved.slice( 1 ),
  12475. this
  12476. )
  12477. } );
  12478. // Abort handling of the native event
  12479. event.stopImmediatePropagation();
  12480. }
  12481. }
  12482. } );
  12483. }
  12484. jQuery.removeEvent = function( elem, type, handle ) {
  12485. // This "if" is needed for plain objects
  12486. if ( elem.removeEventListener ) {
  12487. elem.removeEventListener( type, handle );
  12488. }
  12489. };
  12490. jQuery.Event = function( src, props ) {
  12491. // Allow instantiation without the 'new' keyword
  12492. if ( !( this instanceof jQuery.Event ) ) {
  12493. return new jQuery.Event( src, props );
  12494. }
  12495. // Event object
  12496. if ( src && src.type ) {
  12497. this.originalEvent = src;
  12498. this.type = src.type;
  12499. // Events bubbling up the document may have been marked as prevented
  12500. // by a handler lower down the tree; reflect the correct value.
  12501. this.isDefaultPrevented = src.defaultPrevented ||
  12502. src.defaultPrevented === undefined &&
  12503. // Support: Android <=2.3 only
  12504. src.returnValue === false ?
  12505. returnTrue :
  12506. returnFalse;
  12507. // Create target properties
  12508. // Support: Safari <=6 - 7 only
  12509. // Target should not be a text node (#504, #13143)
  12510. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12511. src.target.parentNode :
  12512. src.target;
  12513. this.currentTarget = src.currentTarget;
  12514. this.relatedTarget = src.relatedTarget;
  12515. // Event type
  12516. } else {
  12517. this.type = src;
  12518. }
  12519. // Put explicitly provided properties onto the event object
  12520. if ( props ) {
  12521. jQuery.extend( this, props );
  12522. }
  12523. // Create a timestamp if incoming event doesn't have one
  12524. this.timeStamp = src && src.timeStamp || Date.now();
  12525. // Mark it as fixed
  12526. this[ jQuery.expando ] = true;
  12527. };
  12528. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12529. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12530. jQuery.Event.prototype = {
  12531. constructor: jQuery.Event,
  12532. isDefaultPrevented: returnFalse,
  12533. isPropagationStopped: returnFalse,
  12534. isImmediatePropagationStopped: returnFalse,
  12535. isSimulated: false,
  12536. preventDefault: function() {
  12537. var e = this.originalEvent;
  12538. this.isDefaultPrevented = returnTrue;
  12539. if ( e && !this.isSimulated ) {
  12540. e.preventDefault();
  12541. }
  12542. },
  12543. stopPropagation: function() {
  12544. var e = this.originalEvent;
  12545. this.isPropagationStopped = returnTrue;
  12546. if ( e && !this.isSimulated ) {
  12547. e.stopPropagation();
  12548. }
  12549. },
  12550. stopImmediatePropagation: function() {
  12551. var e = this.originalEvent;
  12552. this.isImmediatePropagationStopped = returnTrue;
  12553. if ( e && !this.isSimulated ) {
  12554. e.stopImmediatePropagation();
  12555. }
  12556. this.stopPropagation();
  12557. }
  12558. };
  12559. // Includes all common event props including KeyEvent and MouseEvent specific props
  12560. jQuery.each( {
  12561. altKey: true,
  12562. bubbles: true,
  12563. cancelable: true,
  12564. changedTouches: true,
  12565. ctrlKey: true,
  12566. detail: true,
  12567. eventPhase: true,
  12568. metaKey: true,
  12569. pageX: true,
  12570. pageY: true,
  12571. shiftKey: true,
  12572. view: true,
  12573. "char": true,
  12574. code: true,
  12575. charCode: true,
  12576. key: true,
  12577. keyCode: true,
  12578. button: true,
  12579. buttons: true,
  12580. clientX: true,
  12581. clientY: true,
  12582. offsetX: true,
  12583. offsetY: true,
  12584. pointerId: true,
  12585. pointerType: true,
  12586. screenX: true,
  12587. screenY: true,
  12588. targetTouches: true,
  12589. toElement: true,
  12590. touches: true,
  12591. which: function( event ) {
  12592. var button = event.button;
  12593. // Add which for key events
  12594. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12595. return event.charCode != null ? event.charCode : event.keyCode;
  12596. }
  12597. // Add which for click: 1 === left; 2 === middle; 3 === right
  12598. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12599. if ( button & 1 ) {
  12600. return 1;
  12601. }
  12602. if ( button & 2 ) {
  12603. return 3;
  12604. }
  12605. if ( button & 4 ) {
  12606. return 2;
  12607. }
  12608. return 0;
  12609. }
  12610. return event.which;
  12611. }
  12612. }, jQuery.event.addProp );
  12613. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12614. jQuery.event.special[ type ] = {
  12615. // Utilize native event if possible so blur/focus sequence is correct
  12616. setup: function() {
  12617. // Claim the first handler
  12618. // dataPriv.set( this, "focus", ... )
  12619. // dataPriv.set( this, "blur", ... )
  12620. leverageNative( this, type, expectSync );
  12621. // Return false to allow normal processing in the caller
  12622. return false;
  12623. },
  12624. trigger: function() {
  12625. // Force setup before trigger
  12626. leverageNative( this, type );
  12627. // Return non-false to allow normal event-path propagation
  12628. return true;
  12629. },
  12630. delegateType: delegateType
  12631. };
  12632. } );
  12633. // Create mouseenter/leave events using mouseover/out and event-time checks
  12634. // so that event delegation works in jQuery.
  12635. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12636. //
  12637. // Support: Safari 7 only
  12638. // Safari sends mouseenter too often; see:
  12639. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12640. // for the description of the bug (it existed in older Chrome versions as well).
  12641. jQuery.each( {
  12642. mouseenter: "mouseover",
  12643. mouseleave: "mouseout",
  12644. pointerenter: "pointerover",
  12645. pointerleave: "pointerout"
  12646. }, function( orig, fix ) {
  12647. jQuery.event.special[ orig ] = {
  12648. delegateType: fix,
  12649. bindType: fix,
  12650. handle: function( event ) {
  12651. var ret,
  12652. target = this,
  12653. related = event.relatedTarget,
  12654. handleObj = event.handleObj;
  12655. // For mouseenter/leave call the handler if related is outside the target.
  12656. // NB: No relatedTarget if the mouse left/entered the browser window
  12657. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12658. event.type = handleObj.origType;
  12659. ret = handleObj.handler.apply( this, arguments );
  12660. event.type = fix;
  12661. }
  12662. return ret;
  12663. }
  12664. };
  12665. } );
  12666. jQuery.fn.extend( {
  12667. on: function( types, selector, data, fn ) {
  12668. return on( this, types, selector, data, fn );
  12669. },
  12670. one: function( types, selector, data, fn ) {
  12671. return on( this, types, selector, data, fn, 1 );
  12672. },
  12673. off: function( types, selector, fn ) {
  12674. var handleObj, type;
  12675. if ( types && types.preventDefault && types.handleObj ) {
  12676. // ( event ) dispatched jQuery.Event
  12677. handleObj = types.handleObj;
  12678. jQuery( types.delegateTarget ).off(
  12679. handleObj.namespace ?
  12680. handleObj.origType + "." + handleObj.namespace :
  12681. handleObj.origType,
  12682. handleObj.selector,
  12683. handleObj.handler
  12684. );
  12685. return this;
  12686. }
  12687. if ( typeof types === "object" ) {
  12688. // ( types-object [, selector] )
  12689. for ( type in types ) {
  12690. this.off( type, selector, types[ type ] );
  12691. }
  12692. return this;
  12693. }
  12694. if ( selector === false || typeof selector === "function" ) {
  12695. // ( types [, fn] )
  12696. fn = selector;
  12697. selector = undefined;
  12698. }
  12699. if ( fn === false ) {
  12700. fn = returnFalse;
  12701. }
  12702. return this.each( function() {
  12703. jQuery.event.remove( this, types, fn, selector );
  12704. } );
  12705. }
  12706. } );
  12707. var
  12708. /* eslint-disable max-len */
  12709. // See https://github.com/eslint/eslint/issues/3229
  12710. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  12711. /* eslint-enable */
  12712. // Support: IE <=10 - 11, Edge 12 - 13 only
  12713. // In IE/Edge using regex groups here causes severe slowdowns.
  12714. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  12715. rnoInnerhtml = /<script|<style|<link/i,
  12716. // checked="checked" or checked
  12717. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  12718. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  12719. // Prefer a tbody over its parent table for containing new rows
  12720. function manipulationTarget( elem, content ) {
  12721. if ( nodeName( elem, "table" ) &&
  12722. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  12723. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  12724. }
  12725. return elem;
  12726. }
  12727. // Replace/restore the type attribute of script elements for safe DOM manipulation
  12728. function disableScript( elem ) {
  12729. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  12730. return elem;
  12731. }
  12732. function restoreScript( elem ) {
  12733. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  12734. elem.type = elem.type.slice( 5 );
  12735. } else {
  12736. elem.removeAttribute( "type" );
  12737. }
  12738. return elem;
  12739. }
  12740. function cloneCopyEvent( src, dest ) {
  12741. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  12742. if ( dest.nodeType !== 1 ) {
  12743. return;
  12744. }
  12745. // 1. Copy private data: events, handlers, etc.
  12746. if ( dataPriv.hasData( src ) ) {
  12747. pdataOld = dataPriv.access( src );
  12748. pdataCur = dataPriv.set( dest, pdataOld );
  12749. events = pdataOld.events;
  12750. if ( events ) {
  12751. delete pdataCur.handle;
  12752. pdataCur.events = {};
  12753. for ( type in events ) {
  12754. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  12755. jQuery.event.add( dest, type, events[ type ][ i ] );
  12756. }
  12757. }
  12758. }
  12759. }
  12760. // 2. Copy user data
  12761. if ( dataUser.hasData( src ) ) {
  12762. udataOld = dataUser.access( src );
  12763. udataCur = jQuery.extend( {}, udataOld );
  12764. dataUser.set( dest, udataCur );
  12765. }
  12766. }
  12767. // Fix IE bugs, see support tests
  12768. function fixInput( src, dest ) {
  12769. var nodeName = dest.nodeName.toLowerCase();
  12770. // Fails to persist the checked state of a cloned checkbox or radio button.
  12771. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  12772. dest.checked = src.checked;
  12773. // Fails to return the selected option to the default selected state when cloning options
  12774. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  12775. dest.defaultValue = src.defaultValue;
  12776. }
  12777. }
  12778. function domManip( collection, args, callback, ignored ) {
  12779. // Flatten any nested arrays
  12780. args = concat.apply( [], args );
  12781. var fragment, first, scripts, hasScripts, node, doc,
  12782. i = 0,
  12783. l = collection.length,
  12784. iNoClone = l - 1,
  12785. value = args[ 0 ],
  12786. valueIsFunction = isFunction( value );
  12787. // We can't cloneNode fragments that contain checked, in WebKit
  12788. if ( valueIsFunction ||
  12789. ( l > 1 && typeof value === "string" &&
  12790. !support.checkClone && rchecked.test( value ) ) ) {
  12791. return collection.each( function( index ) {
  12792. var self = collection.eq( index );
  12793. if ( valueIsFunction ) {
  12794. args[ 0 ] = value.call( this, index, self.html() );
  12795. }
  12796. domManip( self, args, callback, ignored );
  12797. } );
  12798. }
  12799. if ( l ) {
  12800. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  12801. first = fragment.firstChild;
  12802. if ( fragment.childNodes.length === 1 ) {
  12803. fragment = first;
  12804. }
  12805. // Require either new content or an interest in ignored elements to invoke the callback
  12806. if ( first || ignored ) {
  12807. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  12808. hasScripts = scripts.length;
  12809. // Use the original fragment for the last item
  12810. // instead of the first because it can end up
  12811. // being emptied incorrectly in certain situations (#8070).
  12812. for ( ; i < l; i++ ) {
  12813. node = fragment;
  12814. if ( i !== iNoClone ) {
  12815. node = jQuery.clone( node, true, true );
  12816. // Keep references to cloned scripts for later restoration
  12817. if ( hasScripts ) {
  12818. // Support: Android <=4.0 only, PhantomJS 1 only
  12819. // push.apply(_, arraylike) throws on ancient WebKit
  12820. jQuery.merge( scripts, getAll( node, "script" ) );
  12821. }
  12822. }
  12823. callback.call( collection[ i ], node, i );
  12824. }
  12825. if ( hasScripts ) {
  12826. doc = scripts[ scripts.length - 1 ].ownerDocument;
  12827. // Reenable scripts
  12828. jQuery.map( scripts, restoreScript );
  12829. // Evaluate executable scripts on first document insertion
  12830. for ( i = 0; i < hasScripts; i++ ) {
  12831. node = scripts[ i ];
  12832. if ( rscriptType.test( node.type || "" ) &&
  12833. !dataPriv.access( node, "globalEval" ) &&
  12834. jQuery.contains( doc, node ) ) {
  12835. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  12836. // Optional AJAX dependency, but won't run scripts if not present
  12837. if ( jQuery._evalUrl && !node.noModule ) {
  12838. jQuery._evalUrl( node.src, {
  12839. nonce: node.nonce || node.getAttribute( "nonce" )
  12840. } );
  12841. }
  12842. } else {
  12843. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  12844. }
  12845. }
  12846. }
  12847. }
  12848. }
  12849. }
  12850. return collection;
  12851. }
  12852. function remove( elem, selector, keepData ) {
  12853. var node,
  12854. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  12855. i = 0;
  12856. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  12857. if ( !keepData && node.nodeType === 1 ) {
  12858. jQuery.cleanData( getAll( node ) );
  12859. }
  12860. if ( node.parentNode ) {
  12861. if ( keepData && isAttached( node ) ) {
  12862. setGlobalEval( getAll( node, "script" ) );
  12863. }
  12864. node.parentNode.removeChild( node );
  12865. }
  12866. }
  12867. return elem;
  12868. }
  12869. jQuery.extend( {
  12870. htmlPrefilter: function( html ) {
  12871. return html.replace( rxhtmlTag, "<$1></$2>" );
  12872. },
  12873. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  12874. var i, l, srcElements, destElements,
  12875. clone = elem.cloneNode( true ),
  12876. inPage = isAttached( elem );
  12877. // Fix IE cloning issues
  12878. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  12879. !jQuery.isXMLDoc( elem ) ) {
  12880. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  12881. destElements = getAll( clone );
  12882. srcElements = getAll( elem );
  12883. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  12884. fixInput( srcElements[ i ], destElements[ i ] );
  12885. }
  12886. }
  12887. // Copy the events from the original to the clone
  12888. if ( dataAndEvents ) {
  12889. if ( deepDataAndEvents ) {
  12890. srcElements = srcElements || getAll( elem );
  12891. destElements = destElements || getAll( clone );
  12892. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  12893. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  12894. }
  12895. } else {
  12896. cloneCopyEvent( elem, clone );
  12897. }
  12898. }
  12899. // Preserve script evaluation history
  12900. destElements = getAll( clone, "script" );
  12901. if ( destElements.length > 0 ) {
  12902. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  12903. }
  12904. // Return the cloned set
  12905. return clone;
  12906. },
  12907. cleanData: function( elems ) {
  12908. var data, elem, type,
  12909. special = jQuery.event.special,
  12910. i = 0;
  12911. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  12912. if ( acceptData( elem ) ) {
  12913. if ( ( data = elem[ dataPriv.expando ] ) ) {
  12914. if ( data.events ) {
  12915. for ( type in data.events ) {
  12916. if ( special[ type ] ) {
  12917. jQuery.event.remove( elem, type );
  12918. // This is a shortcut to avoid jQuery.event.remove's overhead
  12919. } else {
  12920. jQuery.removeEvent( elem, type, data.handle );
  12921. }
  12922. }
  12923. }
  12924. // Support: Chrome <=35 - 45+
  12925. // Assign undefined instead of using delete, see Data#remove
  12926. elem[ dataPriv.expando ] = undefined;
  12927. }
  12928. if ( elem[ dataUser.expando ] ) {
  12929. // Support: Chrome <=35 - 45+
  12930. // Assign undefined instead of using delete, see Data#remove
  12931. elem[ dataUser.expando ] = undefined;
  12932. }
  12933. }
  12934. }
  12935. }
  12936. } );
  12937. jQuery.fn.extend( {
  12938. detach: function( selector ) {
  12939. return remove( this, selector, true );
  12940. },
  12941. remove: function( selector ) {
  12942. return remove( this, selector );
  12943. },
  12944. text: function( value ) {
  12945. return access( this, function( value ) {
  12946. return value === undefined ?
  12947. jQuery.text( this ) :
  12948. this.empty().each( function() {
  12949. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  12950. this.textContent = value;
  12951. }
  12952. } );
  12953. }, null, value, arguments.length );
  12954. },
  12955. append: function() {
  12956. return domManip( this, arguments, function( elem ) {
  12957. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  12958. var target = manipulationTarget( this, elem );
  12959. target.appendChild( elem );
  12960. }
  12961. } );
  12962. },
  12963. prepend: function() {
  12964. return domManip( this, arguments, function( elem ) {
  12965. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  12966. var target = manipulationTarget( this, elem );
  12967. target.insertBefore( elem, target.firstChild );
  12968. }
  12969. } );
  12970. },
  12971. before: function() {
  12972. return domManip( this, arguments, function( elem ) {
  12973. if ( this.parentNode ) {
  12974. this.parentNode.insertBefore( elem, this );
  12975. }
  12976. } );
  12977. },
  12978. after: function() {
  12979. return domManip( this, arguments, function( elem ) {
  12980. if ( this.parentNode ) {
  12981. this.parentNode.insertBefore( elem, this.nextSibling );
  12982. }
  12983. } );
  12984. },
  12985. empty: function() {
  12986. var elem,
  12987. i = 0;
  12988. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  12989. if ( elem.nodeType === 1 ) {
  12990. // Prevent memory leaks
  12991. jQuery.cleanData( getAll( elem, false ) );
  12992. // Remove any remaining nodes
  12993. elem.textContent = "";
  12994. }
  12995. }
  12996. return this;
  12997. },
  12998. clone: function( dataAndEvents, deepDataAndEvents ) {
  12999. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13000. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13001. return this.map( function() {
  13002. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13003. } );
  13004. },
  13005. html: function( value ) {
  13006. return access( this, function( value ) {
  13007. var elem = this[ 0 ] || {},
  13008. i = 0,
  13009. l = this.length;
  13010. if ( value === undefined && elem.nodeType === 1 ) {
  13011. return elem.innerHTML;
  13012. }
  13013. // See if we can take a shortcut and just use innerHTML
  13014. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13015. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13016. value = jQuery.htmlPrefilter( value );
  13017. try {
  13018. for ( ; i < l; i++ ) {
  13019. elem = this[ i ] || {};
  13020. // Remove element nodes and prevent memory leaks
  13021. if ( elem.nodeType === 1 ) {
  13022. jQuery.cleanData( getAll( elem, false ) );
  13023. elem.innerHTML = value;
  13024. }
  13025. }
  13026. elem = 0;
  13027. // If using innerHTML throws an exception, use the fallback method
  13028. } catch ( e ) {}
  13029. }
  13030. if ( elem ) {
  13031. this.empty().append( value );
  13032. }
  13033. }, null, value, arguments.length );
  13034. },
  13035. replaceWith: function() {
  13036. var ignored = [];
  13037. // Make the changes, replacing each non-ignored context element with the new content
  13038. return domManip( this, arguments, function( elem ) {
  13039. var parent = this.parentNode;
  13040. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13041. jQuery.cleanData( getAll( this ) );
  13042. if ( parent ) {
  13043. parent.replaceChild( elem, this );
  13044. }
  13045. }
  13046. // Force callback invocation
  13047. }, ignored );
  13048. }
  13049. } );
  13050. jQuery.each( {
  13051. appendTo: "append",
  13052. prependTo: "prepend",
  13053. insertBefore: "before",
  13054. insertAfter: "after",
  13055. replaceAll: "replaceWith"
  13056. }, function( name, original ) {
  13057. jQuery.fn[ name ] = function( selector ) {
  13058. var elems,
  13059. ret = [],
  13060. insert = jQuery( selector ),
  13061. last = insert.length - 1,
  13062. i = 0;
  13063. for ( ; i <= last; i++ ) {
  13064. elems = i === last ? this : this.clone( true );
  13065. jQuery( insert[ i ] )[ original ]( elems );
  13066. // Support: Android <=4.0 only, PhantomJS 1 only
  13067. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13068. push.apply( ret, elems.get() );
  13069. }
  13070. return this.pushStack( ret );
  13071. };
  13072. } );
  13073. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13074. var getStyles = function( elem ) {
  13075. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13076. // IE throws on elements created in popups
  13077. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13078. var view = elem.ownerDocument.defaultView;
  13079. if ( !view || !view.opener ) {
  13080. view = window;
  13081. }
  13082. return view.getComputedStyle( elem );
  13083. };
  13084. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13085. ( function() {
  13086. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13087. // so they're executed at the same time to save the second computation.
  13088. function computeStyleTests() {
  13089. // This is a singleton, we need to execute it only once
  13090. if ( !div ) {
  13091. return;
  13092. }
  13093. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13094. "margin-top:1px;padding:0;border:0";
  13095. div.style.cssText =
  13096. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13097. "margin:auto;border:1px;padding:1px;" +
  13098. "width:60%;top:1%";
  13099. documentElement.appendChild( container ).appendChild( div );
  13100. var divStyle = window.getComputedStyle( div );
  13101. pixelPositionVal = divStyle.top !== "1%";
  13102. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13103. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13104. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13105. // Some styles come back with percentage values, even though they shouldn't
  13106. div.style.right = "60%";
  13107. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13108. // Support: IE 9 - 11 only
  13109. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13110. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13111. // Support: IE 9 only
  13112. // Detect overflow:scroll screwiness (gh-3699)
  13113. // Support: Chrome <=64
  13114. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13115. div.style.position = "absolute";
  13116. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13117. documentElement.removeChild( container );
  13118. // Nullify the div so it wouldn't be stored in the memory and
  13119. // it will also be a sign that checks already performed
  13120. div = null;
  13121. }
  13122. function roundPixelMeasures( measure ) {
  13123. return Math.round( parseFloat( measure ) );
  13124. }
  13125. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13126. reliableMarginLeftVal,
  13127. container = document.createElement( "div" ),
  13128. div = document.createElement( "div" );
  13129. // Finish early in limited (non-browser) environments
  13130. if ( !div.style ) {
  13131. return;
  13132. }
  13133. // Support: IE <=9 - 11 only
  13134. // Style of cloned element affects source element cloned (#8908)
  13135. div.style.backgroundClip = "content-box";
  13136. div.cloneNode( true ).style.backgroundClip = "";
  13137. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13138. jQuery.extend( support, {
  13139. boxSizingReliable: function() {
  13140. computeStyleTests();
  13141. return boxSizingReliableVal;
  13142. },
  13143. pixelBoxStyles: function() {
  13144. computeStyleTests();
  13145. return pixelBoxStylesVal;
  13146. },
  13147. pixelPosition: function() {
  13148. computeStyleTests();
  13149. return pixelPositionVal;
  13150. },
  13151. reliableMarginLeft: function() {
  13152. computeStyleTests();
  13153. return reliableMarginLeftVal;
  13154. },
  13155. scrollboxSize: function() {
  13156. computeStyleTests();
  13157. return scrollboxSizeVal;
  13158. }
  13159. } );
  13160. } )();
  13161. function curCSS( elem, name, computed ) {
  13162. var width, minWidth, maxWidth, ret,
  13163. // Support: Firefox 51+
  13164. // Retrieving style before computed somehow
  13165. // fixes an issue with getting wrong values
  13166. // on detached elements
  13167. style = elem.style;
  13168. computed = computed || getStyles( elem );
  13169. // getPropertyValue is needed for:
  13170. // .css('filter') (IE 9 only, #12537)
  13171. // .css('--customProperty) (#3144)
  13172. if ( computed ) {
  13173. ret = computed.getPropertyValue( name ) || computed[ name ];
  13174. if ( ret === "" && !isAttached( elem ) ) {
  13175. ret = jQuery.style( elem, name );
  13176. }
  13177. // A tribute to the "awesome hack by Dean Edwards"
  13178. // Android Browser returns percentage for some values,
  13179. // but width seems to be reliably pixels.
  13180. // This is against the CSSOM draft spec:
  13181. // https://drafts.csswg.org/cssom/#resolved-values
  13182. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13183. // Remember the original values
  13184. width = style.width;
  13185. minWidth = style.minWidth;
  13186. maxWidth = style.maxWidth;
  13187. // Put in the new values to get a computed value out
  13188. style.minWidth = style.maxWidth = style.width = ret;
  13189. ret = computed.width;
  13190. // Revert the changed values
  13191. style.width = width;
  13192. style.minWidth = minWidth;
  13193. style.maxWidth = maxWidth;
  13194. }
  13195. }
  13196. return ret !== undefined ?
  13197. // Support: IE <=9 - 11 only
  13198. // IE returns zIndex value as an integer.
  13199. ret + "" :
  13200. ret;
  13201. }
  13202. function addGetHookIf( conditionFn, hookFn ) {
  13203. // Define the hook, we'll check on the first run if it's really needed.
  13204. return {
  13205. get: function() {
  13206. if ( conditionFn() ) {
  13207. // Hook not needed (or it's not possible to use it due
  13208. // to missing dependency), remove it.
  13209. delete this.get;
  13210. return;
  13211. }
  13212. // Hook needed; redefine it so that the support test is not executed again.
  13213. return ( this.get = hookFn ).apply( this, arguments );
  13214. }
  13215. };
  13216. }
  13217. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13218. emptyStyle = document.createElement( "div" ).style,
  13219. vendorProps = {};
  13220. // Return a vendor-prefixed property or undefined
  13221. function vendorPropName( name ) {
  13222. // Check for vendor prefixed names
  13223. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13224. i = cssPrefixes.length;
  13225. while ( i-- ) {
  13226. name = cssPrefixes[ i ] + capName;
  13227. if ( name in emptyStyle ) {
  13228. return name;
  13229. }
  13230. }
  13231. }
  13232. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13233. function finalPropName( name ) {
  13234. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13235. if ( final ) {
  13236. return final;
  13237. }
  13238. if ( name in emptyStyle ) {
  13239. return name;
  13240. }
  13241. return vendorProps[ name ] = vendorPropName( name ) || name;
  13242. }
  13243. var
  13244. // Swappable if display is none or starts with table
  13245. // except "table", "table-cell", or "table-caption"
  13246. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13247. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13248. rcustomProp = /^--/,
  13249. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13250. cssNormalTransform = {
  13251. letterSpacing: "0",
  13252. fontWeight: "400"
  13253. };
  13254. function setPositiveNumber( elem, value, subtract ) {
  13255. // Any relative (+/-) values have already been
  13256. // normalized at this point
  13257. var matches = rcssNum.exec( value );
  13258. return matches ?
  13259. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13260. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13261. value;
  13262. }
  13263. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13264. var i = dimension === "width" ? 1 : 0,
  13265. extra = 0,
  13266. delta = 0;
  13267. // Adjustment may not be necessary
  13268. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13269. return 0;
  13270. }
  13271. for ( ; i < 4; i += 2 ) {
  13272. // Both box models exclude margin
  13273. if ( box === "margin" ) {
  13274. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13275. }
  13276. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13277. if ( !isBorderBox ) {
  13278. // Add padding
  13279. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13280. // For "border" or "margin", add border
  13281. if ( box !== "padding" ) {
  13282. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13283. // But still keep track of it otherwise
  13284. } else {
  13285. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13286. }
  13287. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13288. // "padding" or "margin"
  13289. } else {
  13290. // For "content", subtract padding
  13291. if ( box === "content" ) {
  13292. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13293. }
  13294. // For "content" or "padding", subtract border
  13295. if ( box !== "margin" ) {
  13296. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13297. }
  13298. }
  13299. }
  13300. // Account for positive content-box scroll gutter when requested by providing computedVal
  13301. if ( !isBorderBox && computedVal >= 0 ) {
  13302. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13303. // Assuming integer scroll gutter, subtract the rest and round down
  13304. delta += Math.max( 0, Math.ceil(
  13305. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13306. computedVal -
  13307. delta -
  13308. extra -
  13309. 0.5
  13310. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13311. // Use an explicit zero to avoid NaN (gh-3964)
  13312. ) ) || 0;
  13313. }
  13314. return delta;
  13315. }
  13316. function getWidthOrHeight( elem, dimension, extra ) {
  13317. // Start with computed style
  13318. var styles = getStyles( elem ),
  13319. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13320. // Fake content-box until we know it's needed to know the true value.
  13321. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13322. isBorderBox = boxSizingNeeded &&
  13323. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13324. valueIsBorderBox = isBorderBox,
  13325. val = curCSS( elem, dimension, styles ),
  13326. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13327. // Support: Firefox <=54
  13328. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13329. if ( rnumnonpx.test( val ) ) {
  13330. if ( !extra ) {
  13331. return val;
  13332. }
  13333. val = "auto";
  13334. }
  13335. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13336. // This happens for inline elements with no explicit setting (gh-3571)
  13337. // Support: Android <=4.1 - 4.3 only
  13338. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13339. // Support: IE 9-11 only
  13340. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13341. // We use getClientRects() to check for hidden/disconnected.
  13342. // In those cases, the computed value can be trusted to be border-box
  13343. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13344. val === "auto" ||
  13345. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13346. elem.getClientRects().length ) {
  13347. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13348. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13349. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13350. // retrieved value as a content box dimension.
  13351. valueIsBorderBox = offsetProp in elem;
  13352. if ( valueIsBorderBox ) {
  13353. val = elem[ offsetProp ];
  13354. }
  13355. }
  13356. // Normalize "" and auto
  13357. val = parseFloat( val ) || 0;
  13358. // Adjust for the element's box model
  13359. return ( val +
  13360. boxModelAdjustment(
  13361. elem,
  13362. dimension,
  13363. extra || ( isBorderBox ? "border" : "content" ),
  13364. valueIsBorderBox,
  13365. styles,
  13366. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13367. val
  13368. )
  13369. ) + "px";
  13370. }
  13371. jQuery.extend( {
  13372. // Add in style property hooks for overriding the default
  13373. // behavior of getting and setting a style property
  13374. cssHooks: {
  13375. opacity: {
  13376. get: function( elem, computed ) {
  13377. if ( computed ) {
  13378. // We should always get a number back from opacity
  13379. var ret = curCSS( elem, "opacity" );
  13380. return ret === "" ? "1" : ret;
  13381. }
  13382. }
  13383. }
  13384. },
  13385. // Don't automatically add "px" to these possibly-unitless properties
  13386. cssNumber: {
  13387. "animationIterationCount": true,
  13388. "columnCount": true,
  13389. "fillOpacity": true,
  13390. "flexGrow": true,
  13391. "flexShrink": true,
  13392. "fontWeight": true,
  13393. "gridArea": true,
  13394. "gridColumn": true,
  13395. "gridColumnEnd": true,
  13396. "gridColumnStart": true,
  13397. "gridRow": true,
  13398. "gridRowEnd": true,
  13399. "gridRowStart": true,
  13400. "lineHeight": true,
  13401. "opacity": true,
  13402. "order": true,
  13403. "orphans": true,
  13404. "widows": true,
  13405. "zIndex": true,
  13406. "zoom": true
  13407. },
  13408. // Add in properties whose names you wish to fix before
  13409. // setting or getting the value
  13410. cssProps: {},
  13411. // Get and set the style property on a DOM Node
  13412. style: function( elem, name, value, extra ) {
  13413. // Don't set styles on text and comment nodes
  13414. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13415. return;
  13416. }
  13417. // Make sure that we're working with the right name
  13418. var ret, type, hooks,
  13419. origName = camelCase( name ),
  13420. isCustomProp = rcustomProp.test( name ),
  13421. style = elem.style;
  13422. // Make sure that we're working with the right name. We don't
  13423. // want to query the value if it is a CSS custom property
  13424. // since they are user-defined.
  13425. if ( !isCustomProp ) {
  13426. name = finalPropName( origName );
  13427. }
  13428. // Gets hook for the prefixed version, then unprefixed version
  13429. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13430. // Check if we're setting a value
  13431. if ( value !== undefined ) {
  13432. type = typeof value;
  13433. // Convert "+=" or "-=" to relative numbers (#7345)
  13434. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13435. value = adjustCSS( elem, name, ret );
  13436. // Fixes bug #9237
  13437. type = "number";
  13438. }
  13439. // Make sure that null and NaN values aren't set (#7116)
  13440. if ( value == null || value !== value ) {
  13441. return;
  13442. }
  13443. // If a number was passed in, add the unit (except for certain CSS properties)
  13444. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13445. // "px" to a few hardcoded values.
  13446. if ( type === "number" && !isCustomProp ) {
  13447. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13448. }
  13449. // background-* props affect original clone's values
  13450. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13451. style[ name ] = "inherit";
  13452. }
  13453. // If a hook was provided, use that value, otherwise just set the specified value
  13454. if ( !hooks || !( "set" in hooks ) ||
  13455. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13456. if ( isCustomProp ) {
  13457. style.setProperty( name, value );
  13458. } else {
  13459. style[ name ] = value;
  13460. }
  13461. }
  13462. } else {
  13463. // If a hook was provided get the non-computed value from there
  13464. if ( hooks && "get" in hooks &&
  13465. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13466. return ret;
  13467. }
  13468. // Otherwise just get the value from the style object
  13469. return style[ name ];
  13470. }
  13471. },
  13472. css: function( elem, name, extra, styles ) {
  13473. var val, num, hooks,
  13474. origName = camelCase( name ),
  13475. isCustomProp = rcustomProp.test( name );
  13476. // Make sure that we're working with the right name. We don't
  13477. // want to modify the value if it is a CSS custom property
  13478. // since they are user-defined.
  13479. if ( !isCustomProp ) {
  13480. name = finalPropName( origName );
  13481. }
  13482. // Try prefixed name followed by the unprefixed name
  13483. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13484. // If a hook was provided get the computed value from there
  13485. if ( hooks && "get" in hooks ) {
  13486. val = hooks.get( elem, true, extra );
  13487. }
  13488. // Otherwise, if a way to get the computed value exists, use that
  13489. if ( val === undefined ) {
  13490. val = curCSS( elem, name, styles );
  13491. }
  13492. // Convert "normal" to computed value
  13493. if ( val === "normal" && name in cssNormalTransform ) {
  13494. val = cssNormalTransform[ name ];
  13495. }
  13496. // Make numeric if forced or a qualifier was provided and val looks numeric
  13497. if ( extra === "" || extra ) {
  13498. num = parseFloat( val );
  13499. return extra === true || isFinite( num ) ? num || 0 : val;
  13500. }
  13501. return val;
  13502. }
  13503. } );
  13504. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13505. jQuery.cssHooks[ dimension ] = {
  13506. get: function( elem, computed, extra ) {
  13507. if ( computed ) {
  13508. // Certain elements can have dimension info if we invisibly show them
  13509. // but it must have a current display style that would benefit
  13510. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13511. // Support: Safari 8+
  13512. // Table columns in Safari have non-zero offsetWidth & zero
  13513. // getBoundingClientRect().width unless display is changed.
  13514. // Support: IE <=11 only
  13515. // Running getBoundingClientRect on a disconnected node
  13516. // in IE throws an error.
  13517. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13518. swap( elem, cssShow, function() {
  13519. return getWidthOrHeight( elem, dimension, extra );
  13520. } ) :
  13521. getWidthOrHeight( elem, dimension, extra );
  13522. }
  13523. },
  13524. set: function( elem, value, extra ) {
  13525. var matches,
  13526. styles = getStyles( elem ),
  13527. // Only read styles.position if the test has a chance to fail
  13528. // to avoid forcing a reflow.
  13529. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13530. styles.position === "absolute",
  13531. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13532. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13533. isBorderBox = boxSizingNeeded &&
  13534. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13535. subtract = extra ?
  13536. boxModelAdjustment(
  13537. elem,
  13538. dimension,
  13539. extra,
  13540. isBorderBox,
  13541. styles
  13542. ) :
  13543. 0;
  13544. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13545. // faking a content-box to get border and padding (gh-3699)
  13546. if ( isBorderBox && scrollboxSizeBuggy ) {
  13547. subtract -= Math.ceil(
  13548. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13549. parseFloat( styles[ dimension ] ) -
  13550. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13551. 0.5
  13552. );
  13553. }
  13554. // Convert to pixels if value adjustment is needed
  13555. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13556. ( matches[ 3 ] || "px" ) !== "px" ) {
  13557. elem.style[ dimension ] = value;
  13558. value = jQuery.css( elem, dimension );
  13559. }
  13560. return setPositiveNumber( elem, value, subtract );
  13561. }
  13562. };
  13563. } );
  13564. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13565. function( elem, computed ) {
  13566. if ( computed ) {
  13567. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13568. elem.getBoundingClientRect().left -
  13569. swap( elem, { marginLeft: 0 }, function() {
  13570. return elem.getBoundingClientRect().left;
  13571. } )
  13572. ) + "px";
  13573. }
  13574. }
  13575. );
  13576. // These hooks are used by animate to expand properties
  13577. jQuery.each( {
  13578. margin: "",
  13579. padding: "",
  13580. border: "Width"
  13581. }, function( prefix, suffix ) {
  13582. jQuery.cssHooks[ prefix + suffix ] = {
  13583. expand: function( value ) {
  13584. var i = 0,
  13585. expanded = {},
  13586. // Assumes a single number if not a string
  13587. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13588. for ( ; i < 4; i++ ) {
  13589. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13590. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13591. }
  13592. return expanded;
  13593. }
  13594. };
  13595. if ( prefix !== "margin" ) {
  13596. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13597. }
  13598. } );
  13599. jQuery.fn.extend( {
  13600. css: function( name, value ) {
  13601. return access( this, function( elem, name, value ) {
  13602. var styles, len,
  13603. map = {},
  13604. i = 0;
  13605. if ( Array.isArray( name ) ) {
  13606. styles = getStyles( elem );
  13607. len = name.length;
  13608. for ( ; i < len; i++ ) {
  13609. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13610. }
  13611. return map;
  13612. }
  13613. return value !== undefined ?
  13614. jQuery.style( elem, name, value ) :
  13615. jQuery.css( elem, name );
  13616. }, name, value, arguments.length > 1 );
  13617. }
  13618. } );
  13619. function Tween( elem, options, prop, end, easing ) {
  13620. return new Tween.prototype.init( elem, options, prop, end, easing );
  13621. }
  13622. jQuery.Tween = Tween;
  13623. Tween.prototype = {
  13624. constructor: Tween,
  13625. init: function( elem, options, prop, end, easing, unit ) {
  13626. this.elem = elem;
  13627. this.prop = prop;
  13628. this.easing = easing || jQuery.easing._default;
  13629. this.options = options;
  13630. this.start = this.now = this.cur();
  13631. this.end = end;
  13632. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13633. },
  13634. cur: function() {
  13635. var hooks = Tween.propHooks[ this.prop ];
  13636. return hooks && hooks.get ?
  13637. hooks.get( this ) :
  13638. Tween.propHooks._default.get( this );
  13639. },
  13640. run: function( percent ) {
  13641. var eased,
  13642. hooks = Tween.propHooks[ this.prop ];
  13643. if ( this.options.duration ) {
  13644. this.pos = eased = jQuery.easing[ this.easing ](
  13645. percent, this.options.duration * percent, 0, 1, this.options.duration
  13646. );
  13647. } else {
  13648. this.pos = eased = percent;
  13649. }
  13650. this.now = ( this.end - this.start ) * eased + this.start;
  13651. if ( this.options.step ) {
  13652. this.options.step.call( this.elem, this.now, this );
  13653. }
  13654. if ( hooks && hooks.set ) {
  13655. hooks.set( this );
  13656. } else {
  13657. Tween.propHooks._default.set( this );
  13658. }
  13659. return this;
  13660. }
  13661. };
  13662. Tween.prototype.init.prototype = Tween.prototype;
  13663. Tween.propHooks = {
  13664. _default: {
  13665. get: function( tween ) {
  13666. var result;
  13667. // Use a property on the element directly when it is not a DOM element,
  13668. // or when there is no matching style property that exists.
  13669. if ( tween.elem.nodeType !== 1 ||
  13670. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13671. return tween.elem[ tween.prop ];
  13672. }
  13673. // Passing an empty string as a 3rd parameter to .css will automatically
  13674. // attempt a parseFloat and fallback to a string if the parse fails.
  13675. // Simple values such as "10px" are parsed to Float;
  13676. // complex values such as "rotate(1rad)" are returned as-is.
  13677. result = jQuery.css( tween.elem, tween.prop, "" );
  13678. // Empty strings, null, undefined and "auto" are converted to 0.
  13679. return !result || result === "auto" ? 0 : result;
  13680. },
  13681. set: function( tween ) {
  13682. // Use step hook for back compat.
  13683. // Use cssHook if its there.
  13684. // Use .style if available and use plain properties where available.
  13685. if ( jQuery.fx.step[ tween.prop ] ) {
  13686. jQuery.fx.step[ tween.prop ]( tween );
  13687. } else if ( tween.elem.nodeType === 1 && (
  13688. jQuery.cssHooks[ tween.prop ] ||
  13689. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13690. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13691. } else {
  13692. tween.elem[ tween.prop ] = tween.now;
  13693. }
  13694. }
  13695. }
  13696. };
  13697. // Support: IE <=9 only
  13698. // Panic based approach to setting things on disconnected nodes
  13699. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13700. set: function( tween ) {
  13701. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13702. tween.elem[ tween.prop ] = tween.now;
  13703. }
  13704. }
  13705. };
  13706. jQuery.easing = {
  13707. linear: function( p ) {
  13708. return p;
  13709. },
  13710. swing: function( p ) {
  13711. return 0.5 - Math.cos( p * Math.PI ) / 2;
  13712. },
  13713. _default: "swing"
  13714. };
  13715. jQuery.fx = Tween.prototype.init;
  13716. // Back compat <1.8 extension point
  13717. jQuery.fx.step = {};
  13718. var
  13719. fxNow, inProgress,
  13720. rfxtypes = /^(?:toggle|show|hide)$/,
  13721. rrun = /queueHooks$/;
  13722. function schedule() {
  13723. if ( inProgress ) {
  13724. if ( document.hidden === false && window.requestAnimationFrame ) {
  13725. window.requestAnimationFrame( schedule );
  13726. } else {
  13727. window.setTimeout( schedule, jQuery.fx.interval );
  13728. }
  13729. jQuery.fx.tick();
  13730. }
  13731. }
  13732. // Animations created synchronously will run synchronously
  13733. function createFxNow() {
  13734. window.setTimeout( function() {
  13735. fxNow = undefined;
  13736. } );
  13737. return ( fxNow = Date.now() );
  13738. }
  13739. // Generate parameters to create a standard animation
  13740. function genFx( type, includeWidth ) {
  13741. var which,
  13742. i = 0,
  13743. attrs = { height: type };
  13744. // If we include width, step value is 1 to do all cssExpand values,
  13745. // otherwise step value is 2 to skip over Left and Right
  13746. includeWidth = includeWidth ? 1 : 0;
  13747. for ( ; i < 4; i += 2 - includeWidth ) {
  13748. which = cssExpand[ i ];
  13749. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  13750. }
  13751. if ( includeWidth ) {
  13752. attrs.opacity = attrs.width = type;
  13753. }
  13754. return attrs;
  13755. }
  13756. function createTween( value, prop, animation ) {
  13757. var tween,
  13758. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  13759. index = 0,
  13760. length = collection.length;
  13761. for ( ; index < length; index++ ) {
  13762. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  13763. // We're done with this property
  13764. return tween;
  13765. }
  13766. }
  13767. }
  13768. function defaultPrefilter( elem, props, opts ) {
  13769. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  13770. isBox = "width" in props || "height" in props,
  13771. anim = this,
  13772. orig = {},
  13773. style = elem.style,
  13774. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  13775. dataShow = dataPriv.get( elem, "fxshow" );
  13776. // Queue-skipping animations hijack the fx hooks
  13777. if ( !opts.queue ) {
  13778. hooks = jQuery._queueHooks( elem, "fx" );
  13779. if ( hooks.unqueued == null ) {
  13780. hooks.unqueued = 0;
  13781. oldfire = hooks.empty.fire;
  13782. hooks.empty.fire = function() {
  13783. if ( !hooks.unqueued ) {
  13784. oldfire();
  13785. }
  13786. };
  13787. }
  13788. hooks.unqueued++;
  13789. anim.always( function() {
  13790. // Ensure the complete handler is called before this completes
  13791. anim.always( function() {
  13792. hooks.unqueued--;
  13793. if ( !jQuery.queue( elem, "fx" ).length ) {
  13794. hooks.empty.fire();
  13795. }
  13796. } );
  13797. } );
  13798. }
  13799. // Detect show/hide animations
  13800. for ( prop in props ) {
  13801. value = props[ prop ];
  13802. if ( rfxtypes.test( value ) ) {
  13803. delete props[ prop ];
  13804. toggle = toggle || value === "toggle";
  13805. if ( value === ( hidden ? "hide" : "show" ) ) {
  13806. // Pretend to be hidden if this is a "show" and
  13807. // there is still data from a stopped show/hide
  13808. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  13809. hidden = true;
  13810. // Ignore all other no-op show/hide data
  13811. } else {
  13812. continue;
  13813. }
  13814. }
  13815. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  13816. }
  13817. }
  13818. // Bail out if this is a no-op like .hide().hide()
  13819. propTween = !jQuery.isEmptyObject( props );
  13820. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  13821. return;
  13822. }
  13823. // Restrict "overflow" and "display" styles during box animations
  13824. if ( isBox && elem.nodeType === 1 ) {
  13825. // Support: IE <=9 - 11, Edge 12 - 15
  13826. // Record all 3 overflow attributes because IE does not infer the shorthand
  13827. // from identically-valued overflowX and overflowY and Edge just mirrors
  13828. // the overflowX value there.
  13829. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  13830. // Identify a display type, preferring old show/hide data over the CSS cascade
  13831. restoreDisplay = dataShow && dataShow.display;
  13832. if ( restoreDisplay == null ) {
  13833. restoreDisplay = dataPriv.get( elem, "display" );
  13834. }
  13835. display = jQuery.css( elem, "display" );
  13836. if ( display === "none" ) {
  13837. if ( restoreDisplay ) {
  13838. display = restoreDisplay;
  13839. } else {
  13840. // Get nonempty value(s) by temporarily forcing visibility
  13841. showHide( [ elem ], true );
  13842. restoreDisplay = elem.style.display || restoreDisplay;
  13843. display = jQuery.css( elem, "display" );
  13844. showHide( [ elem ] );
  13845. }
  13846. }
  13847. // Animate inline elements as inline-block
  13848. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  13849. if ( jQuery.css( elem, "float" ) === "none" ) {
  13850. // Restore the original display value at the end of pure show/hide animations
  13851. if ( !propTween ) {
  13852. anim.done( function() {
  13853. style.display = restoreDisplay;
  13854. } );
  13855. if ( restoreDisplay == null ) {
  13856. display = style.display;
  13857. restoreDisplay = display === "none" ? "" : display;
  13858. }
  13859. }
  13860. style.display = "inline-block";
  13861. }
  13862. }
  13863. }
  13864. if ( opts.overflow ) {
  13865. style.overflow = "hidden";
  13866. anim.always( function() {
  13867. style.overflow = opts.overflow[ 0 ];
  13868. style.overflowX = opts.overflow[ 1 ];
  13869. style.overflowY = opts.overflow[ 2 ];
  13870. } );
  13871. }
  13872. // Implement show/hide animations
  13873. propTween = false;
  13874. for ( prop in orig ) {
  13875. // General show/hide setup for this element animation
  13876. if ( !propTween ) {
  13877. if ( dataShow ) {
  13878. if ( "hidden" in dataShow ) {
  13879. hidden = dataShow.hidden;
  13880. }
  13881. } else {
  13882. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  13883. }
  13884. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  13885. if ( toggle ) {
  13886. dataShow.hidden = !hidden;
  13887. }
  13888. // Show elements before animating them
  13889. if ( hidden ) {
  13890. showHide( [ elem ], true );
  13891. }
  13892. /* eslint-disable no-loop-func */
  13893. anim.done( function() {
  13894. /* eslint-enable no-loop-func */
  13895. // The final step of a "hide" animation is actually hiding the element
  13896. if ( !hidden ) {
  13897. showHide( [ elem ] );
  13898. }
  13899. dataPriv.remove( elem, "fxshow" );
  13900. for ( prop in orig ) {
  13901. jQuery.style( elem, prop, orig[ prop ] );
  13902. }
  13903. } );
  13904. }
  13905. // Per-property setup
  13906. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  13907. if ( !( prop in dataShow ) ) {
  13908. dataShow[ prop ] = propTween.start;
  13909. if ( hidden ) {
  13910. propTween.end = propTween.start;
  13911. propTween.start = 0;
  13912. }
  13913. }
  13914. }
  13915. }
  13916. function propFilter( props, specialEasing ) {
  13917. var index, name, easing, value, hooks;
  13918. // camelCase, specialEasing and expand cssHook pass
  13919. for ( index in props ) {
  13920. name = camelCase( index );
  13921. easing = specialEasing[ name ];
  13922. value = props[ index ];
  13923. if ( Array.isArray( value ) ) {
  13924. easing = value[ 1 ];
  13925. value = props[ index ] = value[ 0 ];
  13926. }
  13927. if ( index !== name ) {
  13928. props[ name ] = value;
  13929. delete props[ index ];
  13930. }
  13931. hooks = jQuery.cssHooks[ name ];
  13932. if ( hooks && "expand" in hooks ) {
  13933. value = hooks.expand( value );
  13934. delete props[ name ];
  13935. // Not quite $.extend, this won't overwrite existing keys.
  13936. // Reusing 'index' because we have the correct "name"
  13937. for ( index in value ) {
  13938. if ( !( index in props ) ) {
  13939. props[ index ] = value[ index ];
  13940. specialEasing[ index ] = easing;
  13941. }
  13942. }
  13943. } else {
  13944. specialEasing[ name ] = easing;
  13945. }
  13946. }
  13947. }
  13948. function Animation( elem, properties, options ) {
  13949. var result,
  13950. stopped,
  13951. index = 0,
  13952. length = Animation.prefilters.length,
  13953. deferred = jQuery.Deferred().always( function() {
  13954. // Don't match elem in the :animated selector
  13955. delete tick.elem;
  13956. } ),
  13957. tick = function() {
  13958. if ( stopped ) {
  13959. return false;
  13960. }
  13961. var currentTime = fxNow || createFxNow(),
  13962. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  13963. // Support: Android 2.3 only
  13964. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  13965. temp = remaining / animation.duration || 0,
  13966. percent = 1 - temp,
  13967. index = 0,
  13968. length = animation.tweens.length;
  13969. for ( ; index < length; index++ ) {
  13970. animation.tweens[ index ].run( percent );
  13971. }
  13972. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  13973. // If there's more to do, yield
  13974. if ( percent < 1 && length ) {
  13975. return remaining;
  13976. }
  13977. // If this was an empty animation, synthesize a final progress notification
  13978. if ( !length ) {
  13979. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  13980. }
  13981. // Resolve the animation and report its conclusion
  13982. deferred.resolveWith( elem, [ animation ] );
  13983. return false;
  13984. },
  13985. animation = deferred.promise( {
  13986. elem: elem,
  13987. props: jQuery.extend( {}, properties ),
  13988. opts: jQuery.extend( true, {
  13989. specialEasing: {},
  13990. easing: jQuery.easing._default
  13991. }, options ),
  13992. originalProperties: properties,
  13993. originalOptions: options,
  13994. startTime: fxNow || createFxNow(),
  13995. duration: options.duration,
  13996. tweens: [],
  13997. createTween: function( prop, end ) {
  13998. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  13999. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14000. animation.tweens.push( tween );
  14001. return tween;
  14002. },
  14003. stop: function( gotoEnd ) {
  14004. var index = 0,
  14005. // If we are going to the end, we want to run all the tweens
  14006. // otherwise we skip this part
  14007. length = gotoEnd ? animation.tweens.length : 0;
  14008. if ( stopped ) {
  14009. return this;
  14010. }
  14011. stopped = true;
  14012. for ( ; index < length; index++ ) {
  14013. animation.tweens[ index ].run( 1 );
  14014. }
  14015. // Resolve when we played the last frame; otherwise, reject
  14016. if ( gotoEnd ) {
  14017. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14018. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14019. } else {
  14020. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14021. }
  14022. return this;
  14023. }
  14024. } ),
  14025. props = animation.props;
  14026. propFilter( props, animation.opts.specialEasing );
  14027. for ( ; index < length; index++ ) {
  14028. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14029. if ( result ) {
  14030. if ( isFunction( result.stop ) ) {
  14031. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14032. result.stop.bind( result );
  14033. }
  14034. return result;
  14035. }
  14036. }
  14037. jQuery.map( props, createTween, animation );
  14038. if ( isFunction( animation.opts.start ) ) {
  14039. animation.opts.start.call( elem, animation );
  14040. }
  14041. // Attach callbacks from options
  14042. animation
  14043. .progress( animation.opts.progress )
  14044. .done( animation.opts.done, animation.opts.complete )
  14045. .fail( animation.opts.fail )
  14046. .always( animation.opts.always );
  14047. jQuery.fx.timer(
  14048. jQuery.extend( tick, {
  14049. elem: elem,
  14050. anim: animation,
  14051. queue: animation.opts.queue
  14052. } )
  14053. );
  14054. return animation;
  14055. }
  14056. jQuery.Animation = jQuery.extend( Animation, {
  14057. tweeners: {
  14058. "*": [ function( prop, value ) {
  14059. var tween = this.createTween( prop, value );
  14060. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14061. return tween;
  14062. } ]
  14063. },
  14064. tweener: function( props, callback ) {
  14065. if ( isFunction( props ) ) {
  14066. callback = props;
  14067. props = [ "*" ];
  14068. } else {
  14069. props = props.match( rnothtmlwhite );
  14070. }
  14071. var prop,
  14072. index = 0,
  14073. length = props.length;
  14074. for ( ; index < length; index++ ) {
  14075. prop = props[ index ];
  14076. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14077. Animation.tweeners[ prop ].unshift( callback );
  14078. }
  14079. },
  14080. prefilters: [ defaultPrefilter ],
  14081. prefilter: function( callback, prepend ) {
  14082. if ( prepend ) {
  14083. Animation.prefilters.unshift( callback );
  14084. } else {
  14085. Animation.prefilters.push( callback );
  14086. }
  14087. }
  14088. } );
  14089. jQuery.speed = function( speed, easing, fn ) {
  14090. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14091. complete: fn || !fn && easing ||
  14092. isFunction( speed ) && speed,
  14093. duration: speed,
  14094. easing: fn && easing || easing && !isFunction( easing ) && easing
  14095. };
  14096. // Go to the end state if fx are off
  14097. if ( jQuery.fx.off ) {
  14098. opt.duration = 0;
  14099. } else {
  14100. if ( typeof opt.duration !== "number" ) {
  14101. if ( opt.duration in jQuery.fx.speeds ) {
  14102. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14103. } else {
  14104. opt.duration = jQuery.fx.speeds._default;
  14105. }
  14106. }
  14107. }
  14108. // Normalize opt.queue - true/undefined/null -> "fx"
  14109. if ( opt.queue == null || opt.queue === true ) {
  14110. opt.queue = "fx";
  14111. }
  14112. // Queueing
  14113. opt.old = opt.complete;
  14114. opt.complete = function() {
  14115. if ( isFunction( opt.old ) ) {
  14116. opt.old.call( this );
  14117. }
  14118. if ( opt.queue ) {
  14119. jQuery.dequeue( this, opt.queue );
  14120. }
  14121. };
  14122. return opt;
  14123. };
  14124. jQuery.fn.extend( {
  14125. fadeTo: function( speed, to, easing, callback ) {
  14126. // Show any hidden elements after setting opacity to 0
  14127. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14128. // Animate to the value specified
  14129. .end().animate( { opacity: to }, speed, easing, callback );
  14130. },
  14131. animate: function( prop, speed, easing, callback ) {
  14132. var empty = jQuery.isEmptyObject( prop ),
  14133. optall = jQuery.speed( speed, easing, callback ),
  14134. doAnimation = function() {
  14135. // Operate on a copy of prop so per-property easing won't be lost
  14136. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14137. // Empty animations, or finishing resolves immediately
  14138. if ( empty || dataPriv.get( this, "finish" ) ) {
  14139. anim.stop( true );
  14140. }
  14141. };
  14142. doAnimation.finish = doAnimation;
  14143. return empty || optall.queue === false ?
  14144. this.each( doAnimation ) :
  14145. this.queue( optall.queue, doAnimation );
  14146. },
  14147. stop: function( type, clearQueue, gotoEnd ) {
  14148. var stopQueue = function( hooks ) {
  14149. var stop = hooks.stop;
  14150. delete hooks.stop;
  14151. stop( gotoEnd );
  14152. };
  14153. if ( typeof type !== "string" ) {
  14154. gotoEnd = clearQueue;
  14155. clearQueue = type;
  14156. type = undefined;
  14157. }
  14158. if ( clearQueue && type !== false ) {
  14159. this.queue( type || "fx", [] );
  14160. }
  14161. return this.each( function() {
  14162. var dequeue = true,
  14163. index = type != null && type + "queueHooks",
  14164. timers = jQuery.timers,
  14165. data = dataPriv.get( this );
  14166. if ( index ) {
  14167. if ( data[ index ] && data[ index ].stop ) {
  14168. stopQueue( data[ index ] );
  14169. }
  14170. } else {
  14171. for ( index in data ) {
  14172. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14173. stopQueue( data[ index ] );
  14174. }
  14175. }
  14176. }
  14177. for ( index = timers.length; index--; ) {
  14178. if ( timers[ index ].elem === this &&
  14179. ( type == null || timers[ index ].queue === type ) ) {
  14180. timers[ index ].anim.stop( gotoEnd );
  14181. dequeue = false;
  14182. timers.splice( index, 1 );
  14183. }
  14184. }
  14185. // Start the next in the queue if the last step wasn't forced.
  14186. // Timers currently will call their complete callbacks, which
  14187. // will dequeue but only if they were gotoEnd.
  14188. if ( dequeue || !gotoEnd ) {
  14189. jQuery.dequeue( this, type );
  14190. }
  14191. } );
  14192. },
  14193. finish: function( type ) {
  14194. if ( type !== false ) {
  14195. type = type || "fx";
  14196. }
  14197. return this.each( function() {
  14198. var index,
  14199. data = dataPriv.get( this ),
  14200. queue = data[ type + "queue" ],
  14201. hooks = data[ type + "queueHooks" ],
  14202. timers = jQuery.timers,
  14203. length = queue ? queue.length : 0;
  14204. // Enable finishing flag on private data
  14205. data.finish = true;
  14206. // Empty the queue first
  14207. jQuery.queue( this, type, [] );
  14208. if ( hooks && hooks.stop ) {
  14209. hooks.stop.call( this, true );
  14210. }
  14211. // Look for any active animations, and finish them
  14212. for ( index = timers.length; index--; ) {
  14213. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14214. timers[ index ].anim.stop( true );
  14215. timers.splice( index, 1 );
  14216. }
  14217. }
  14218. // Look for any animations in the old queue and finish them
  14219. for ( index = 0; index < length; index++ ) {
  14220. if ( queue[ index ] && queue[ index ].finish ) {
  14221. queue[ index ].finish.call( this );
  14222. }
  14223. }
  14224. // Turn off finishing flag
  14225. delete data.finish;
  14226. } );
  14227. }
  14228. } );
  14229. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14230. var cssFn = jQuery.fn[ name ];
  14231. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14232. return speed == null || typeof speed === "boolean" ?
  14233. cssFn.apply( this, arguments ) :
  14234. this.animate( genFx( name, true ), speed, easing, callback );
  14235. };
  14236. } );
  14237. // Generate shortcuts for custom animations
  14238. jQuery.each( {
  14239. slideDown: genFx( "show" ),
  14240. slideUp: genFx( "hide" ),
  14241. slideToggle: genFx( "toggle" ),
  14242. fadeIn: { opacity: "show" },
  14243. fadeOut: { opacity: "hide" },
  14244. fadeToggle: { opacity: "toggle" }
  14245. }, function( name, props ) {
  14246. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14247. return this.animate( props, speed, easing, callback );
  14248. };
  14249. } );
  14250. jQuery.timers = [];
  14251. jQuery.fx.tick = function() {
  14252. var timer,
  14253. i = 0,
  14254. timers = jQuery.timers;
  14255. fxNow = Date.now();
  14256. for ( ; i < timers.length; i++ ) {
  14257. timer = timers[ i ];
  14258. // Run the timer and safely remove it when done (allowing for external removal)
  14259. if ( !timer() && timers[ i ] === timer ) {
  14260. timers.splice( i--, 1 );
  14261. }
  14262. }
  14263. if ( !timers.length ) {
  14264. jQuery.fx.stop();
  14265. }
  14266. fxNow = undefined;
  14267. };
  14268. jQuery.fx.timer = function( timer ) {
  14269. jQuery.timers.push( timer );
  14270. jQuery.fx.start();
  14271. };
  14272. jQuery.fx.interval = 13;
  14273. jQuery.fx.start = function() {
  14274. if ( inProgress ) {
  14275. return;
  14276. }
  14277. inProgress = true;
  14278. schedule();
  14279. };
  14280. jQuery.fx.stop = function() {
  14281. inProgress = null;
  14282. };
  14283. jQuery.fx.speeds = {
  14284. slow: 600,
  14285. fast: 200,
  14286. // Default speed
  14287. _default: 400
  14288. };
  14289. // Based off of the plugin by Clint Helfers, with permission.
  14290. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14291. jQuery.fn.delay = function( time, type ) {
  14292. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14293. type = type || "fx";
  14294. return this.queue( type, function( next, hooks ) {
  14295. var timeout = window.setTimeout( next, time );
  14296. hooks.stop = function() {
  14297. window.clearTimeout( timeout );
  14298. };
  14299. } );
  14300. };
  14301. ( function() {
  14302. var input = document.createElement( "input" ),
  14303. select = document.createElement( "select" ),
  14304. opt = select.appendChild( document.createElement( "option" ) );
  14305. input.type = "checkbox";
  14306. // Support: Android <=4.3 only
  14307. // Default value for a checkbox should be "on"
  14308. support.checkOn = input.value !== "";
  14309. // Support: IE <=11 only
  14310. // Must access selectedIndex to make default options select
  14311. support.optSelected = opt.selected;
  14312. // Support: IE <=11 only
  14313. // An input loses its value after becoming a radio
  14314. input = document.createElement( "input" );
  14315. input.value = "t";
  14316. input.type = "radio";
  14317. support.radioValue = input.value === "t";
  14318. } )();
  14319. var boolHook,
  14320. attrHandle = jQuery.expr.attrHandle;
  14321. jQuery.fn.extend( {
  14322. attr: function( name, value ) {
  14323. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14324. },
  14325. removeAttr: function( name ) {
  14326. return this.each( function() {
  14327. jQuery.removeAttr( this, name );
  14328. } );
  14329. }
  14330. } );
  14331. jQuery.extend( {
  14332. attr: function( elem, name, value ) {
  14333. var ret, hooks,
  14334. nType = elem.nodeType;
  14335. // Don't get/set attributes on text, comment and attribute nodes
  14336. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14337. return;
  14338. }
  14339. // Fallback to prop when attributes are not supported
  14340. if ( typeof elem.getAttribute === "undefined" ) {
  14341. return jQuery.prop( elem, name, value );
  14342. }
  14343. // Attribute hooks are determined by the lowercase version
  14344. // Grab necessary hook if one is defined
  14345. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14346. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14347. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14348. }
  14349. if ( value !== undefined ) {
  14350. if ( value === null ) {
  14351. jQuery.removeAttr( elem, name );
  14352. return;
  14353. }
  14354. if ( hooks && "set" in hooks &&
  14355. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14356. return ret;
  14357. }
  14358. elem.setAttribute( name, value + "" );
  14359. return value;
  14360. }
  14361. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14362. return ret;
  14363. }
  14364. ret = jQuery.find.attr( elem, name );
  14365. // Non-existent attributes return null, we normalize to undefined
  14366. return ret == null ? undefined : ret;
  14367. },
  14368. attrHooks: {
  14369. type: {
  14370. set: function( elem, value ) {
  14371. if ( !support.radioValue && value === "radio" &&
  14372. nodeName( elem, "input" ) ) {
  14373. var val = elem.value;
  14374. elem.setAttribute( "type", value );
  14375. if ( val ) {
  14376. elem.value = val;
  14377. }
  14378. return value;
  14379. }
  14380. }
  14381. }
  14382. },
  14383. removeAttr: function( elem, value ) {
  14384. var name,
  14385. i = 0,
  14386. // Attribute names can contain non-HTML whitespace characters
  14387. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14388. attrNames = value && value.match( rnothtmlwhite );
  14389. if ( attrNames && elem.nodeType === 1 ) {
  14390. while ( ( name = attrNames[ i++ ] ) ) {
  14391. elem.removeAttribute( name );
  14392. }
  14393. }
  14394. }
  14395. } );
  14396. // Hooks for boolean attributes
  14397. boolHook = {
  14398. set: function( elem, value, name ) {
  14399. if ( value === false ) {
  14400. // Remove boolean attributes when set to false
  14401. jQuery.removeAttr( elem, name );
  14402. } else {
  14403. elem.setAttribute( name, name );
  14404. }
  14405. return name;
  14406. }
  14407. };
  14408. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14409. var getter = attrHandle[ name ] || jQuery.find.attr;
  14410. attrHandle[ name ] = function( elem, name, isXML ) {
  14411. var ret, handle,
  14412. lowercaseName = name.toLowerCase();
  14413. if ( !isXML ) {
  14414. // Avoid an infinite loop by temporarily removing this function from the getter
  14415. handle = attrHandle[ lowercaseName ];
  14416. attrHandle[ lowercaseName ] = ret;
  14417. ret = getter( elem, name, isXML ) != null ?
  14418. lowercaseName :
  14419. null;
  14420. attrHandle[ lowercaseName ] = handle;
  14421. }
  14422. return ret;
  14423. };
  14424. } );
  14425. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14426. rclickable = /^(?:a|area)$/i;
  14427. jQuery.fn.extend( {
  14428. prop: function( name, value ) {
  14429. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14430. },
  14431. removeProp: function( name ) {
  14432. return this.each( function() {
  14433. delete this[ jQuery.propFix[ name ] || name ];
  14434. } );
  14435. }
  14436. } );
  14437. jQuery.extend( {
  14438. prop: function( elem, name, value ) {
  14439. var ret, hooks,
  14440. nType = elem.nodeType;
  14441. // Don't get/set properties on text, comment and attribute nodes
  14442. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14443. return;
  14444. }
  14445. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14446. // Fix name and attach hooks
  14447. name = jQuery.propFix[ name ] || name;
  14448. hooks = jQuery.propHooks[ name ];
  14449. }
  14450. if ( value !== undefined ) {
  14451. if ( hooks && "set" in hooks &&
  14452. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14453. return ret;
  14454. }
  14455. return ( elem[ name ] = value );
  14456. }
  14457. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14458. return ret;
  14459. }
  14460. return elem[ name ];
  14461. },
  14462. propHooks: {
  14463. tabIndex: {
  14464. get: function( elem ) {
  14465. // Support: IE <=9 - 11 only
  14466. // elem.tabIndex doesn't always return the
  14467. // correct value when it hasn't been explicitly set
  14468. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14469. // Use proper attribute retrieval(#12072)
  14470. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14471. if ( tabindex ) {
  14472. return parseInt( tabindex, 10 );
  14473. }
  14474. if (
  14475. rfocusable.test( elem.nodeName ) ||
  14476. rclickable.test( elem.nodeName ) &&
  14477. elem.href
  14478. ) {
  14479. return 0;
  14480. }
  14481. return -1;
  14482. }
  14483. }
  14484. },
  14485. propFix: {
  14486. "for": "htmlFor",
  14487. "class": "className"
  14488. }
  14489. } );
  14490. // Support: IE <=11 only
  14491. // Accessing the selectedIndex property
  14492. // forces the browser to respect setting selected
  14493. // on the option
  14494. // The getter ensures a default option is selected
  14495. // when in an optgroup
  14496. // eslint rule "no-unused-expressions" is disabled for this code
  14497. // since it considers such accessions noop
  14498. if ( !support.optSelected ) {
  14499. jQuery.propHooks.selected = {
  14500. get: function( elem ) {
  14501. /* eslint no-unused-expressions: "off" */
  14502. var parent = elem.parentNode;
  14503. if ( parent && parent.parentNode ) {
  14504. parent.parentNode.selectedIndex;
  14505. }
  14506. return null;
  14507. },
  14508. set: function( elem ) {
  14509. /* eslint no-unused-expressions: "off" */
  14510. var parent = elem.parentNode;
  14511. if ( parent ) {
  14512. parent.selectedIndex;
  14513. if ( parent.parentNode ) {
  14514. parent.parentNode.selectedIndex;
  14515. }
  14516. }
  14517. }
  14518. };
  14519. }
  14520. jQuery.each( [
  14521. "tabIndex",
  14522. "readOnly",
  14523. "maxLength",
  14524. "cellSpacing",
  14525. "cellPadding",
  14526. "rowSpan",
  14527. "colSpan",
  14528. "useMap",
  14529. "frameBorder",
  14530. "contentEditable"
  14531. ], function() {
  14532. jQuery.propFix[ this.toLowerCase() ] = this;
  14533. } );
  14534. // Strip and collapse whitespace according to HTML spec
  14535. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14536. function stripAndCollapse( value ) {
  14537. var tokens = value.match( rnothtmlwhite ) || [];
  14538. return tokens.join( " " );
  14539. }
  14540. function getClass( elem ) {
  14541. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14542. }
  14543. function classesToArray( value ) {
  14544. if ( Array.isArray( value ) ) {
  14545. return value;
  14546. }
  14547. if ( typeof value === "string" ) {
  14548. return value.match( rnothtmlwhite ) || [];
  14549. }
  14550. return [];
  14551. }
  14552. jQuery.fn.extend( {
  14553. addClass: function( value ) {
  14554. var classes, elem, cur, curValue, clazz, j, finalValue,
  14555. i = 0;
  14556. if ( isFunction( value ) ) {
  14557. return this.each( function( j ) {
  14558. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14559. } );
  14560. }
  14561. classes = classesToArray( value );
  14562. if ( classes.length ) {
  14563. while ( ( elem = this[ i++ ] ) ) {
  14564. curValue = getClass( elem );
  14565. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14566. if ( cur ) {
  14567. j = 0;
  14568. while ( ( clazz = classes[ j++ ] ) ) {
  14569. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14570. cur += clazz + " ";
  14571. }
  14572. }
  14573. // Only assign if different to avoid unneeded rendering.
  14574. finalValue = stripAndCollapse( cur );
  14575. if ( curValue !== finalValue ) {
  14576. elem.setAttribute( "class", finalValue );
  14577. }
  14578. }
  14579. }
  14580. }
  14581. return this;
  14582. },
  14583. removeClass: function( value ) {
  14584. var classes, elem, cur, curValue, clazz, j, finalValue,
  14585. i = 0;
  14586. if ( isFunction( value ) ) {
  14587. return this.each( function( j ) {
  14588. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14589. } );
  14590. }
  14591. if ( !arguments.length ) {
  14592. return this.attr( "class", "" );
  14593. }
  14594. classes = classesToArray( value );
  14595. if ( classes.length ) {
  14596. while ( ( elem = this[ i++ ] ) ) {
  14597. curValue = getClass( elem );
  14598. // This expression is here for better compressibility (see addClass)
  14599. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14600. if ( cur ) {
  14601. j = 0;
  14602. while ( ( clazz = classes[ j++ ] ) ) {
  14603. // Remove *all* instances
  14604. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14605. cur = cur.replace( " " + clazz + " ", " " );
  14606. }
  14607. }
  14608. // Only assign if different to avoid unneeded rendering.
  14609. finalValue = stripAndCollapse( cur );
  14610. if ( curValue !== finalValue ) {
  14611. elem.setAttribute( "class", finalValue );
  14612. }
  14613. }
  14614. }
  14615. }
  14616. return this;
  14617. },
  14618. toggleClass: function( value, stateVal ) {
  14619. var type = typeof value,
  14620. isValidValue = type === "string" || Array.isArray( value );
  14621. if ( typeof stateVal === "boolean" && isValidValue ) {
  14622. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14623. }
  14624. if ( isFunction( value ) ) {
  14625. return this.each( function( i ) {
  14626. jQuery( this ).toggleClass(
  14627. value.call( this, i, getClass( this ), stateVal ),
  14628. stateVal
  14629. );
  14630. } );
  14631. }
  14632. return this.each( function() {
  14633. var className, i, self, classNames;
  14634. if ( isValidValue ) {
  14635. // Toggle individual class names
  14636. i = 0;
  14637. self = jQuery( this );
  14638. classNames = classesToArray( value );
  14639. while ( ( className = classNames[ i++ ] ) ) {
  14640. // Check each className given, space separated list
  14641. if ( self.hasClass( className ) ) {
  14642. self.removeClass( className );
  14643. } else {
  14644. self.addClass( className );
  14645. }
  14646. }
  14647. // Toggle whole class name
  14648. } else if ( value === undefined || type === "boolean" ) {
  14649. className = getClass( this );
  14650. if ( className ) {
  14651. // Store className if set
  14652. dataPriv.set( this, "__className__", className );
  14653. }
  14654. // If the element has a class name or if we're passed `false`,
  14655. // then remove the whole classname (if there was one, the above saved it).
  14656. // Otherwise bring back whatever was previously saved (if anything),
  14657. // falling back to the empty string if nothing was stored.
  14658. if ( this.setAttribute ) {
  14659. this.setAttribute( "class",
  14660. className || value === false ?
  14661. "" :
  14662. dataPriv.get( this, "__className__" ) || ""
  14663. );
  14664. }
  14665. }
  14666. } );
  14667. },
  14668. hasClass: function( selector ) {
  14669. var className, elem,
  14670. i = 0;
  14671. className = " " + selector + " ";
  14672. while ( ( elem = this[ i++ ] ) ) {
  14673. if ( elem.nodeType === 1 &&
  14674. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14675. return true;
  14676. }
  14677. }
  14678. return false;
  14679. }
  14680. } );
  14681. var rreturn = /\r/g;
  14682. jQuery.fn.extend( {
  14683. val: function( value ) {
  14684. var hooks, ret, valueIsFunction,
  14685. elem = this[ 0 ];
  14686. if ( !arguments.length ) {
  14687. if ( elem ) {
  14688. hooks = jQuery.valHooks[ elem.type ] ||
  14689. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14690. if ( hooks &&
  14691. "get" in hooks &&
  14692. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14693. ) {
  14694. return ret;
  14695. }
  14696. ret = elem.value;
  14697. // Handle most common string cases
  14698. if ( typeof ret === "string" ) {
  14699. return ret.replace( rreturn, "" );
  14700. }
  14701. // Handle cases where value is null/undef or number
  14702. return ret == null ? "" : ret;
  14703. }
  14704. return;
  14705. }
  14706. valueIsFunction = isFunction( value );
  14707. return this.each( function( i ) {
  14708. var val;
  14709. if ( this.nodeType !== 1 ) {
  14710. return;
  14711. }
  14712. if ( valueIsFunction ) {
  14713. val = value.call( this, i, jQuery( this ).val() );
  14714. } else {
  14715. val = value;
  14716. }
  14717. // Treat null/undefined as ""; convert numbers to string
  14718. if ( val == null ) {
  14719. val = "";
  14720. } else if ( typeof val === "number" ) {
  14721. val += "";
  14722. } else if ( Array.isArray( val ) ) {
  14723. val = jQuery.map( val, function( value ) {
  14724. return value == null ? "" : value + "";
  14725. } );
  14726. }
  14727. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  14728. // If set returns undefined, fall back to normal setting
  14729. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  14730. this.value = val;
  14731. }
  14732. } );
  14733. }
  14734. } );
  14735. jQuery.extend( {
  14736. valHooks: {
  14737. option: {
  14738. get: function( elem ) {
  14739. var val = jQuery.find.attr( elem, "value" );
  14740. return val != null ?
  14741. val :
  14742. // Support: IE <=10 - 11 only
  14743. // option.text throws exceptions (#14686, #14858)
  14744. // Strip and collapse whitespace
  14745. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  14746. stripAndCollapse( jQuery.text( elem ) );
  14747. }
  14748. },
  14749. select: {
  14750. get: function( elem ) {
  14751. var value, option, i,
  14752. options = elem.options,
  14753. index = elem.selectedIndex,
  14754. one = elem.type === "select-one",
  14755. values = one ? null : [],
  14756. max = one ? index + 1 : options.length;
  14757. if ( index < 0 ) {
  14758. i = max;
  14759. } else {
  14760. i = one ? index : 0;
  14761. }
  14762. // Loop through all the selected options
  14763. for ( ; i < max; i++ ) {
  14764. option = options[ i ];
  14765. // Support: IE <=9 only
  14766. // IE8-9 doesn't update selected after form reset (#2551)
  14767. if ( ( option.selected || i === index ) &&
  14768. // Don't return options that are disabled or in a disabled optgroup
  14769. !option.disabled &&
  14770. ( !option.parentNode.disabled ||
  14771. !nodeName( option.parentNode, "optgroup" ) ) ) {
  14772. // Get the specific value for the option
  14773. value = jQuery( option ).val();
  14774. // We don't need an array for one selects
  14775. if ( one ) {
  14776. return value;
  14777. }
  14778. // Multi-Selects return an array
  14779. values.push( value );
  14780. }
  14781. }
  14782. return values;
  14783. },
  14784. set: function( elem, value ) {
  14785. var optionSet, option,
  14786. options = elem.options,
  14787. values = jQuery.makeArray( value ),
  14788. i = options.length;
  14789. while ( i-- ) {
  14790. option = options[ i ];
  14791. /* eslint-disable no-cond-assign */
  14792. if ( option.selected =
  14793. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  14794. ) {
  14795. optionSet = true;
  14796. }
  14797. /* eslint-enable no-cond-assign */
  14798. }
  14799. // Force browsers to behave consistently when non-matching value is set
  14800. if ( !optionSet ) {
  14801. elem.selectedIndex = -1;
  14802. }
  14803. return values;
  14804. }
  14805. }
  14806. }
  14807. } );
  14808. // Radios and checkboxes getter/setter
  14809. jQuery.each( [ "radio", "checkbox" ], function() {
  14810. jQuery.valHooks[ this ] = {
  14811. set: function( elem, value ) {
  14812. if ( Array.isArray( value ) ) {
  14813. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  14814. }
  14815. }
  14816. };
  14817. if ( !support.checkOn ) {
  14818. jQuery.valHooks[ this ].get = function( elem ) {
  14819. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  14820. };
  14821. }
  14822. } );
  14823. // Return jQuery for attributes-only inclusion
  14824. support.focusin = "onfocusin" in window;
  14825. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  14826. stopPropagationCallback = function( e ) {
  14827. e.stopPropagation();
  14828. };
  14829. jQuery.extend( jQuery.event, {
  14830. trigger: function( event, data, elem, onlyHandlers ) {
  14831. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  14832. eventPath = [ elem || document ],
  14833. type = hasOwn.call( event, "type" ) ? event.type : event,
  14834. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  14835. cur = lastElement = tmp = elem = elem || document;
  14836. // Don't do events on text and comment nodes
  14837. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  14838. return;
  14839. }
  14840. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  14841. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  14842. return;
  14843. }
  14844. if ( type.indexOf( "." ) > -1 ) {
  14845. // Namespaced trigger; create a regexp to match event type in handle()
  14846. namespaces = type.split( "." );
  14847. type = namespaces.shift();
  14848. namespaces.sort();
  14849. }
  14850. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  14851. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  14852. event = event[ jQuery.expando ] ?
  14853. event :
  14854. new jQuery.Event( type, typeof event === "object" && event );
  14855. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  14856. event.isTrigger = onlyHandlers ? 2 : 3;
  14857. event.namespace = namespaces.join( "." );
  14858. event.rnamespace = event.namespace ?
  14859. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  14860. null;
  14861. // Clean up the event in case it is being reused
  14862. event.result = undefined;
  14863. if ( !event.target ) {
  14864. event.target = elem;
  14865. }
  14866. // Clone any incoming data and prepend the event, creating the handler arg list
  14867. data = data == null ?
  14868. [ event ] :
  14869. jQuery.makeArray( data, [ event ] );
  14870. // Allow special events to draw outside the lines
  14871. special = jQuery.event.special[ type ] || {};
  14872. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  14873. return;
  14874. }
  14875. // Determine event propagation path in advance, per W3C events spec (#9951)
  14876. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  14877. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  14878. bubbleType = special.delegateType || type;
  14879. if ( !rfocusMorph.test( bubbleType + type ) ) {
  14880. cur = cur.parentNode;
  14881. }
  14882. for ( ; cur; cur = cur.parentNode ) {
  14883. eventPath.push( cur );
  14884. tmp = cur;
  14885. }
  14886. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  14887. if ( tmp === ( elem.ownerDocument || document ) ) {
  14888. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  14889. }
  14890. }
  14891. // Fire handlers on the event path
  14892. i = 0;
  14893. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  14894. lastElement = cur;
  14895. event.type = i > 1 ?
  14896. bubbleType :
  14897. special.bindType || type;
  14898. // jQuery handler
  14899. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  14900. dataPriv.get( cur, "handle" );
  14901. if ( handle ) {
  14902. handle.apply( cur, data );
  14903. }
  14904. // Native handler
  14905. handle = ontype && cur[ ontype ];
  14906. if ( handle && handle.apply && acceptData( cur ) ) {
  14907. event.result = handle.apply( cur, data );
  14908. if ( event.result === false ) {
  14909. event.preventDefault();
  14910. }
  14911. }
  14912. }
  14913. event.type = type;
  14914. // If nobody prevented the default action, do it now
  14915. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  14916. if ( ( !special._default ||
  14917. special._default.apply( eventPath.pop(), data ) === false ) &&
  14918. acceptData( elem ) ) {
  14919. // Call a native DOM method on the target with the same name as the event.
  14920. // Don't do default actions on window, that's where global variables be (#6170)
  14921. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  14922. // Don't re-trigger an onFOO event when we call its FOO() method
  14923. tmp = elem[ ontype ];
  14924. if ( tmp ) {
  14925. elem[ ontype ] = null;
  14926. }
  14927. // Prevent re-triggering of the same event, since we already bubbled it above
  14928. jQuery.event.triggered = type;
  14929. if ( event.isPropagationStopped() ) {
  14930. lastElement.addEventListener( type, stopPropagationCallback );
  14931. }
  14932. elem[ type ]();
  14933. if ( event.isPropagationStopped() ) {
  14934. lastElement.removeEventListener( type, stopPropagationCallback );
  14935. }
  14936. jQuery.event.triggered = undefined;
  14937. if ( tmp ) {
  14938. elem[ ontype ] = tmp;
  14939. }
  14940. }
  14941. }
  14942. }
  14943. return event.result;
  14944. },
  14945. // Piggyback on a donor event to simulate a different one
  14946. // Used only for `focus(in | out)` events
  14947. simulate: function( type, elem, event ) {
  14948. var e = jQuery.extend(
  14949. new jQuery.Event(),
  14950. event,
  14951. {
  14952. type: type,
  14953. isSimulated: true
  14954. }
  14955. );
  14956. jQuery.event.trigger( e, null, elem );
  14957. }
  14958. } );
  14959. jQuery.fn.extend( {
  14960. trigger: function( type, data ) {
  14961. return this.each( function() {
  14962. jQuery.event.trigger( type, data, this );
  14963. } );
  14964. },
  14965. triggerHandler: function( type, data ) {
  14966. var elem = this[ 0 ];
  14967. if ( elem ) {
  14968. return jQuery.event.trigger( type, data, elem, true );
  14969. }
  14970. }
  14971. } );
  14972. // Support: Firefox <=44
  14973. // Firefox doesn't have focus(in | out) events
  14974. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  14975. //
  14976. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  14977. // focus(in | out) events fire after focus & blur events,
  14978. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  14979. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  14980. if ( !support.focusin ) {
  14981. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  14982. // Attach a single capturing handler on the document while someone wants focusin/focusout
  14983. var handler = function( event ) {
  14984. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  14985. };
  14986. jQuery.event.special[ fix ] = {
  14987. setup: function() {
  14988. var doc = this.ownerDocument || this,
  14989. attaches = dataPriv.access( doc, fix );
  14990. if ( !attaches ) {
  14991. doc.addEventListener( orig, handler, true );
  14992. }
  14993. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  14994. },
  14995. teardown: function() {
  14996. var doc = this.ownerDocument || this,
  14997. attaches = dataPriv.access( doc, fix ) - 1;
  14998. if ( !attaches ) {
  14999. doc.removeEventListener( orig, handler, true );
  15000. dataPriv.remove( doc, fix );
  15001. } else {
  15002. dataPriv.access( doc, fix, attaches );
  15003. }
  15004. }
  15005. };
  15006. } );
  15007. }
  15008. var location = window.location;
  15009. var nonce = Date.now();
  15010. var rquery = ( /\?/ );
  15011. // Cross-browser xml parsing
  15012. jQuery.parseXML = function( data ) {
  15013. var xml;
  15014. if ( !data || typeof data !== "string" ) {
  15015. return null;
  15016. }
  15017. // Support: IE 9 - 11 only
  15018. // IE throws on parseFromString with invalid input.
  15019. try {
  15020. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15021. } catch ( e ) {
  15022. xml = undefined;
  15023. }
  15024. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15025. jQuery.error( "Invalid XML: " + data );
  15026. }
  15027. return xml;
  15028. };
  15029. var
  15030. rbracket = /\[\]$/,
  15031. rCRLF = /\r?\n/g,
  15032. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15033. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15034. function buildParams( prefix, obj, traditional, add ) {
  15035. var name;
  15036. if ( Array.isArray( obj ) ) {
  15037. // Serialize array item.
  15038. jQuery.each( obj, function( i, v ) {
  15039. if ( traditional || rbracket.test( prefix ) ) {
  15040. // Treat each array item as a scalar.
  15041. add( prefix, v );
  15042. } else {
  15043. // Item is non-scalar (array or object), encode its numeric index.
  15044. buildParams(
  15045. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15046. v,
  15047. traditional,
  15048. add
  15049. );
  15050. }
  15051. } );
  15052. } else if ( !traditional && toType( obj ) === "object" ) {
  15053. // Serialize object item.
  15054. for ( name in obj ) {
  15055. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15056. }
  15057. } else {
  15058. // Serialize scalar item.
  15059. add( prefix, obj );
  15060. }
  15061. }
  15062. // Serialize an array of form elements or a set of
  15063. // key/values into a query string
  15064. jQuery.param = function( a, traditional ) {
  15065. var prefix,
  15066. s = [],
  15067. add = function( key, valueOrFunction ) {
  15068. // If value is a function, invoke it and use its return value
  15069. var value = isFunction( valueOrFunction ) ?
  15070. valueOrFunction() :
  15071. valueOrFunction;
  15072. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15073. encodeURIComponent( value == null ? "" : value );
  15074. };
  15075. if ( a == null ) {
  15076. return "";
  15077. }
  15078. // If an array was passed in, assume that it is an array of form elements.
  15079. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15080. // Serialize the form elements
  15081. jQuery.each( a, function() {
  15082. add( this.name, this.value );
  15083. } );
  15084. } else {
  15085. // If traditional, encode the "old" way (the way 1.3.2 or older
  15086. // did it), otherwise encode params recursively.
  15087. for ( prefix in a ) {
  15088. buildParams( prefix, a[ prefix ], traditional, add );
  15089. }
  15090. }
  15091. // Return the resulting serialization
  15092. return s.join( "&" );
  15093. };
  15094. jQuery.fn.extend( {
  15095. serialize: function() {
  15096. return jQuery.param( this.serializeArray() );
  15097. },
  15098. serializeArray: function() {
  15099. return this.map( function() {
  15100. // Can add propHook for "elements" to filter or add form elements
  15101. var elements = jQuery.prop( this, "elements" );
  15102. return elements ? jQuery.makeArray( elements ) : this;
  15103. } )
  15104. .filter( function() {
  15105. var type = this.type;
  15106. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15107. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15108. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15109. ( this.checked || !rcheckableType.test( type ) );
  15110. } )
  15111. .map( function( i, elem ) {
  15112. var val = jQuery( this ).val();
  15113. if ( val == null ) {
  15114. return null;
  15115. }
  15116. if ( Array.isArray( val ) ) {
  15117. return jQuery.map( val, function( val ) {
  15118. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15119. } );
  15120. }
  15121. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15122. } ).get();
  15123. }
  15124. } );
  15125. var
  15126. r20 = /%20/g,
  15127. rhash = /#.*$/,
  15128. rantiCache = /([?&])_=[^&]*/,
  15129. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15130. // #7653, #8125, #8152: local protocol detection
  15131. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15132. rnoContent = /^(?:GET|HEAD)$/,
  15133. rprotocol = /^\/\//,
  15134. /* Prefilters
  15135. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15136. * 2) These are called:
  15137. * - BEFORE asking for a transport
  15138. * - AFTER param serialization (s.data is a string if s.processData is true)
  15139. * 3) key is the dataType
  15140. * 4) the catchall symbol "*" can be used
  15141. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15142. */
  15143. prefilters = {},
  15144. /* Transports bindings
  15145. * 1) key is the dataType
  15146. * 2) the catchall symbol "*" can be used
  15147. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15148. */
  15149. transports = {},
  15150. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15151. allTypes = "*/".concat( "*" ),
  15152. // Anchor tag for parsing the document origin
  15153. originAnchor = document.createElement( "a" );
  15154. originAnchor.href = location.href;
  15155. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15156. function addToPrefiltersOrTransports( structure ) {
  15157. // dataTypeExpression is optional and defaults to "*"
  15158. return function( dataTypeExpression, func ) {
  15159. if ( typeof dataTypeExpression !== "string" ) {
  15160. func = dataTypeExpression;
  15161. dataTypeExpression = "*";
  15162. }
  15163. var dataType,
  15164. i = 0,
  15165. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15166. if ( isFunction( func ) ) {
  15167. // For each dataType in the dataTypeExpression
  15168. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15169. // Prepend if requested
  15170. if ( dataType[ 0 ] === "+" ) {
  15171. dataType = dataType.slice( 1 ) || "*";
  15172. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15173. // Otherwise append
  15174. } else {
  15175. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15176. }
  15177. }
  15178. }
  15179. };
  15180. }
  15181. // Base inspection function for prefilters and transports
  15182. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15183. var inspected = {},
  15184. seekingTransport = ( structure === transports );
  15185. function inspect( dataType ) {
  15186. var selected;
  15187. inspected[ dataType ] = true;
  15188. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15189. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15190. if ( typeof dataTypeOrTransport === "string" &&
  15191. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15192. options.dataTypes.unshift( dataTypeOrTransport );
  15193. inspect( dataTypeOrTransport );
  15194. return false;
  15195. } else if ( seekingTransport ) {
  15196. return !( selected = dataTypeOrTransport );
  15197. }
  15198. } );
  15199. return selected;
  15200. }
  15201. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15202. }
  15203. // A special extend for ajax options
  15204. // that takes "flat" options (not to be deep extended)
  15205. // Fixes #9887
  15206. function ajaxExtend( target, src ) {
  15207. var key, deep,
  15208. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15209. for ( key in src ) {
  15210. if ( src[ key ] !== undefined ) {
  15211. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15212. }
  15213. }
  15214. if ( deep ) {
  15215. jQuery.extend( true, target, deep );
  15216. }
  15217. return target;
  15218. }
  15219. /* Handles responses to an ajax request:
  15220. * - finds the right dataType (mediates between content-type and expected dataType)
  15221. * - returns the corresponding response
  15222. */
  15223. function ajaxHandleResponses( s, jqXHR, responses ) {
  15224. var ct, type, finalDataType, firstDataType,
  15225. contents = s.contents,
  15226. dataTypes = s.dataTypes;
  15227. // Remove auto dataType and get content-type in the process
  15228. while ( dataTypes[ 0 ] === "*" ) {
  15229. dataTypes.shift();
  15230. if ( ct === undefined ) {
  15231. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15232. }
  15233. }
  15234. // Check if we're dealing with a known content-type
  15235. if ( ct ) {
  15236. for ( type in contents ) {
  15237. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15238. dataTypes.unshift( type );
  15239. break;
  15240. }
  15241. }
  15242. }
  15243. // Check to see if we have a response for the expected dataType
  15244. if ( dataTypes[ 0 ] in responses ) {
  15245. finalDataType = dataTypes[ 0 ];
  15246. } else {
  15247. // Try convertible dataTypes
  15248. for ( type in responses ) {
  15249. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15250. finalDataType = type;
  15251. break;
  15252. }
  15253. if ( !firstDataType ) {
  15254. firstDataType = type;
  15255. }
  15256. }
  15257. // Or just use first one
  15258. finalDataType = finalDataType || firstDataType;
  15259. }
  15260. // If we found a dataType
  15261. // We add the dataType to the list if needed
  15262. // and return the corresponding response
  15263. if ( finalDataType ) {
  15264. if ( finalDataType !== dataTypes[ 0 ] ) {
  15265. dataTypes.unshift( finalDataType );
  15266. }
  15267. return responses[ finalDataType ];
  15268. }
  15269. }
  15270. /* Chain conversions given the request and the original response
  15271. * Also sets the responseXXX fields on the jqXHR instance
  15272. */
  15273. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15274. var conv2, current, conv, tmp, prev,
  15275. converters = {},
  15276. // Work with a copy of dataTypes in case we need to modify it for conversion
  15277. dataTypes = s.dataTypes.slice();
  15278. // Create converters map with lowercased keys
  15279. if ( dataTypes[ 1 ] ) {
  15280. for ( conv in s.converters ) {
  15281. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15282. }
  15283. }
  15284. current = dataTypes.shift();
  15285. // Convert to each sequential dataType
  15286. while ( current ) {
  15287. if ( s.responseFields[ current ] ) {
  15288. jqXHR[ s.responseFields[ current ] ] = response;
  15289. }
  15290. // Apply the dataFilter if provided
  15291. if ( !prev && isSuccess && s.dataFilter ) {
  15292. response = s.dataFilter( response, s.dataType );
  15293. }
  15294. prev = current;
  15295. current = dataTypes.shift();
  15296. if ( current ) {
  15297. // There's only work to do if current dataType is non-auto
  15298. if ( current === "*" ) {
  15299. current = prev;
  15300. // Convert response if prev dataType is non-auto and differs from current
  15301. } else if ( prev !== "*" && prev !== current ) {
  15302. // Seek a direct converter
  15303. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15304. // If none found, seek a pair
  15305. if ( !conv ) {
  15306. for ( conv2 in converters ) {
  15307. // If conv2 outputs current
  15308. tmp = conv2.split( " " );
  15309. if ( tmp[ 1 ] === current ) {
  15310. // If prev can be converted to accepted input
  15311. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15312. converters[ "* " + tmp[ 0 ] ];
  15313. if ( conv ) {
  15314. // Condense equivalence converters
  15315. if ( conv === true ) {
  15316. conv = converters[ conv2 ];
  15317. // Otherwise, insert the intermediate dataType
  15318. } else if ( converters[ conv2 ] !== true ) {
  15319. current = tmp[ 0 ];
  15320. dataTypes.unshift( tmp[ 1 ] );
  15321. }
  15322. break;
  15323. }
  15324. }
  15325. }
  15326. }
  15327. // Apply converter (if not an equivalence)
  15328. if ( conv !== true ) {
  15329. // Unless errors are allowed to bubble, catch and return them
  15330. if ( conv && s.throws ) {
  15331. response = conv( response );
  15332. } else {
  15333. try {
  15334. response = conv( response );
  15335. } catch ( e ) {
  15336. return {
  15337. state: "parsererror",
  15338. error: conv ? e : "No conversion from " + prev + " to " + current
  15339. };
  15340. }
  15341. }
  15342. }
  15343. }
  15344. }
  15345. }
  15346. return { state: "success", data: response };
  15347. }
  15348. jQuery.extend( {
  15349. // Counter for holding the number of active queries
  15350. active: 0,
  15351. // Last-Modified header cache for next request
  15352. lastModified: {},
  15353. etag: {},
  15354. ajaxSettings: {
  15355. url: location.href,
  15356. type: "GET",
  15357. isLocal: rlocalProtocol.test( location.protocol ),
  15358. global: true,
  15359. processData: true,
  15360. async: true,
  15361. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15362. /*
  15363. timeout: 0,
  15364. data: null,
  15365. dataType: null,
  15366. username: null,
  15367. password: null,
  15368. cache: null,
  15369. throws: false,
  15370. traditional: false,
  15371. headers: {},
  15372. */
  15373. accepts: {
  15374. "*": allTypes,
  15375. text: "text/plain",
  15376. html: "text/html",
  15377. xml: "application/xml, text/xml",
  15378. json: "application/json, text/javascript"
  15379. },
  15380. contents: {
  15381. xml: /\bxml\b/,
  15382. html: /\bhtml/,
  15383. json: /\bjson\b/
  15384. },
  15385. responseFields: {
  15386. xml: "responseXML",
  15387. text: "responseText",
  15388. json: "responseJSON"
  15389. },
  15390. // Data converters
  15391. // Keys separate source (or catchall "*") and destination types with a single space
  15392. converters: {
  15393. // Convert anything to text
  15394. "* text": String,
  15395. // Text to html (true = no transformation)
  15396. "text html": true,
  15397. // Evaluate text as a json expression
  15398. "text json": JSON.parse,
  15399. // Parse text as xml
  15400. "text xml": jQuery.parseXML
  15401. },
  15402. // For options that shouldn't be deep extended:
  15403. // you can add your own custom options here if
  15404. // and when you create one that shouldn't be
  15405. // deep extended (see ajaxExtend)
  15406. flatOptions: {
  15407. url: true,
  15408. context: true
  15409. }
  15410. },
  15411. // Creates a full fledged settings object into target
  15412. // with both ajaxSettings and settings fields.
  15413. // If target is omitted, writes into ajaxSettings.
  15414. ajaxSetup: function( target, settings ) {
  15415. return settings ?
  15416. // Building a settings object
  15417. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15418. // Extending ajaxSettings
  15419. ajaxExtend( jQuery.ajaxSettings, target );
  15420. },
  15421. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15422. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15423. // Main method
  15424. ajax: function( url, options ) {
  15425. // If url is an object, simulate pre-1.5 signature
  15426. if ( typeof url === "object" ) {
  15427. options = url;
  15428. url = undefined;
  15429. }
  15430. // Force options to be an object
  15431. options = options || {};
  15432. var transport,
  15433. // URL without anti-cache param
  15434. cacheURL,
  15435. // Response headers
  15436. responseHeadersString,
  15437. responseHeaders,
  15438. // timeout handle
  15439. timeoutTimer,
  15440. // Url cleanup var
  15441. urlAnchor,
  15442. // Request state (becomes false upon send and true upon completion)
  15443. completed,
  15444. // To know if global events are to be dispatched
  15445. fireGlobals,
  15446. // Loop variable
  15447. i,
  15448. // uncached part of the url
  15449. uncached,
  15450. // Create the final options object
  15451. s = jQuery.ajaxSetup( {}, options ),
  15452. // Callbacks context
  15453. callbackContext = s.context || s,
  15454. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15455. globalEventContext = s.context &&
  15456. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15457. jQuery( callbackContext ) :
  15458. jQuery.event,
  15459. // Deferreds
  15460. deferred = jQuery.Deferred(),
  15461. completeDeferred = jQuery.Callbacks( "once memory" ),
  15462. // Status-dependent callbacks
  15463. statusCode = s.statusCode || {},
  15464. // Headers (they are sent all at once)
  15465. requestHeaders = {},
  15466. requestHeadersNames = {},
  15467. // Default abort message
  15468. strAbort = "canceled",
  15469. // Fake xhr
  15470. jqXHR = {
  15471. readyState: 0,
  15472. // Builds headers hashtable if needed
  15473. getResponseHeader: function( key ) {
  15474. var match;
  15475. if ( completed ) {
  15476. if ( !responseHeaders ) {
  15477. responseHeaders = {};
  15478. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15479. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15480. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15481. .concat( match[ 2 ] );
  15482. }
  15483. }
  15484. match = responseHeaders[ key.toLowerCase() + " " ];
  15485. }
  15486. return match == null ? null : match.join( ", " );
  15487. },
  15488. // Raw string
  15489. getAllResponseHeaders: function() {
  15490. return completed ? responseHeadersString : null;
  15491. },
  15492. // Caches the header
  15493. setRequestHeader: function( name, value ) {
  15494. if ( completed == null ) {
  15495. name = requestHeadersNames[ name.toLowerCase() ] =
  15496. requestHeadersNames[ name.toLowerCase() ] || name;
  15497. requestHeaders[ name ] = value;
  15498. }
  15499. return this;
  15500. },
  15501. // Overrides response content-type header
  15502. overrideMimeType: function( type ) {
  15503. if ( completed == null ) {
  15504. s.mimeType = type;
  15505. }
  15506. return this;
  15507. },
  15508. // Status-dependent callbacks
  15509. statusCode: function( map ) {
  15510. var code;
  15511. if ( map ) {
  15512. if ( completed ) {
  15513. // Execute the appropriate callbacks
  15514. jqXHR.always( map[ jqXHR.status ] );
  15515. } else {
  15516. // Lazy-add the new callbacks in a way that preserves old ones
  15517. for ( code in map ) {
  15518. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15519. }
  15520. }
  15521. }
  15522. return this;
  15523. },
  15524. // Cancel the request
  15525. abort: function( statusText ) {
  15526. var finalText = statusText || strAbort;
  15527. if ( transport ) {
  15528. transport.abort( finalText );
  15529. }
  15530. done( 0, finalText );
  15531. return this;
  15532. }
  15533. };
  15534. // Attach deferreds
  15535. deferred.promise( jqXHR );
  15536. // Add protocol if not provided (prefilters might expect it)
  15537. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15538. // We also use the url parameter if available
  15539. s.url = ( ( url || s.url || location.href ) + "" )
  15540. .replace( rprotocol, location.protocol + "//" );
  15541. // Alias method option to type as per ticket #12004
  15542. s.type = options.method || options.type || s.method || s.type;
  15543. // Extract dataTypes list
  15544. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15545. // A cross-domain request is in order when the origin doesn't match the current origin.
  15546. if ( s.crossDomain == null ) {
  15547. urlAnchor = document.createElement( "a" );
  15548. // Support: IE <=8 - 11, Edge 12 - 15
  15549. // IE throws exception on accessing the href property if url is malformed,
  15550. // e.g. http://example.com:80x/
  15551. try {
  15552. urlAnchor.href = s.url;
  15553. // Support: IE <=8 - 11 only
  15554. // Anchor's host property isn't correctly set when s.url is relative
  15555. urlAnchor.href = urlAnchor.href;
  15556. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15557. urlAnchor.protocol + "//" + urlAnchor.host;
  15558. } catch ( e ) {
  15559. // If there is an error parsing the URL, assume it is crossDomain,
  15560. // it can be rejected by the transport if it is invalid
  15561. s.crossDomain = true;
  15562. }
  15563. }
  15564. // Convert data if not already a string
  15565. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15566. s.data = jQuery.param( s.data, s.traditional );
  15567. }
  15568. // Apply prefilters
  15569. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15570. // If request was aborted inside a prefilter, stop there
  15571. if ( completed ) {
  15572. return jqXHR;
  15573. }
  15574. // We can fire global events as of now if asked to
  15575. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15576. fireGlobals = jQuery.event && s.global;
  15577. // Watch for a new set of requests
  15578. if ( fireGlobals && jQuery.active++ === 0 ) {
  15579. jQuery.event.trigger( "ajaxStart" );
  15580. }
  15581. // Uppercase the type
  15582. s.type = s.type.toUpperCase();
  15583. // Determine if request has content
  15584. s.hasContent = !rnoContent.test( s.type );
  15585. // Save the URL in case we're toying with the If-Modified-Since
  15586. // and/or If-None-Match header later on
  15587. // Remove hash to simplify url manipulation
  15588. cacheURL = s.url.replace( rhash, "" );
  15589. // More options handling for requests with no content
  15590. if ( !s.hasContent ) {
  15591. // Remember the hash so we can put it back
  15592. uncached = s.url.slice( cacheURL.length );
  15593. // If data is available and should be processed, append data to url
  15594. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15595. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15596. // #9682: remove data so that it's not used in an eventual retry
  15597. delete s.data;
  15598. }
  15599. // Add or update anti-cache param if needed
  15600. if ( s.cache === false ) {
  15601. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15602. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15603. }
  15604. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15605. s.url = cacheURL + uncached;
  15606. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15607. } else if ( s.data && s.processData &&
  15608. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15609. s.data = s.data.replace( r20, "+" );
  15610. }
  15611. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15612. if ( s.ifModified ) {
  15613. if ( jQuery.lastModified[ cacheURL ] ) {
  15614. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15615. }
  15616. if ( jQuery.etag[ cacheURL ] ) {
  15617. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15618. }
  15619. }
  15620. // Set the correct header, if data is being sent
  15621. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15622. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15623. }
  15624. // Set the Accepts header for the server, depending on the dataType
  15625. jqXHR.setRequestHeader(
  15626. "Accept",
  15627. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15628. s.accepts[ s.dataTypes[ 0 ] ] +
  15629. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15630. s.accepts[ "*" ]
  15631. );
  15632. // Check for headers option
  15633. for ( i in s.headers ) {
  15634. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15635. }
  15636. // Allow custom headers/mimetypes and early abort
  15637. if ( s.beforeSend &&
  15638. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15639. // Abort if not done already and return
  15640. return jqXHR.abort();
  15641. }
  15642. // Aborting is no longer a cancellation
  15643. strAbort = "abort";
  15644. // Install callbacks on deferreds
  15645. completeDeferred.add( s.complete );
  15646. jqXHR.done( s.success );
  15647. jqXHR.fail( s.error );
  15648. // Get transport
  15649. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15650. // If no transport, we auto-abort
  15651. if ( !transport ) {
  15652. done( -1, "No Transport" );
  15653. } else {
  15654. jqXHR.readyState = 1;
  15655. // Send global event
  15656. if ( fireGlobals ) {
  15657. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15658. }
  15659. // If request was aborted inside ajaxSend, stop there
  15660. if ( completed ) {
  15661. return jqXHR;
  15662. }
  15663. // Timeout
  15664. if ( s.async && s.timeout > 0 ) {
  15665. timeoutTimer = window.setTimeout( function() {
  15666. jqXHR.abort( "timeout" );
  15667. }, s.timeout );
  15668. }
  15669. try {
  15670. completed = false;
  15671. transport.send( requestHeaders, done );
  15672. } catch ( e ) {
  15673. // Rethrow post-completion exceptions
  15674. if ( completed ) {
  15675. throw e;
  15676. }
  15677. // Propagate others as results
  15678. done( -1, e );
  15679. }
  15680. }
  15681. // Callback for when everything is done
  15682. function done( status, nativeStatusText, responses, headers ) {
  15683. var isSuccess, success, error, response, modified,
  15684. statusText = nativeStatusText;
  15685. // Ignore repeat invocations
  15686. if ( completed ) {
  15687. return;
  15688. }
  15689. completed = true;
  15690. // Clear timeout if it exists
  15691. if ( timeoutTimer ) {
  15692. window.clearTimeout( timeoutTimer );
  15693. }
  15694. // Dereference transport for early garbage collection
  15695. // (no matter how long the jqXHR object will be used)
  15696. transport = undefined;
  15697. // Cache response headers
  15698. responseHeadersString = headers || "";
  15699. // Set readyState
  15700. jqXHR.readyState = status > 0 ? 4 : 0;
  15701. // Determine if successful
  15702. isSuccess = status >= 200 && status < 300 || status === 304;
  15703. // Get response data
  15704. if ( responses ) {
  15705. response = ajaxHandleResponses( s, jqXHR, responses );
  15706. }
  15707. // Convert no matter what (that way responseXXX fields are always set)
  15708. response = ajaxConvert( s, response, jqXHR, isSuccess );
  15709. // If successful, handle type chaining
  15710. if ( isSuccess ) {
  15711. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15712. if ( s.ifModified ) {
  15713. modified = jqXHR.getResponseHeader( "Last-Modified" );
  15714. if ( modified ) {
  15715. jQuery.lastModified[ cacheURL ] = modified;
  15716. }
  15717. modified = jqXHR.getResponseHeader( "etag" );
  15718. if ( modified ) {
  15719. jQuery.etag[ cacheURL ] = modified;
  15720. }
  15721. }
  15722. // if no content
  15723. if ( status === 204 || s.type === "HEAD" ) {
  15724. statusText = "nocontent";
  15725. // if not modified
  15726. } else if ( status === 304 ) {
  15727. statusText = "notmodified";
  15728. // If we have data, let's convert it
  15729. } else {
  15730. statusText = response.state;
  15731. success = response.data;
  15732. error = response.error;
  15733. isSuccess = !error;
  15734. }
  15735. } else {
  15736. // Extract error from statusText and normalize for non-aborts
  15737. error = statusText;
  15738. if ( status || !statusText ) {
  15739. statusText = "error";
  15740. if ( status < 0 ) {
  15741. status = 0;
  15742. }
  15743. }
  15744. }
  15745. // Set data for the fake xhr object
  15746. jqXHR.status = status;
  15747. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  15748. // Success/Error
  15749. if ( isSuccess ) {
  15750. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  15751. } else {
  15752. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  15753. }
  15754. // Status-dependent callbacks
  15755. jqXHR.statusCode( statusCode );
  15756. statusCode = undefined;
  15757. if ( fireGlobals ) {
  15758. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  15759. [ jqXHR, s, isSuccess ? success : error ] );
  15760. }
  15761. // Complete
  15762. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  15763. if ( fireGlobals ) {
  15764. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  15765. // Handle the global AJAX counter
  15766. if ( !( --jQuery.active ) ) {
  15767. jQuery.event.trigger( "ajaxStop" );
  15768. }
  15769. }
  15770. }
  15771. return jqXHR;
  15772. },
  15773. getJSON: function( url, data, callback ) {
  15774. return jQuery.get( url, data, callback, "json" );
  15775. },
  15776. getScript: function( url, callback ) {
  15777. return jQuery.get( url, undefined, callback, "script" );
  15778. }
  15779. } );
  15780. jQuery.each( [ "get", "post" ], function( i, method ) {
  15781. jQuery[ method ] = function( url, data, callback, type ) {
  15782. // Shift arguments if data argument was omitted
  15783. if ( isFunction( data ) ) {
  15784. type = type || callback;
  15785. callback = data;
  15786. data = undefined;
  15787. }
  15788. // The url can be an options object (which then must have .url)
  15789. return jQuery.ajax( jQuery.extend( {
  15790. url: url,
  15791. type: method,
  15792. dataType: type,
  15793. data: data,
  15794. success: callback
  15795. }, jQuery.isPlainObject( url ) && url ) );
  15796. };
  15797. } );
  15798. jQuery._evalUrl = function( url, options ) {
  15799. return jQuery.ajax( {
  15800. url: url,
  15801. // Make this explicit, since user can override this through ajaxSetup (#11264)
  15802. type: "GET",
  15803. dataType: "script",
  15804. cache: true,
  15805. async: false,
  15806. global: false,
  15807. // Only evaluate the response if it is successful (gh-4126)
  15808. // dataFilter is not invoked for failure responses, so using it instead
  15809. // of the default converter is kludgy but it works.
  15810. converters: {
  15811. "text script": function() {}
  15812. },
  15813. dataFilter: function( response ) {
  15814. jQuery.globalEval( response, options );
  15815. }
  15816. } );
  15817. };
  15818. jQuery.fn.extend( {
  15819. wrapAll: function( html ) {
  15820. var wrap;
  15821. if ( this[ 0 ] ) {
  15822. if ( isFunction( html ) ) {
  15823. html = html.call( this[ 0 ] );
  15824. }
  15825. // The elements to wrap the target around
  15826. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  15827. if ( this[ 0 ].parentNode ) {
  15828. wrap.insertBefore( this[ 0 ] );
  15829. }
  15830. wrap.map( function() {
  15831. var elem = this;
  15832. while ( elem.firstElementChild ) {
  15833. elem = elem.firstElementChild;
  15834. }
  15835. return elem;
  15836. } ).append( this );
  15837. }
  15838. return this;
  15839. },
  15840. wrapInner: function( html ) {
  15841. if ( isFunction( html ) ) {
  15842. return this.each( function( i ) {
  15843. jQuery( this ).wrapInner( html.call( this, i ) );
  15844. } );
  15845. }
  15846. return this.each( function() {
  15847. var self = jQuery( this ),
  15848. contents = self.contents();
  15849. if ( contents.length ) {
  15850. contents.wrapAll( html );
  15851. } else {
  15852. self.append( html );
  15853. }
  15854. } );
  15855. },
  15856. wrap: function( html ) {
  15857. var htmlIsFunction = isFunction( html );
  15858. return this.each( function( i ) {
  15859. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  15860. } );
  15861. },
  15862. unwrap: function( selector ) {
  15863. this.parent( selector ).not( "body" ).each( function() {
  15864. jQuery( this ).replaceWith( this.childNodes );
  15865. } );
  15866. return this;
  15867. }
  15868. } );
  15869. jQuery.expr.pseudos.hidden = function( elem ) {
  15870. return !jQuery.expr.pseudos.visible( elem );
  15871. };
  15872. jQuery.expr.pseudos.visible = function( elem ) {
  15873. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  15874. };
  15875. jQuery.ajaxSettings.xhr = function() {
  15876. try {
  15877. return new window.XMLHttpRequest();
  15878. } catch ( e ) {}
  15879. };
  15880. var xhrSuccessStatus = {
  15881. // File protocol always yields status code 0, assume 200
  15882. 0: 200,
  15883. // Support: IE <=9 only
  15884. // #1450: sometimes IE returns 1223 when it should be 204
  15885. 1223: 204
  15886. },
  15887. xhrSupported = jQuery.ajaxSettings.xhr();
  15888. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  15889. support.ajax = xhrSupported = !!xhrSupported;
  15890. jQuery.ajaxTransport( function( options ) {
  15891. var callback, errorCallback;
  15892. // Cross domain only allowed if supported through XMLHttpRequest
  15893. if ( support.cors || xhrSupported && !options.crossDomain ) {
  15894. return {
  15895. send: function( headers, complete ) {
  15896. var i,
  15897. xhr = options.xhr();
  15898. xhr.open(
  15899. options.type,
  15900. options.url,
  15901. options.async,
  15902. options.username,
  15903. options.password
  15904. );
  15905. // Apply custom fields if provided
  15906. if ( options.xhrFields ) {
  15907. for ( i in options.xhrFields ) {
  15908. xhr[ i ] = options.xhrFields[ i ];
  15909. }
  15910. }
  15911. // Override mime type if needed
  15912. if ( options.mimeType && xhr.overrideMimeType ) {
  15913. xhr.overrideMimeType( options.mimeType );
  15914. }
  15915. // X-Requested-With header
  15916. // For cross-domain requests, seeing as conditions for a preflight are
  15917. // akin to a jigsaw puzzle, we simply never set it to be sure.
  15918. // (it can always be set on a per-request basis or even using ajaxSetup)
  15919. // For same-domain requests, won't change header if already provided.
  15920. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  15921. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  15922. }
  15923. // Set headers
  15924. for ( i in headers ) {
  15925. xhr.setRequestHeader( i, headers[ i ] );
  15926. }
  15927. // Callback
  15928. callback = function( type ) {
  15929. return function() {
  15930. if ( callback ) {
  15931. callback = errorCallback = xhr.onload =
  15932. xhr.onerror = xhr.onabort = xhr.ontimeout =
  15933. xhr.onreadystatechange = null;
  15934. if ( type === "abort" ) {
  15935. xhr.abort();
  15936. } else if ( type === "error" ) {
  15937. // Support: IE <=9 only
  15938. // On a manual native abort, IE9 throws
  15939. // errors on any property access that is not readyState
  15940. if ( typeof xhr.status !== "number" ) {
  15941. complete( 0, "error" );
  15942. } else {
  15943. complete(
  15944. // File: protocol always yields status 0; see #8605, #14207
  15945. xhr.status,
  15946. xhr.statusText
  15947. );
  15948. }
  15949. } else {
  15950. complete(
  15951. xhrSuccessStatus[ xhr.status ] || xhr.status,
  15952. xhr.statusText,
  15953. // Support: IE <=9 only
  15954. // IE9 has no XHR2 but throws on binary (trac-11426)
  15955. // For XHR2 non-text, let the caller handle it (gh-2498)
  15956. ( xhr.responseType || "text" ) !== "text" ||
  15957. typeof xhr.responseText !== "string" ?
  15958. { binary: xhr.response } :
  15959. { text: xhr.responseText },
  15960. xhr.getAllResponseHeaders()
  15961. );
  15962. }
  15963. }
  15964. };
  15965. };
  15966. // Listen to events
  15967. xhr.onload = callback();
  15968. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  15969. // Support: IE 9 only
  15970. // Use onreadystatechange to replace onabort
  15971. // to handle uncaught aborts
  15972. if ( xhr.onabort !== undefined ) {
  15973. xhr.onabort = errorCallback;
  15974. } else {
  15975. xhr.onreadystatechange = function() {
  15976. // Check readyState before timeout as it changes
  15977. if ( xhr.readyState === 4 ) {
  15978. // Allow onerror to be called first,
  15979. // but that will not handle a native abort
  15980. // Also, save errorCallback to a variable
  15981. // as xhr.onerror cannot be accessed
  15982. window.setTimeout( function() {
  15983. if ( callback ) {
  15984. errorCallback();
  15985. }
  15986. } );
  15987. }
  15988. };
  15989. }
  15990. // Create the abort callback
  15991. callback = callback( "abort" );
  15992. try {
  15993. // Do send the request (this may raise an exception)
  15994. xhr.send( options.hasContent && options.data || null );
  15995. } catch ( e ) {
  15996. // #14683: Only rethrow if this hasn't been notified as an error yet
  15997. if ( callback ) {
  15998. throw e;
  15999. }
  16000. }
  16001. },
  16002. abort: function() {
  16003. if ( callback ) {
  16004. callback();
  16005. }
  16006. }
  16007. };
  16008. }
  16009. } );
  16010. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16011. jQuery.ajaxPrefilter( function( s ) {
  16012. if ( s.crossDomain ) {
  16013. s.contents.script = false;
  16014. }
  16015. } );
  16016. // Install script dataType
  16017. jQuery.ajaxSetup( {
  16018. accepts: {
  16019. script: "text/javascript, application/javascript, " +
  16020. "application/ecmascript, application/x-ecmascript"
  16021. },
  16022. contents: {
  16023. script: /\b(?:java|ecma)script\b/
  16024. },
  16025. converters: {
  16026. "text script": function( text ) {
  16027. jQuery.globalEval( text );
  16028. return text;
  16029. }
  16030. }
  16031. } );
  16032. // Handle cache's special case and crossDomain
  16033. jQuery.ajaxPrefilter( "script", function( s ) {
  16034. if ( s.cache === undefined ) {
  16035. s.cache = false;
  16036. }
  16037. if ( s.crossDomain ) {
  16038. s.type = "GET";
  16039. }
  16040. } );
  16041. // Bind script tag hack transport
  16042. jQuery.ajaxTransport( "script", function( s ) {
  16043. // This transport only deals with cross domain or forced-by-attrs requests
  16044. if ( s.crossDomain || s.scriptAttrs ) {
  16045. var script, callback;
  16046. return {
  16047. send: function( _, complete ) {
  16048. script = jQuery( "<script>" )
  16049. .attr( s.scriptAttrs || {} )
  16050. .prop( { charset: s.scriptCharset, src: s.url } )
  16051. .on( "load error", callback = function( evt ) {
  16052. script.remove();
  16053. callback = null;
  16054. if ( evt ) {
  16055. complete( evt.type === "error" ? 404 : 200, evt.type );
  16056. }
  16057. } );
  16058. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16059. document.head.appendChild( script[ 0 ] );
  16060. },
  16061. abort: function() {
  16062. if ( callback ) {
  16063. callback();
  16064. }
  16065. }
  16066. };
  16067. }
  16068. } );
  16069. var oldCallbacks = [],
  16070. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16071. // Default jsonp settings
  16072. jQuery.ajaxSetup( {
  16073. jsonp: "callback",
  16074. jsonpCallback: function() {
  16075. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16076. this[ callback ] = true;
  16077. return callback;
  16078. }
  16079. } );
  16080. // Detect, normalize options and install callbacks for jsonp requests
  16081. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16082. var callbackName, overwritten, responseContainer,
  16083. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16084. "url" :
  16085. typeof s.data === "string" &&
  16086. ( s.contentType || "" )
  16087. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16088. rjsonp.test( s.data ) && "data"
  16089. );
  16090. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16091. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16092. // Get callback name, remembering preexisting value associated with it
  16093. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16094. s.jsonpCallback() :
  16095. s.jsonpCallback;
  16096. // Insert callback into url or form data
  16097. if ( jsonProp ) {
  16098. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16099. } else if ( s.jsonp !== false ) {
  16100. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16101. }
  16102. // Use data converter to retrieve json after script execution
  16103. s.converters[ "script json" ] = function() {
  16104. if ( !responseContainer ) {
  16105. jQuery.error( callbackName + " was not called" );
  16106. }
  16107. return responseContainer[ 0 ];
  16108. };
  16109. // Force json dataType
  16110. s.dataTypes[ 0 ] = "json";
  16111. // Install callback
  16112. overwritten = window[ callbackName ];
  16113. window[ callbackName ] = function() {
  16114. responseContainer = arguments;
  16115. };
  16116. // Clean-up function (fires after converters)
  16117. jqXHR.always( function() {
  16118. // If previous value didn't exist - remove it
  16119. if ( overwritten === undefined ) {
  16120. jQuery( window ).removeProp( callbackName );
  16121. // Otherwise restore preexisting value
  16122. } else {
  16123. window[ callbackName ] = overwritten;
  16124. }
  16125. // Save back as free
  16126. if ( s[ callbackName ] ) {
  16127. // Make sure that re-using the options doesn't screw things around
  16128. s.jsonpCallback = originalSettings.jsonpCallback;
  16129. // Save the callback name for future use
  16130. oldCallbacks.push( callbackName );
  16131. }
  16132. // Call if it was a function and we have a response
  16133. if ( responseContainer && isFunction( overwritten ) ) {
  16134. overwritten( responseContainer[ 0 ] );
  16135. }
  16136. responseContainer = overwritten = undefined;
  16137. } );
  16138. // Delegate to script
  16139. return "script";
  16140. }
  16141. } );
  16142. // Support: Safari 8 only
  16143. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16144. // collapse sibling forms: the second one becomes a child of the first one.
  16145. // Because of that, this security measure has to be disabled in Safari 8.
  16146. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16147. support.createHTMLDocument = ( function() {
  16148. var body = document.implementation.createHTMLDocument( "" ).body;
  16149. body.innerHTML = "<form></form><form></form>";
  16150. return body.childNodes.length === 2;
  16151. } )();
  16152. // Argument "data" should be string of html
  16153. // context (optional): If specified, the fragment will be created in this context,
  16154. // defaults to document
  16155. // keepScripts (optional): If true, will include scripts passed in the html string
  16156. jQuery.parseHTML = function( data, context, keepScripts ) {
  16157. if ( typeof data !== "string" ) {
  16158. return [];
  16159. }
  16160. if ( typeof context === "boolean" ) {
  16161. keepScripts = context;
  16162. context = false;
  16163. }
  16164. var base, parsed, scripts;
  16165. if ( !context ) {
  16166. // Stop scripts or inline event handlers from being executed immediately
  16167. // by using document.implementation
  16168. if ( support.createHTMLDocument ) {
  16169. context = document.implementation.createHTMLDocument( "" );
  16170. // Set the base href for the created document
  16171. // so any parsed elements with URLs
  16172. // are based on the document's URL (gh-2965)
  16173. base = context.createElement( "base" );
  16174. base.href = document.location.href;
  16175. context.head.appendChild( base );
  16176. } else {
  16177. context = document;
  16178. }
  16179. }
  16180. parsed = rsingleTag.exec( data );
  16181. scripts = !keepScripts && [];
  16182. // Single tag
  16183. if ( parsed ) {
  16184. return [ context.createElement( parsed[ 1 ] ) ];
  16185. }
  16186. parsed = buildFragment( [ data ], context, scripts );
  16187. if ( scripts && scripts.length ) {
  16188. jQuery( scripts ).remove();
  16189. }
  16190. return jQuery.merge( [], parsed.childNodes );
  16191. };
  16192. /**
  16193. * Load a url into a page
  16194. */
  16195. jQuery.fn.load = function( url, params, callback ) {
  16196. var selector, type, response,
  16197. self = this,
  16198. off = url.indexOf( " " );
  16199. if ( off > -1 ) {
  16200. selector = stripAndCollapse( url.slice( off ) );
  16201. url = url.slice( 0, off );
  16202. }
  16203. // If it's a function
  16204. if ( isFunction( params ) ) {
  16205. // We assume that it's the callback
  16206. callback = params;
  16207. params = undefined;
  16208. // Otherwise, build a param string
  16209. } else if ( params && typeof params === "object" ) {
  16210. type = "POST";
  16211. }
  16212. // If we have elements to modify, make the request
  16213. if ( self.length > 0 ) {
  16214. jQuery.ajax( {
  16215. url: url,
  16216. // If "type" variable is undefined, then "GET" method will be used.
  16217. // Make value of this field explicit since
  16218. // user can override it through ajaxSetup method
  16219. type: type || "GET",
  16220. dataType: "html",
  16221. data: params
  16222. } ).done( function( responseText ) {
  16223. // Save response for use in complete callback
  16224. response = arguments;
  16225. self.html( selector ?
  16226. // If a selector was specified, locate the right elements in a dummy div
  16227. // Exclude scripts to avoid IE 'Permission Denied' errors
  16228. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16229. // Otherwise use the full result
  16230. responseText );
  16231. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16232. // but they are ignored because response was set above.
  16233. // If it fails, this function gets "jqXHR", "status", "error"
  16234. } ).always( callback && function( jqXHR, status ) {
  16235. self.each( function() {
  16236. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16237. } );
  16238. } );
  16239. }
  16240. return this;
  16241. };
  16242. // Attach a bunch of functions for handling common AJAX events
  16243. jQuery.each( [
  16244. "ajaxStart",
  16245. "ajaxStop",
  16246. "ajaxComplete",
  16247. "ajaxError",
  16248. "ajaxSuccess",
  16249. "ajaxSend"
  16250. ], function( i, type ) {
  16251. jQuery.fn[ type ] = function( fn ) {
  16252. return this.on( type, fn );
  16253. };
  16254. } );
  16255. jQuery.expr.pseudos.animated = function( elem ) {
  16256. return jQuery.grep( jQuery.timers, function( fn ) {
  16257. return elem === fn.elem;
  16258. } ).length;
  16259. };
  16260. jQuery.offset = {
  16261. setOffset: function( elem, options, i ) {
  16262. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16263. position = jQuery.css( elem, "position" ),
  16264. curElem = jQuery( elem ),
  16265. props = {};
  16266. // Set position first, in-case top/left are set even on static elem
  16267. if ( position === "static" ) {
  16268. elem.style.position = "relative";
  16269. }
  16270. curOffset = curElem.offset();
  16271. curCSSTop = jQuery.css( elem, "top" );
  16272. curCSSLeft = jQuery.css( elem, "left" );
  16273. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16274. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16275. // Need to be able to calculate position if either
  16276. // top or left is auto and position is either absolute or fixed
  16277. if ( calculatePosition ) {
  16278. curPosition = curElem.position();
  16279. curTop = curPosition.top;
  16280. curLeft = curPosition.left;
  16281. } else {
  16282. curTop = parseFloat( curCSSTop ) || 0;
  16283. curLeft = parseFloat( curCSSLeft ) || 0;
  16284. }
  16285. if ( isFunction( options ) ) {
  16286. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16287. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16288. }
  16289. if ( options.top != null ) {
  16290. props.top = ( options.top - curOffset.top ) + curTop;
  16291. }
  16292. if ( options.left != null ) {
  16293. props.left = ( options.left - curOffset.left ) + curLeft;
  16294. }
  16295. if ( "using" in options ) {
  16296. options.using.call( elem, props );
  16297. } else {
  16298. curElem.css( props );
  16299. }
  16300. }
  16301. };
  16302. jQuery.fn.extend( {
  16303. // offset() relates an element's border box to the document origin
  16304. offset: function( options ) {
  16305. // Preserve chaining for setter
  16306. if ( arguments.length ) {
  16307. return options === undefined ?
  16308. this :
  16309. this.each( function( i ) {
  16310. jQuery.offset.setOffset( this, options, i );
  16311. } );
  16312. }
  16313. var rect, win,
  16314. elem = this[ 0 ];
  16315. if ( !elem ) {
  16316. return;
  16317. }
  16318. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16319. // Support: IE <=11 only
  16320. // Running getBoundingClientRect on a
  16321. // disconnected node in IE throws an error
  16322. if ( !elem.getClientRects().length ) {
  16323. return { top: 0, left: 0 };
  16324. }
  16325. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16326. rect = elem.getBoundingClientRect();
  16327. win = elem.ownerDocument.defaultView;
  16328. return {
  16329. top: rect.top + win.pageYOffset,
  16330. left: rect.left + win.pageXOffset
  16331. };
  16332. },
  16333. // position() relates an element's margin box to its offset parent's padding box
  16334. // This corresponds to the behavior of CSS absolute positioning
  16335. position: function() {
  16336. if ( !this[ 0 ] ) {
  16337. return;
  16338. }
  16339. var offsetParent, offset, doc,
  16340. elem = this[ 0 ],
  16341. parentOffset = { top: 0, left: 0 };
  16342. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16343. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16344. // Assume position:fixed implies availability of getBoundingClientRect
  16345. offset = elem.getBoundingClientRect();
  16346. } else {
  16347. offset = this.offset();
  16348. // Account for the *real* offset parent, which can be the document or its root element
  16349. // when a statically positioned element is identified
  16350. doc = elem.ownerDocument;
  16351. offsetParent = elem.offsetParent || doc.documentElement;
  16352. while ( offsetParent &&
  16353. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16354. jQuery.css( offsetParent, "position" ) === "static" ) {
  16355. offsetParent = offsetParent.parentNode;
  16356. }
  16357. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16358. // Incorporate borders into its offset, since they are outside its content origin
  16359. parentOffset = jQuery( offsetParent ).offset();
  16360. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16361. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16362. }
  16363. }
  16364. // Subtract parent offsets and element margins
  16365. return {
  16366. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16367. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16368. };
  16369. },
  16370. // This method will return documentElement in the following cases:
  16371. // 1) For the element inside the iframe without offsetParent, this method will return
  16372. // documentElement of the parent window
  16373. // 2) For the hidden or detached element
  16374. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16375. //
  16376. // but those exceptions were never presented as a real life use-cases
  16377. // and might be considered as more preferable results.
  16378. //
  16379. // This logic, however, is not guaranteed and can change at any point in the future
  16380. offsetParent: function() {
  16381. return this.map( function() {
  16382. var offsetParent = this.offsetParent;
  16383. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16384. offsetParent = offsetParent.offsetParent;
  16385. }
  16386. return offsetParent || documentElement;
  16387. } );
  16388. }
  16389. } );
  16390. // Create scrollLeft and scrollTop methods
  16391. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16392. var top = "pageYOffset" === prop;
  16393. jQuery.fn[ method ] = function( val ) {
  16394. return access( this, function( elem, method, val ) {
  16395. // Coalesce documents and windows
  16396. var win;
  16397. if ( isWindow( elem ) ) {
  16398. win = elem;
  16399. } else if ( elem.nodeType === 9 ) {
  16400. win = elem.defaultView;
  16401. }
  16402. if ( val === undefined ) {
  16403. return win ? win[ prop ] : elem[ method ];
  16404. }
  16405. if ( win ) {
  16406. win.scrollTo(
  16407. !top ? val : win.pageXOffset,
  16408. top ? val : win.pageYOffset
  16409. );
  16410. } else {
  16411. elem[ method ] = val;
  16412. }
  16413. }, method, val, arguments.length );
  16414. };
  16415. } );
  16416. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16417. // Add the top/left cssHooks using jQuery.fn.position
  16418. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16419. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16420. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16421. // rather than make the css module depend on the offset module, just check for it here
  16422. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16423. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16424. function( elem, computed ) {
  16425. if ( computed ) {
  16426. computed = curCSS( elem, prop );
  16427. // If curCSS returns percentage, fallback to offset
  16428. return rnumnonpx.test( computed ) ?
  16429. jQuery( elem ).position()[ prop ] + "px" :
  16430. computed;
  16431. }
  16432. }
  16433. );
  16434. } );
  16435. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16436. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16437. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16438. function( defaultExtra, funcName ) {
  16439. // Margin is only for outerHeight, outerWidth
  16440. jQuery.fn[ funcName ] = function( margin, value ) {
  16441. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16442. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16443. return access( this, function( elem, type, value ) {
  16444. var doc;
  16445. if ( isWindow( elem ) ) {
  16446. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16447. return funcName.indexOf( "outer" ) === 0 ?
  16448. elem[ "inner" + name ] :
  16449. elem.document.documentElement[ "client" + name ];
  16450. }
  16451. // Get document width or height
  16452. if ( elem.nodeType === 9 ) {
  16453. doc = elem.documentElement;
  16454. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16455. // whichever is greatest
  16456. return Math.max(
  16457. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16458. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16459. doc[ "client" + name ]
  16460. );
  16461. }
  16462. return value === undefined ?
  16463. // Get width or height on the element, requesting but not forcing parseFloat
  16464. jQuery.css( elem, type, extra ) :
  16465. // Set width or height on the element
  16466. jQuery.style( elem, type, value, extra );
  16467. }, type, chainable ? margin : undefined, chainable );
  16468. };
  16469. } );
  16470. } );
  16471. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16472. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16473. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16474. function( i, name ) {
  16475. // Handle event binding
  16476. jQuery.fn[ name ] = function( data, fn ) {
  16477. return arguments.length > 0 ?
  16478. this.on( name, null, data, fn ) :
  16479. this.trigger( name );
  16480. };
  16481. } );
  16482. jQuery.fn.extend( {
  16483. hover: function( fnOver, fnOut ) {
  16484. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16485. }
  16486. } );
  16487. jQuery.fn.extend( {
  16488. bind: function( types, data, fn ) {
  16489. return this.on( types, null, data, fn );
  16490. },
  16491. unbind: function( types, fn ) {
  16492. return this.off( types, null, fn );
  16493. },
  16494. delegate: function( selector, types, data, fn ) {
  16495. return this.on( types, selector, data, fn );
  16496. },
  16497. undelegate: function( selector, types, fn ) {
  16498. // ( namespace ) or ( selector, types [, fn] )
  16499. return arguments.length === 1 ?
  16500. this.off( selector, "**" ) :
  16501. this.off( types, selector || "**", fn );
  16502. }
  16503. } );
  16504. // Bind a function to a context, optionally partially applying any
  16505. // arguments.
  16506. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16507. // However, it is not slated for removal any time soon
  16508. jQuery.proxy = function( fn, context ) {
  16509. var tmp, args, proxy;
  16510. if ( typeof context === "string" ) {
  16511. tmp = fn[ context ];
  16512. context = fn;
  16513. fn = tmp;
  16514. }
  16515. // Quick check to determine if target is callable, in the spec
  16516. // this throws a TypeError, but we will just return undefined.
  16517. if ( !isFunction( fn ) ) {
  16518. return undefined;
  16519. }
  16520. // Simulated bind
  16521. args = slice.call( arguments, 2 );
  16522. proxy = function() {
  16523. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16524. };
  16525. // Set the guid of unique handler to the same of original handler, so it can be removed
  16526. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16527. return proxy;
  16528. };
  16529. jQuery.holdReady = function( hold ) {
  16530. if ( hold ) {
  16531. jQuery.readyWait++;
  16532. } else {
  16533. jQuery.ready( true );
  16534. }
  16535. };
  16536. jQuery.isArray = Array.isArray;
  16537. jQuery.parseJSON = JSON.parse;
  16538. jQuery.nodeName = nodeName;
  16539. jQuery.isFunction = isFunction;
  16540. jQuery.isWindow = isWindow;
  16541. jQuery.camelCase = camelCase;
  16542. jQuery.type = toType;
  16543. jQuery.now = Date.now;
  16544. jQuery.isNumeric = function( obj ) {
  16545. // As of jQuery 3.0, isNumeric is limited to
  16546. // strings and numbers (primitives or objects)
  16547. // that can be coerced to finite numbers (gh-2662)
  16548. var type = jQuery.type( obj );
  16549. return ( type === "number" || type === "string" ) &&
  16550. // parseFloat NaNs numeric-cast false positives ("")
  16551. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16552. // subtraction forces infinities to NaN
  16553. !isNaN( obj - parseFloat( obj ) );
  16554. };
  16555. // Register as a named AMD module, since jQuery can be concatenated with other
  16556. // files that may use define, but not via a proper concatenation script that
  16557. // understands anonymous AMD modules. A named AMD is safest and most robust
  16558. // way to register. Lowercase jquery is used because AMD module names are
  16559. // derived from file names, and jQuery is normally delivered in a lowercase
  16560. // file name. Do this after creating the global so that if an AMD module wants
  16561. // to call noConflict to hide this version of jQuery, it will work.
  16562. // Note that for maximum portability, libraries that are not jQuery should
  16563. // declare themselves as anonymous modules, and avoid setting a global if an
  16564. // AMD loader is present. jQuery is a special case. For more information, see
  16565. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16566. if ( true ) {
  16567. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16568. return jQuery;
  16569. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16570. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16571. }
  16572. var
  16573. // Map over jQuery in case of overwrite
  16574. _jQuery = window.jQuery,
  16575. // Map over the $ in case of overwrite
  16576. _$ = window.$;
  16577. jQuery.noConflict = function( deep ) {
  16578. if ( window.$ === jQuery ) {
  16579. window.$ = _$;
  16580. }
  16581. if ( deep && window.jQuery === jQuery ) {
  16582. window.jQuery = _jQuery;
  16583. }
  16584. return jQuery;
  16585. };
  16586. // Expose jQuery and $ identifiers, even in AMD
  16587. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16588. // and CommonJS for browser emulators (#13566)
  16589. if ( !noGlobal ) {
  16590. window.jQuery = window.$ = jQuery;
  16591. }
  16592. return jQuery;
  16593. } );
  16594. /***/ }),
  16595. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16596. /*!************************************************!*\
  16597. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16598. \************************************************/
  16599. /*! exports provided: default */
  16600. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16601. "use strict";
  16602. __webpack_require__.r(__webpack_exports__);
  16603. var classCallCheck = function (instance, Constructor) {
  16604. if (!(instance instanceof Constructor)) {
  16605. throw new TypeError("Cannot call a class as a function");
  16606. }
  16607. };
  16608. var createClass = function () {
  16609. function defineProperties(target, props) {
  16610. for (var i = 0; i < props.length; i++) {
  16611. var descriptor = props[i];
  16612. descriptor.enumerable = descriptor.enumerable || false;
  16613. descriptor.configurable = true;
  16614. if ("value" in descriptor) descriptor.writable = true;
  16615. Object.defineProperty(target, descriptor.key, descriptor);
  16616. }
  16617. }
  16618. return function (Constructor, protoProps, staticProps) {
  16619. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16620. if (staticProps) defineProperties(Constructor, staticProps);
  16621. return Constructor;
  16622. };
  16623. }();
  16624. var _extends = Object.assign || function (target) {
  16625. for (var i = 1; i < arguments.length; i++) {
  16626. var source = arguments[i];
  16627. for (var key in source) {
  16628. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16629. target[key] = source[key];
  16630. }
  16631. }
  16632. }
  16633. return target;
  16634. };
  16635. var inherits = function (subClass, superClass) {
  16636. if (typeof superClass !== "function" && superClass !== null) {
  16637. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16638. }
  16639. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16640. constructor: {
  16641. value: subClass,
  16642. enumerable: false,
  16643. writable: true,
  16644. configurable: true
  16645. }
  16646. });
  16647. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16648. };
  16649. var possibleConstructorReturn = function (self, call) {
  16650. if (!self) {
  16651. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16652. }
  16653. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16654. };
  16655. var Connector = function () {
  16656. /**
  16657. * Create a new class instance.
  16658. */
  16659. function Connector(options) {
  16660. classCallCheck(this, Connector);
  16661. /**
  16662. * Default connector options.
  16663. */
  16664. this._defaultOptions = {
  16665. auth: {
  16666. headers: {}
  16667. },
  16668. authEndpoint: '/broadcasting/auth',
  16669. broadcaster: 'pusher',
  16670. csrfToken: null,
  16671. host: null,
  16672. key: null,
  16673. namespace: 'App.Events'
  16674. };
  16675. this.setOptions(options);
  16676. this.connect();
  16677. }
  16678. /**
  16679. * Merge the custom options with the defaults.
  16680. */
  16681. createClass(Connector, [{
  16682. key: 'setOptions',
  16683. value: function setOptions(options) {
  16684. this.options = _extends(this._defaultOptions, options);
  16685. if (this.csrfToken()) {
  16686. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16687. }
  16688. return options;
  16689. }
  16690. /**
  16691. * Extract the CSRF token from the page.
  16692. */
  16693. }, {
  16694. key: 'csrfToken',
  16695. value: function csrfToken() {
  16696. var selector = void 0;
  16697. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16698. return window['Laravel'].csrfToken;
  16699. } else if (this.options.csrfToken) {
  16700. return this.options.csrfToken;
  16701. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16702. return selector.getAttribute('content');
  16703. }
  16704. return null;
  16705. }
  16706. }]);
  16707. return Connector;
  16708. }();
  16709. /**
  16710. * This class represents a basic channel.
  16711. */
  16712. var Channel = function () {
  16713. function Channel() {
  16714. classCallCheck(this, Channel);
  16715. }
  16716. createClass(Channel, [{
  16717. key: 'listenForWhisper',
  16718. /**
  16719. * Listen for a whisper event on the channel instance.
  16720. */
  16721. value: function listenForWhisper(event, callback) {
  16722. return this.listen('.client-' + event, callback);
  16723. }
  16724. /**
  16725. * Listen for an event on the channel instance.
  16726. */
  16727. }, {
  16728. key: 'notification',
  16729. value: function notification(callback) {
  16730. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  16731. }
  16732. /**
  16733. * Stop listening for a whispser event on the channel instance.
  16734. */
  16735. }, {
  16736. key: 'stopListeningForWhisper',
  16737. value: function stopListeningForWhisper(event) {
  16738. return this.stopListening('.client-' + event);
  16739. }
  16740. }]);
  16741. return Channel;
  16742. }();
  16743. /**
  16744. * Event name formatter
  16745. */
  16746. var EventFormatter = function () {
  16747. /**
  16748. * Create a new class instance.
  16749. */
  16750. function EventFormatter(namespace) {
  16751. classCallCheck(this, EventFormatter);
  16752. this.setNamespace(namespace);
  16753. }
  16754. /**
  16755. * Format the given event name.
  16756. */
  16757. createClass(EventFormatter, [{
  16758. key: 'format',
  16759. value: function format(event) {
  16760. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  16761. return event.substr(1);
  16762. } else if (this.namespace) {
  16763. event = this.namespace + '.' + event;
  16764. }
  16765. return event.replace(/\./g, '\\');
  16766. }
  16767. /**
  16768. * Set the event namespace.
  16769. */
  16770. }, {
  16771. key: 'setNamespace',
  16772. value: function setNamespace(value) {
  16773. this.namespace = value;
  16774. }
  16775. }]);
  16776. return EventFormatter;
  16777. }();
  16778. /**
  16779. * This class represents a Pusher channel.
  16780. */
  16781. var PusherChannel = function (_Channel) {
  16782. inherits(PusherChannel, _Channel);
  16783. /**
  16784. * Create a new class instance.
  16785. */
  16786. function PusherChannel(pusher, name, options) {
  16787. classCallCheck(this, PusherChannel);
  16788. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  16789. _this.name = name;
  16790. _this.pusher = pusher;
  16791. _this.options = options;
  16792. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  16793. _this.subscribe();
  16794. return _this;
  16795. }
  16796. /**
  16797. * Subscribe to a Pusher channel.
  16798. */
  16799. createClass(PusherChannel, [{
  16800. key: 'subscribe',
  16801. value: function subscribe() {
  16802. this.subscription = this.pusher.subscribe(this.name);
  16803. }
  16804. /**
  16805. * Unsubscribe from a Pusher channel.
  16806. */
  16807. }, {
  16808. key: 'unsubscribe',
  16809. value: function unsubscribe() {
  16810. this.pusher.unsubscribe(this.name);
  16811. }
  16812. /**
  16813. * Listen for an event on the channel instance.
  16814. */
  16815. }, {
  16816. key: 'listen',
  16817. value: function listen(event, callback) {
  16818. this.on(this.eventFormatter.format(event), callback);
  16819. return this;
  16820. }
  16821. /**
  16822. * Stop listening for an event on the channel instance.
  16823. */
  16824. }, {
  16825. key: 'stopListening',
  16826. value: function stopListening(event) {
  16827. this.subscription.unbind(this.eventFormatter.format(event));
  16828. return this;
  16829. }
  16830. /**
  16831. * Bind a channel to an event.
  16832. */
  16833. }, {
  16834. key: 'on',
  16835. value: function on(event, callback) {
  16836. this.subscription.bind(event, callback);
  16837. return this;
  16838. }
  16839. }]);
  16840. return PusherChannel;
  16841. }(Channel);
  16842. /**
  16843. * This class represents a Pusher private channel.
  16844. */
  16845. var PusherPrivateChannel = function (_PusherChannel) {
  16846. inherits(PusherPrivateChannel, _PusherChannel);
  16847. function PusherPrivateChannel() {
  16848. classCallCheck(this, PusherPrivateChannel);
  16849. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  16850. }
  16851. createClass(PusherPrivateChannel, [{
  16852. key: 'whisper',
  16853. /**
  16854. * Trigger client event on the channel.
  16855. */
  16856. value: function whisper(eventName, data) {
  16857. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  16858. return this;
  16859. }
  16860. }]);
  16861. return PusherPrivateChannel;
  16862. }(PusherChannel);
  16863. /**
  16864. * This class represents a Pusher presence channel.
  16865. */
  16866. var PusherPresenceChannel = function (_PusherChannel) {
  16867. inherits(PusherPresenceChannel, _PusherChannel);
  16868. function PusherPresenceChannel() {
  16869. classCallCheck(this, PusherPresenceChannel);
  16870. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  16871. }
  16872. createClass(PusherPresenceChannel, [{
  16873. key: 'here',
  16874. /**
  16875. * Register a callback to be called anytime the member list changes.
  16876. */
  16877. value: function here(callback) {
  16878. this.on('pusher:subscription_succeeded', function (data) {
  16879. callback(Object.keys(data.members).map(function (k) {
  16880. return data.members[k];
  16881. }));
  16882. });
  16883. return this;
  16884. }
  16885. /**
  16886. * Listen for someone joining the channel.
  16887. */
  16888. }, {
  16889. key: 'joining',
  16890. value: function joining(callback) {
  16891. this.on('pusher:member_added', function (member) {
  16892. callback(member.info);
  16893. });
  16894. return this;
  16895. }
  16896. /**
  16897. * Listen for someone leaving the channel.
  16898. */
  16899. }, {
  16900. key: 'leaving',
  16901. value: function leaving(callback) {
  16902. this.on('pusher:member_removed', function (member) {
  16903. callback(member.info);
  16904. });
  16905. return this;
  16906. }
  16907. /**
  16908. * Trigger client event on the channel.
  16909. */
  16910. }, {
  16911. key: 'whisper',
  16912. value: function whisper(eventName, data) {
  16913. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  16914. return this;
  16915. }
  16916. }]);
  16917. return PusherPresenceChannel;
  16918. }(PusherChannel);
  16919. /**
  16920. * This class represents a Socket.io channel.
  16921. */
  16922. var SocketIoChannel = function (_Channel) {
  16923. inherits(SocketIoChannel, _Channel);
  16924. /**
  16925. * Create a new class instance.
  16926. */
  16927. function SocketIoChannel(socket, name, options) {
  16928. classCallCheck(this, SocketIoChannel);
  16929. /**
  16930. * The event callbacks applied to the channel.
  16931. */
  16932. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  16933. _this.events = {};
  16934. _this.name = name;
  16935. _this.socket = socket;
  16936. _this.options = options;
  16937. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  16938. _this.subscribe();
  16939. _this.configureReconnector();
  16940. return _this;
  16941. }
  16942. /**
  16943. * Subscribe to a Socket.io channel.
  16944. */
  16945. createClass(SocketIoChannel, [{
  16946. key: 'subscribe',
  16947. value: function subscribe() {
  16948. this.socket.emit('subscribe', {
  16949. channel: this.name,
  16950. auth: this.options.auth || {}
  16951. });
  16952. }
  16953. /**
  16954. * Unsubscribe from channel and ubind event callbacks.
  16955. */
  16956. }, {
  16957. key: 'unsubscribe',
  16958. value: function unsubscribe() {
  16959. this.unbind();
  16960. this.socket.emit('unsubscribe', {
  16961. channel: this.name,
  16962. auth: this.options.auth || {}
  16963. });
  16964. }
  16965. /**
  16966. * Listen for an event on the channel instance.
  16967. */
  16968. }, {
  16969. key: 'listen',
  16970. value: function listen(event, callback) {
  16971. this.on(this.eventFormatter.format(event), callback);
  16972. return this;
  16973. }
  16974. /**
  16975. * Stop listening for an event on the channel instance.
  16976. */
  16977. }, {
  16978. key: 'stopListening',
  16979. value: function stopListening(event) {
  16980. var name = this.eventFormatter.format(event);
  16981. this.socket.removeListener(name);
  16982. delete this.events[name];
  16983. return this;
  16984. }
  16985. /**
  16986. * Bind the channel's socket to an event and store the callback.
  16987. */
  16988. }, {
  16989. key: 'on',
  16990. value: function on(event, callback) {
  16991. var _this2 = this;
  16992. var listener = function listener(channel, data) {
  16993. if (_this2.name == channel) {
  16994. callback(data);
  16995. }
  16996. };
  16997. this.socket.on(event, listener);
  16998. this.bind(event, listener);
  16999. }
  17000. /**
  17001. * Attach a 'reconnect' listener and bind the event.
  17002. */
  17003. }, {
  17004. key: 'configureReconnector',
  17005. value: function configureReconnector() {
  17006. var _this3 = this;
  17007. var listener = function listener() {
  17008. _this3.subscribe();
  17009. };
  17010. this.socket.on('reconnect', listener);
  17011. this.bind('reconnect', listener);
  17012. }
  17013. /**
  17014. * Bind the channel's socket to an event and store the callback.
  17015. */
  17016. }, {
  17017. key: 'bind',
  17018. value: function bind(event, callback) {
  17019. this.events[event] = this.events[event] || [];
  17020. this.events[event].push(callback);
  17021. }
  17022. /**
  17023. * Unbind the channel's socket from all stored event callbacks.
  17024. */
  17025. }, {
  17026. key: 'unbind',
  17027. value: function unbind() {
  17028. var _this4 = this;
  17029. Object.keys(this.events).forEach(function (event) {
  17030. _this4.events[event].forEach(function (callback) {
  17031. _this4.socket.removeListener(event, callback);
  17032. });
  17033. delete _this4.events[event];
  17034. });
  17035. }
  17036. }]);
  17037. return SocketIoChannel;
  17038. }(Channel);
  17039. /**
  17040. * This class represents a Socket.io presence channel.
  17041. */
  17042. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17043. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17044. function SocketIoPrivateChannel() {
  17045. classCallCheck(this, SocketIoPrivateChannel);
  17046. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17047. }
  17048. createClass(SocketIoPrivateChannel, [{
  17049. key: 'whisper',
  17050. /**
  17051. * Trigger client event on the channel.
  17052. */
  17053. value: function whisper(eventName, data) {
  17054. this.socket.emit('client event', {
  17055. channel: this.name,
  17056. event: 'client-' + eventName,
  17057. data: data
  17058. });
  17059. return this;
  17060. }
  17061. }]);
  17062. return SocketIoPrivateChannel;
  17063. }(SocketIoChannel);
  17064. /**
  17065. * This class represents a Socket.io presence channel.
  17066. */
  17067. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17068. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17069. function SocketIoPresenceChannel() {
  17070. classCallCheck(this, SocketIoPresenceChannel);
  17071. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17072. }
  17073. createClass(SocketIoPresenceChannel, [{
  17074. key: 'here',
  17075. /**
  17076. * Register a callback to be called anytime the member list changes.
  17077. */
  17078. value: function here(callback) {
  17079. this.on('presence:subscribed', function (members) {
  17080. callback(members.map(function (m) {
  17081. return m.user_info;
  17082. }));
  17083. });
  17084. return this;
  17085. }
  17086. /**
  17087. * Listen for someone joining the channel.
  17088. */
  17089. }, {
  17090. key: 'joining',
  17091. value: function joining(callback) {
  17092. this.on('presence:joining', function (member) {
  17093. return callback(member.user_info);
  17094. });
  17095. return this;
  17096. }
  17097. /**
  17098. * Listen for someone leaving the channel.
  17099. */
  17100. }, {
  17101. key: 'leaving',
  17102. value: function leaving(callback) {
  17103. this.on('presence:leaving', function (member) {
  17104. return callback(member.user_info);
  17105. });
  17106. return this;
  17107. }
  17108. }]);
  17109. return SocketIoPresenceChannel;
  17110. }(SocketIoPrivateChannel);
  17111. /**
  17112. * This class represents a null channel.
  17113. */
  17114. var NullChannel = function (_Channel) {
  17115. inherits(NullChannel, _Channel);
  17116. function NullChannel() {
  17117. classCallCheck(this, NullChannel);
  17118. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17119. }
  17120. createClass(NullChannel, [{
  17121. key: 'subscribe',
  17122. /**
  17123. * Subscribe to a channel.
  17124. */
  17125. value: function subscribe() {}
  17126. //
  17127. /**
  17128. * Unsubscribe from a channel.
  17129. */
  17130. }, {
  17131. key: 'unsubscribe',
  17132. value: function unsubscribe() {}
  17133. //
  17134. /**
  17135. * Listen for an event on the channel instance.
  17136. */
  17137. }, {
  17138. key: 'listen',
  17139. value: function listen(event, callback) {
  17140. return this;
  17141. }
  17142. /**
  17143. * Stop listening for an event on the channel instance.
  17144. */
  17145. }, {
  17146. key: 'stopListening',
  17147. value: function stopListening(event) {
  17148. return this;
  17149. }
  17150. /**
  17151. * Bind a channel to an event.
  17152. */
  17153. }, {
  17154. key: 'on',
  17155. value: function on(event, callback) {
  17156. return this;
  17157. }
  17158. }]);
  17159. return NullChannel;
  17160. }(Channel);
  17161. /**
  17162. * This class represents a null private channel.
  17163. */
  17164. var NullPrivateChannel = function (_NullChannel) {
  17165. inherits(NullPrivateChannel, _NullChannel);
  17166. function NullPrivateChannel() {
  17167. classCallCheck(this, NullPrivateChannel);
  17168. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17169. }
  17170. createClass(NullPrivateChannel, [{
  17171. key: 'whisper',
  17172. /**
  17173. * Trigger client event on the channel.
  17174. */
  17175. value: function whisper(eventName, data) {
  17176. return this;
  17177. }
  17178. }]);
  17179. return NullPrivateChannel;
  17180. }(NullChannel);
  17181. /**
  17182. * This class represents a null presence channel.
  17183. */
  17184. var NullPresenceChannel = function (_NullChannel) {
  17185. inherits(NullPresenceChannel, _NullChannel);
  17186. function NullPresenceChannel() {
  17187. classCallCheck(this, NullPresenceChannel);
  17188. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17189. }
  17190. createClass(NullPresenceChannel, [{
  17191. key: 'here',
  17192. /**
  17193. * Register a callback to be called anytime the member list changes.
  17194. */
  17195. value: function here(callback) {
  17196. return this;
  17197. }
  17198. /**
  17199. * Listen for someone joining the channel.
  17200. */
  17201. }, {
  17202. key: 'joining',
  17203. value: function joining(callback) {
  17204. return this;
  17205. }
  17206. /**
  17207. * Listen for someone leaving the channel.
  17208. */
  17209. }, {
  17210. key: 'leaving',
  17211. value: function leaving(callback) {
  17212. return this;
  17213. }
  17214. /**
  17215. * Trigger client event on the channel.
  17216. */
  17217. }, {
  17218. key: 'whisper',
  17219. value: function whisper(eventName, data) {
  17220. return this;
  17221. }
  17222. }]);
  17223. return NullPresenceChannel;
  17224. }(NullChannel);
  17225. /**
  17226. * This class creates a connector to Pusher.
  17227. */
  17228. var PusherConnector = function (_Connector) {
  17229. inherits(PusherConnector, _Connector);
  17230. function PusherConnector() {
  17231. classCallCheck(this, PusherConnector);
  17232. /**
  17233. * All of the subscribed channel names.
  17234. */
  17235. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17236. _this.channels = {};
  17237. return _this;
  17238. }
  17239. /**
  17240. * Create a fresh Pusher connection.
  17241. */
  17242. createClass(PusherConnector, [{
  17243. key: 'connect',
  17244. value: function connect() {
  17245. if (typeof this.options.client !== 'undefined') {
  17246. this.pusher = this.options.client;
  17247. } else {
  17248. this.pusher = new Pusher(this.options.key, this.options);
  17249. }
  17250. }
  17251. /**
  17252. * Listen for an event on a channel instance.
  17253. */
  17254. }, {
  17255. key: 'listen',
  17256. value: function listen(name, event, callback) {
  17257. return this.channel(name).listen(event, callback);
  17258. }
  17259. /**
  17260. * Get a channel instance by name.
  17261. */
  17262. }, {
  17263. key: 'channel',
  17264. value: function channel(name) {
  17265. if (!this.channels[name]) {
  17266. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17267. }
  17268. return this.channels[name];
  17269. }
  17270. /**
  17271. * Get a private channel instance by name.
  17272. */
  17273. }, {
  17274. key: 'privateChannel',
  17275. value: function privateChannel(name) {
  17276. if (!this.channels['private-' + name]) {
  17277. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17278. }
  17279. return this.channels['private-' + name];
  17280. }
  17281. /**
  17282. * Get a presence channel instance by name.
  17283. */
  17284. }, {
  17285. key: 'presenceChannel',
  17286. value: function presenceChannel(name) {
  17287. if (!this.channels['presence-' + name]) {
  17288. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17289. }
  17290. return this.channels['presence-' + name];
  17291. }
  17292. /**
  17293. * Leave the given channel, as well as its private and presence variants.
  17294. */
  17295. }, {
  17296. key: 'leave',
  17297. value: function leave(name) {
  17298. var _this2 = this;
  17299. var channels = [name, 'private-' + name, 'presence-' + name];
  17300. channels.forEach(function (name, index) {
  17301. _this2.leaveChannel(name);
  17302. });
  17303. }
  17304. /**
  17305. * Leave the given channel.
  17306. */
  17307. }, {
  17308. key: 'leaveChannel',
  17309. value: function leaveChannel(name) {
  17310. if (this.channels[name]) {
  17311. this.channels[name].unsubscribe();
  17312. delete this.channels[name];
  17313. }
  17314. }
  17315. /**
  17316. * Get the socket ID for the connection.
  17317. */
  17318. }, {
  17319. key: 'socketId',
  17320. value: function socketId() {
  17321. return this.pusher.connection.socket_id;
  17322. }
  17323. /**
  17324. * Disconnect Pusher connection.
  17325. */
  17326. }, {
  17327. key: 'disconnect',
  17328. value: function disconnect() {
  17329. this.pusher.disconnect();
  17330. }
  17331. }]);
  17332. return PusherConnector;
  17333. }(Connector);
  17334. /**
  17335. * This class creates a connnector to a Socket.io server.
  17336. */
  17337. var SocketIoConnector = function (_Connector) {
  17338. inherits(SocketIoConnector, _Connector);
  17339. function SocketIoConnector() {
  17340. classCallCheck(this, SocketIoConnector);
  17341. /**
  17342. * All of the subscribed channel names.
  17343. */
  17344. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17345. _this.channels = {};
  17346. return _this;
  17347. }
  17348. /**
  17349. * Create a fresh Socket.io connection.
  17350. */
  17351. createClass(SocketIoConnector, [{
  17352. key: 'connect',
  17353. value: function connect() {
  17354. var io = this.getSocketIO();
  17355. this.socket = io(this.options.host, this.options);
  17356. return this.socket;
  17357. }
  17358. /**
  17359. * Get socket.io module from global scope or options.
  17360. */
  17361. }, {
  17362. key: 'getSocketIO',
  17363. value: function getSocketIO() {
  17364. if (typeof this.options.client !== 'undefined') {
  17365. return this.options.client;
  17366. }
  17367. if (typeof io !== 'undefined') {
  17368. return io;
  17369. }
  17370. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17371. }
  17372. /**
  17373. * Listen for an event on a channel instance.
  17374. */
  17375. }, {
  17376. key: 'listen',
  17377. value: function listen(name, event, callback) {
  17378. return this.channel(name).listen(event, callback);
  17379. }
  17380. /**
  17381. * Get a channel instance by name.
  17382. */
  17383. }, {
  17384. key: 'channel',
  17385. value: function channel(name) {
  17386. if (!this.channels[name]) {
  17387. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17388. }
  17389. return this.channels[name];
  17390. }
  17391. /**
  17392. * Get a private channel instance by name.
  17393. */
  17394. }, {
  17395. key: 'privateChannel',
  17396. value: function privateChannel(name) {
  17397. if (!this.channels['private-' + name]) {
  17398. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17399. }
  17400. return this.channels['private-' + name];
  17401. }
  17402. /**
  17403. * Get a presence channel instance by name.
  17404. */
  17405. }, {
  17406. key: 'presenceChannel',
  17407. value: function presenceChannel(name) {
  17408. if (!this.channels['presence-' + name]) {
  17409. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17410. }
  17411. return this.channels['presence-' + name];
  17412. }
  17413. /**
  17414. * Leave the given channel, as well as its private and presence variants.
  17415. */
  17416. }, {
  17417. key: 'leave',
  17418. value: function leave(name) {
  17419. var _this2 = this;
  17420. var channels = [name, 'private-' + name, 'presence-' + name];
  17421. channels.forEach(function (name) {
  17422. _this2.leaveChannel(name);
  17423. });
  17424. }
  17425. /**
  17426. * Leave the given channel.
  17427. */
  17428. }, {
  17429. key: 'leaveChannel',
  17430. value: function leaveChannel(name) {
  17431. if (this.channels[name]) {
  17432. this.channels[name].unsubscribe();
  17433. delete this.channels[name];
  17434. }
  17435. }
  17436. /**
  17437. * Get the socket ID for the connection.
  17438. */
  17439. }, {
  17440. key: 'socketId',
  17441. value: function socketId() {
  17442. return this.socket.id;
  17443. }
  17444. /**
  17445. * Disconnect Socketio connection.
  17446. */
  17447. }, {
  17448. key: 'disconnect',
  17449. value: function disconnect() {
  17450. this.socket.disconnect();
  17451. }
  17452. }]);
  17453. return SocketIoConnector;
  17454. }(Connector);
  17455. /**
  17456. * This class creates a null connector.
  17457. */
  17458. var NullConnector = function (_Connector) {
  17459. inherits(NullConnector, _Connector);
  17460. function NullConnector() {
  17461. classCallCheck(this, NullConnector);
  17462. /**
  17463. * All of the subscribed channel names.
  17464. */
  17465. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17466. _this.channels = {};
  17467. return _this;
  17468. }
  17469. /**
  17470. * Create a fresh connection.
  17471. */
  17472. createClass(NullConnector, [{
  17473. key: 'connect',
  17474. value: function connect() {}
  17475. //
  17476. /**
  17477. * Listen for an event on a channel instance.
  17478. */
  17479. }, {
  17480. key: 'listen',
  17481. value: function listen(name, event, callback) {
  17482. return new NullChannel();
  17483. }
  17484. /**
  17485. * Get a channel instance by name.
  17486. */
  17487. }, {
  17488. key: 'channel',
  17489. value: function channel(name) {
  17490. return new NullChannel();
  17491. }
  17492. /**
  17493. * Get a private channel instance by name.
  17494. */
  17495. }, {
  17496. key: 'privateChannel',
  17497. value: function privateChannel(name) {
  17498. return new NullPrivateChannel();
  17499. }
  17500. /**
  17501. * Get a presence channel instance by name.
  17502. */
  17503. }, {
  17504. key: 'presenceChannel',
  17505. value: function presenceChannel(name) {
  17506. return new NullPresenceChannel();
  17507. }
  17508. /**
  17509. * Leave the given channel, as well as its private and presence variants.
  17510. */
  17511. }, {
  17512. key: 'leave',
  17513. value: function leave(name) {}
  17514. //
  17515. /**
  17516. * Leave the given channel.
  17517. */
  17518. }, {
  17519. key: 'leaveChannel',
  17520. value: function leaveChannel(name) {}
  17521. //
  17522. /**
  17523. * Get the socket ID for the connection.
  17524. */
  17525. }, {
  17526. key: 'socketId',
  17527. value: function socketId() {
  17528. return 'fake-socket-id';
  17529. }
  17530. /**
  17531. * Disconnect the connection.
  17532. */
  17533. }, {
  17534. key: 'disconnect',
  17535. value: function disconnect() {
  17536. //
  17537. }
  17538. }]);
  17539. return NullConnector;
  17540. }(Connector);
  17541. /**
  17542. * This class is the primary API for interacting with broadcasting.
  17543. */
  17544. var Echo = function () {
  17545. /**
  17546. * Create a new class instance.
  17547. */
  17548. function Echo(options) {
  17549. classCallCheck(this, Echo);
  17550. this.options = options;
  17551. this.connect();
  17552. if (!this.options.withoutInterceptors) {
  17553. this.registerInterceptors();
  17554. }
  17555. }
  17556. /**
  17557. * Get a channel instance by name.
  17558. */
  17559. createClass(Echo, [{
  17560. key: 'channel',
  17561. value: function channel(_channel) {
  17562. return this.connector.channel(_channel);
  17563. }
  17564. /**
  17565. * Create a new connection.
  17566. */
  17567. }, {
  17568. key: 'connect',
  17569. value: function connect() {
  17570. if (this.options.broadcaster == 'pusher') {
  17571. this.connector = new PusherConnector(this.options);
  17572. } else if (this.options.broadcaster == 'socket.io') {
  17573. this.connector = new SocketIoConnector(this.options);
  17574. } else if (this.options.broadcaster == 'null') {
  17575. this.connector = new NullConnector(this.options);
  17576. } else if (typeof this.options.broadcaster == 'function') {
  17577. this.connector = new this.options.broadcaster(this.options);
  17578. }
  17579. }
  17580. /**
  17581. * Disconnect from the Echo server.
  17582. */
  17583. }, {
  17584. key: 'disconnect',
  17585. value: function disconnect() {
  17586. this.connector.disconnect();
  17587. }
  17588. /**
  17589. * Get a presence channel instance by name.
  17590. */
  17591. }, {
  17592. key: 'join',
  17593. value: function join(channel) {
  17594. return this.connector.presenceChannel(channel);
  17595. }
  17596. /**
  17597. * Leave the given channel, as well as its private and presence variants.
  17598. */
  17599. }, {
  17600. key: 'leave',
  17601. value: function leave(channel) {
  17602. this.connector.leave(channel);
  17603. }
  17604. /**
  17605. * Leave the given channel.
  17606. */
  17607. }, {
  17608. key: 'leaveChannel',
  17609. value: function leaveChannel(channel) {
  17610. this.connector.leaveChannel(channel);
  17611. }
  17612. /**
  17613. * Listen for an event on a channel instance.
  17614. */
  17615. }, {
  17616. key: 'listen',
  17617. value: function listen(channel, event, callback) {
  17618. return this.connector.listen(channel, event, callback);
  17619. }
  17620. /**
  17621. * Get a private channel instance by name.
  17622. */
  17623. }, {
  17624. key: 'private',
  17625. value: function _private(channel) {
  17626. return this.connector.privateChannel(channel);
  17627. }
  17628. /**
  17629. * Get the Socket ID for the connection.
  17630. */
  17631. }, {
  17632. key: 'socketId',
  17633. value: function socketId() {
  17634. return this.connector.socketId();
  17635. }
  17636. /**
  17637. * Register 3rd party request interceptiors. These are used to automatically
  17638. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17639. */
  17640. }, {
  17641. key: 'registerInterceptors',
  17642. value: function registerInterceptors() {
  17643. if (typeof Vue === 'function' && Vue.http) {
  17644. this.registerVueRequestInterceptor();
  17645. }
  17646. if (typeof axios === 'function') {
  17647. this.registerAxiosRequestInterceptor();
  17648. }
  17649. if (typeof jQuery === 'function') {
  17650. this.registerjQueryAjaxSetup();
  17651. }
  17652. }
  17653. /**
  17654. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17655. */
  17656. }, {
  17657. key: 'registerVueRequestInterceptor',
  17658. value: function registerVueRequestInterceptor() {
  17659. var _this = this;
  17660. Vue.http.interceptors.push(function (request, next) {
  17661. if (_this.socketId()) {
  17662. request.headers.set('X-Socket-ID', _this.socketId());
  17663. }
  17664. next();
  17665. });
  17666. }
  17667. /**
  17668. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17669. */
  17670. }, {
  17671. key: 'registerAxiosRequestInterceptor',
  17672. value: function registerAxiosRequestInterceptor() {
  17673. var _this2 = this;
  17674. axios.interceptors.request.use(function (config) {
  17675. if (_this2.socketId()) {
  17676. config.headers['X-Socket-Id'] = _this2.socketId();
  17677. }
  17678. return config;
  17679. });
  17680. }
  17681. /**
  17682. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17683. */
  17684. }, {
  17685. key: 'registerjQueryAjaxSetup',
  17686. value: function registerjQueryAjaxSetup() {
  17687. var _this3 = this;
  17688. if (typeof jQuery.ajax != 'undefined') {
  17689. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17690. if (_this3.socketId()) {
  17691. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17692. }
  17693. });
  17694. }
  17695. }
  17696. }]);
  17697. return Echo;
  17698. }();
  17699. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17700. /***/ }),
  17701. /***/ "./node_modules/lodash/lodash.js":
  17702. /*!***************************************!*\
  17703. !*** ./node_modules/lodash/lodash.js ***!
  17704. \***************************************/
  17705. /*! no static exports found */
  17706. /***/ (function(module, exports, __webpack_require__) {
  17707. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  17708. * @license
  17709. * Lodash <https://lodash.com/>
  17710. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  17711. * Released under MIT license <https://lodash.com/license>
  17712. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  17713. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  17714. */
  17715. ;(function() {
  17716. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  17717. var undefined;
  17718. /** Used as the semantic version number. */
  17719. var VERSION = '4.17.15';
  17720. /** Used as the size to enable large array optimizations. */
  17721. var LARGE_ARRAY_SIZE = 200;
  17722. /** Error message constants. */
  17723. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  17724. FUNC_ERROR_TEXT = 'Expected a function';
  17725. /** Used to stand-in for `undefined` hash values. */
  17726. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  17727. /** Used as the maximum memoize cache size. */
  17728. var MAX_MEMOIZE_SIZE = 500;
  17729. /** Used as the internal argument placeholder. */
  17730. var PLACEHOLDER = '__lodash_placeholder__';
  17731. /** Used to compose bitmasks for cloning. */
  17732. var CLONE_DEEP_FLAG = 1,
  17733. CLONE_FLAT_FLAG = 2,
  17734. CLONE_SYMBOLS_FLAG = 4;
  17735. /** Used to compose bitmasks for value comparisons. */
  17736. var COMPARE_PARTIAL_FLAG = 1,
  17737. COMPARE_UNORDERED_FLAG = 2;
  17738. /** Used to compose bitmasks for function metadata. */
  17739. var WRAP_BIND_FLAG = 1,
  17740. WRAP_BIND_KEY_FLAG = 2,
  17741. WRAP_CURRY_BOUND_FLAG = 4,
  17742. WRAP_CURRY_FLAG = 8,
  17743. WRAP_CURRY_RIGHT_FLAG = 16,
  17744. WRAP_PARTIAL_FLAG = 32,
  17745. WRAP_PARTIAL_RIGHT_FLAG = 64,
  17746. WRAP_ARY_FLAG = 128,
  17747. WRAP_REARG_FLAG = 256,
  17748. WRAP_FLIP_FLAG = 512;
  17749. /** Used as default options for `_.truncate`. */
  17750. var DEFAULT_TRUNC_LENGTH = 30,
  17751. DEFAULT_TRUNC_OMISSION = '...';
  17752. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  17753. var HOT_COUNT = 800,
  17754. HOT_SPAN = 16;
  17755. /** Used to indicate the type of lazy iteratees. */
  17756. var LAZY_FILTER_FLAG = 1,
  17757. LAZY_MAP_FLAG = 2,
  17758. LAZY_WHILE_FLAG = 3;
  17759. /** Used as references for various `Number` constants. */
  17760. var INFINITY = 1 / 0,
  17761. MAX_SAFE_INTEGER = 9007199254740991,
  17762. MAX_INTEGER = 1.7976931348623157e+308,
  17763. NAN = 0 / 0;
  17764. /** Used as references for the maximum length and index of an array. */
  17765. var MAX_ARRAY_LENGTH = 4294967295,
  17766. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  17767. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  17768. /** Used to associate wrap methods with their bit flags. */
  17769. var wrapFlags = [
  17770. ['ary', WRAP_ARY_FLAG],
  17771. ['bind', WRAP_BIND_FLAG],
  17772. ['bindKey', WRAP_BIND_KEY_FLAG],
  17773. ['curry', WRAP_CURRY_FLAG],
  17774. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  17775. ['flip', WRAP_FLIP_FLAG],
  17776. ['partial', WRAP_PARTIAL_FLAG],
  17777. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  17778. ['rearg', WRAP_REARG_FLAG]
  17779. ];
  17780. /** `Object#toString` result references. */
  17781. var argsTag = '[object Arguments]',
  17782. arrayTag = '[object Array]',
  17783. asyncTag = '[object AsyncFunction]',
  17784. boolTag = '[object Boolean]',
  17785. dateTag = '[object Date]',
  17786. domExcTag = '[object DOMException]',
  17787. errorTag = '[object Error]',
  17788. funcTag = '[object Function]',
  17789. genTag = '[object GeneratorFunction]',
  17790. mapTag = '[object Map]',
  17791. numberTag = '[object Number]',
  17792. nullTag = '[object Null]',
  17793. objectTag = '[object Object]',
  17794. promiseTag = '[object Promise]',
  17795. proxyTag = '[object Proxy]',
  17796. regexpTag = '[object RegExp]',
  17797. setTag = '[object Set]',
  17798. stringTag = '[object String]',
  17799. symbolTag = '[object Symbol]',
  17800. undefinedTag = '[object Undefined]',
  17801. weakMapTag = '[object WeakMap]',
  17802. weakSetTag = '[object WeakSet]';
  17803. var arrayBufferTag = '[object ArrayBuffer]',
  17804. dataViewTag = '[object DataView]',
  17805. float32Tag = '[object Float32Array]',
  17806. float64Tag = '[object Float64Array]',
  17807. int8Tag = '[object Int8Array]',
  17808. int16Tag = '[object Int16Array]',
  17809. int32Tag = '[object Int32Array]',
  17810. uint8Tag = '[object Uint8Array]',
  17811. uint8ClampedTag = '[object Uint8ClampedArray]',
  17812. uint16Tag = '[object Uint16Array]',
  17813. uint32Tag = '[object Uint32Array]';
  17814. /** Used to match empty string literals in compiled template source. */
  17815. var reEmptyStringLeading = /\b__p \+= '';/g,
  17816. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  17817. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  17818. /** Used to match HTML entities and HTML characters. */
  17819. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  17820. reUnescapedHtml = /[&<>"']/g,
  17821. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  17822. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  17823. /** Used to match template delimiters. */
  17824. var reEscape = /<%-([\s\S]+?)%>/g,
  17825. reEvaluate = /<%([\s\S]+?)%>/g,
  17826. reInterpolate = /<%=([\s\S]+?)%>/g;
  17827. /** Used to match property names within property paths. */
  17828. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  17829. reIsPlainProp = /^\w*$/,
  17830. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  17831. /**
  17832. * Used to match `RegExp`
  17833. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  17834. */
  17835. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  17836. reHasRegExpChar = RegExp(reRegExpChar.source);
  17837. /** Used to match leading and trailing whitespace. */
  17838. var reTrim = /^\s+|\s+$/g,
  17839. reTrimStart = /^\s+/,
  17840. reTrimEnd = /\s+$/;
  17841. /** Used to match wrap detail comments. */
  17842. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  17843. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  17844. reSplitDetails = /,? & /;
  17845. /** Used to match words composed of alphanumeric characters. */
  17846. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  17847. /** Used to match backslashes in property paths. */
  17848. var reEscapeChar = /\\(\\)?/g;
  17849. /**
  17850. * Used to match
  17851. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  17852. */
  17853. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  17854. /** Used to match `RegExp` flags from their coerced string values. */
  17855. var reFlags = /\w*$/;
  17856. /** Used to detect bad signed hexadecimal string values. */
  17857. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  17858. /** Used to detect binary string values. */
  17859. var reIsBinary = /^0b[01]+$/i;
  17860. /** Used to detect host constructors (Safari). */
  17861. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  17862. /** Used to detect octal string values. */
  17863. var reIsOctal = /^0o[0-7]+$/i;
  17864. /** Used to detect unsigned integer values. */
  17865. var reIsUint = /^(?:0|[1-9]\d*)$/;
  17866. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  17867. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  17868. /** Used to ensure capturing order of template delimiters. */
  17869. var reNoMatch = /($^)/;
  17870. /** Used to match unescaped characters in compiled string literals. */
  17871. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  17872. /** Used to compose unicode character classes. */
  17873. var rsAstralRange = '\\ud800-\\udfff',
  17874. rsComboMarksRange = '\\u0300-\\u036f',
  17875. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  17876. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  17877. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  17878. rsDingbatRange = '\\u2700-\\u27bf',
  17879. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  17880. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  17881. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  17882. rsPunctuationRange = '\\u2000-\\u206f',
  17883. 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',
  17884. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  17885. rsVarRange = '\\ufe0e\\ufe0f',
  17886. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  17887. /** Used to compose unicode capture groups. */
  17888. var rsApos = "['\u2019]",
  17889. rsAstral = '[' + rsAstralRange + ']',
  17890. rsBreak = '[' + rsBreakRange + ']',
  17891. rsCombo = '[' + rsComboRange + ']',
  17892. rsDigits = '\\d+',
  17893. rsDingbat = '[' + rsDingbatRange + ']',
  17894. rsLower = '[' + rsLowerRange + ']',
  17895. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  17896. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  17897. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  17898. rsNonAstral = '[^' + rsAstralRange + ']',
  17899. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  17900. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  17901. rsUpper = '[' + rsUpperRange + ']',
  17902. rsZWJ = '\\u200d';
  17903. /** Used to compose unicode regexes. */
  17904. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  17905. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  17906. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  17907. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  17908. reOptMod = rsModifier + '?',
  17909. rsOptVar = '[' + rsVarRange + ']?',
  17910. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  17911. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  17912. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  17913. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  17914. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  17915. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  17916. /** Used to match apostrophes. */
  17917. var reApos = RegExp(rsApos, 'g');
  17918. /**
  17919. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  17920. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  17921. */
  17922. var reComboMark = RegExp(rsCombo, 'g');
  17923. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  17924. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  17925. /** Used to match complex or compound words. */
  17926. var reUnicodeWord = RegExp([
  17927. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  17928. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  17929. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  17930. rsUpper + '+' + rsOptContrUpper,
  17931. rsOrdUpper,
  17932. rsOrdLower,
  17933. rsDigits,
  17934. rsEmoji
  17935. ].join('|'), 'g');
  17936. /** 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/). */
  17937. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  17938. /** Used to detect strings that need a more robust regexp to match words. */
  17939. 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 ]/;
  17940. /** Used to assign default `context` object properties. */
  17941. var contextProps = [
  17942. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  17943. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  17944. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  17945. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  17946. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  17947. ];
  17948. /** Used to make template sourceURLs easier to identify. */
  17949. var templateCounter = -1;
  17950. /** Used to identify `toStringTag` values of typed arrays. */
  17951. var typedArrayTags = {};
  17952. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  17953. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  17954. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  17955. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  17956. typedArrayTags[uint32Tag] = true;
  17957. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  17958. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  17959. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  17960. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  17961. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  17962. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  17963. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  17964. typedArrayTags[weakMapTag] = false;
  17965. /** Used to identify `toStringTag` values supported by `_.clone`. */
  17966. var cloneableTags = {};
  17967. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  17968. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  17969. cloneableTags[boolTag] = cloneableTags[dateTag] =
  17970. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  17971. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  17972. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  17973. cloneableTags[numberTag] = cloneableTags[objectTag] =
  17974. cloneableTags[regexpTag] = cloneableTags[setTag] =
  17975. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  17976. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  17977. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  17978. cloneableTags[errorTag] = cloneableTags[funcTag] =
  17979. cloneableTags[weakMapTag] = false;
  17980. /** Used to map Latin Unicode letters to basic Latin letters. */
  17981. var deburredLetters = {
  17982. // Latin-1 Supplement block.
  17983. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  17984. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  17985. '\xc7': 'C', '\xe7': 'c',
  17986. '\xd0': 'D', '\xf0': 'd',
  17987. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  17988. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  17989. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  17990. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  17991. '\xd1': 'N', '\xf1': 'n',
  17992. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  17993. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  17994. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  17995. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  17996. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  17997. '\xc6': 'Ae', '\xe6': 'ae',
  17998. '\xde': 'Th', '\xfe': 'th',
  17999. '\xdf': 'ss',
  18000. // Latin Extended-A block.
  18001. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18002. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18003. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18004. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18005. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18006. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18007. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18008. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18009. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18010. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18011. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18012. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18013. '\u0134': 'J', '\u0135': 'j',
  18014. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18015. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18016. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18017. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18018. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18019. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18020. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18021. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18022. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18023. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18024. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18025. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18026. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18027. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18028. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18029. '\u0174': 'W', '\u0175': 'w',
  18030. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18031. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18032. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18033. '\u0132': 'IJ', '\u0133': 'ij',
  18034. '\u0152': 'Oe', '\u0153': 'oe',
  18035. '\u0149': "'n", '\u017f': 's'
  18036. };
  18037. /** Used to map characters to HTML entities. */
  18038. var htmlEscapes = {
  18039. '&': '&amp;',
  18040. '<': '&lt;',
  18041. '>': '&gt;',
  18042. '"': '&quot;',
  18043. "'": '&#39;'
  18044. };
  18045. /** Used to map HTML entities to characters. */
  18046. var htmlUnescapes = {
  18047. '&amp;': '&',
  18048. '&lt;': '<',
  18049. '&gt;': '>',
  18050. '&quot;': '"',
  18051. '&#39;': "'"
  18052. };
  18053. /** Used to escape characters for inclusion in compiled string literals. */
  18054. var stringEscapes = {
  18055. '\\': '\\',
  18056. "'": "'",
  18057. '\n': 'n',
  18058. '\r': 'r',
  18059. '\u2028': 'u2028',
  18060. '\u2029': 'u2029'
  18061. };
  18062. /** Built-in method references without a dependency on `root`. */
  18063. var freeParseFloat = parseFloat,
  18064. freeParseInt = parseInt;
  18065. /** Detect free variable `global` from Node.js. */
  18066. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18067. /** Detect free variable `self`. */
  18068. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18069. /** Used as a reference to the global object. */
  18070. var root = freeGlobal || freeSelf || Function('return this')();
  18071. /** Detect free variable `exports`. */
  18072. var freeExports = true && exports && !exports.nodeType && exports;
  18073. /** Detect free variable `module`. */
  18074. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18075. /** Detect the popular CommonJS extension `module.exports`. */
  18076. var moduleExports = freeModule && freeModule.exports === freeExports;
  18077. /** Detect free variable `process` from Node.js. */
  18078. var freeProcess = moduleExports && freeGlobal.process;
  18079. /** Used to access faster Node.js helpers. */
  18080. var nodeUtil = (function() {
  18081. try {
  18082. // Use `util.types` for Node.js 10+.
  18083. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18084. if (types) {
  18085. return types;
  18086. }
  18087. // Legacy `process.binding('util')` for Node.js < 10.
  18088. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18089. } catch (e) {}
  18090. }());
  18091. /* Node.js helper references. */
  18092. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18093. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18094. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18095. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18096. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18097. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18098. /*--------------------------------------------------------------------------*/
  18099. /**
  18100. * A faster alternative to `Function#apply`, this function invokes `func`
  18101. * with the `this` binding of `thisArg` and the arguments of `args`.
  18102. *
  18103. * @private
  18104. * @param {Function} func The function to invoke.
  18105. * @param {*} thisArg The `this` binding of `func`.
  18106. * @param {Array} args The arguments to invoke `func` with.
  18107. * @returns {*} Returns the result of `func`.
  18108. */
  18109. function apply(func, thisArg, args) {
  18110. switch (args.length) {
  18111. case 0: return func.call(thisArg);
  18112. case 1: return func.call(thisArg, args[0]);
  18113. case 2: return func.call(thisArg, args[0], args[1]);
  18114. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18115. }
  18116. return func.apply(thisArg, args);
  18117. }
  18118. /**
  18119. * A specialized version of `baseAggregator` for arrays.
  18120. *
  18121. * @private
  18122. * @param {Array} [array] The array to iterate over.
  18123. * @param {Function} setter The function to set `accumulator` values.
  18124. * @param {Function} iteratee The iteratee to transform keys.
  18125. * @param {Object} accumulator The initial aggregated object.
  18126. * @returns {Function} Returns `accumulator`.
  18127. */
  18128. function arrayAggregator(array, setter, iteratee, accumulator) {
  18129. var index = -1,
  18130. length = array == null ? 0 : array.length;
  18131. while (++index < length) {
  18132. var value = array[index];
  18133. setter(accumulator, value, iteratee(value), array);
  18134. }
  18135. return accumulator;
  18136. }
  18137. /**
  18138. * A specialized version of `_.forEach` for arrays without support for
  18139. * iteratee shorthands.
  18140. *
  18141. * @private
  18142. * @param {Array} [array] The array to iterate over.
  18143. * @param {Function} iteratee The function invoked per iteration.
  18144. * @returns {Array} Returns `array`.
  18145. */
  18146. function arrayEach(array, iteratee) {
  18147. var index = -1,
  18148. length = array == null ? 0 : array.length;
  18149. while (++index < length) {
  18150. if (iteratee(array[index], index, array) === false) {
  18151. break;
  18152. }
  18153. }
  18154. return array;
  18155. }
  18156. /**
  18157. * A specialized version of `_.forEachRight` for arrays without support for
  18158. * iteratee shorthands.
  18159. *
  18160. * @private
  18161. * @param {Array} [array] The array to iterate over.
  18162. * @param {Function} iteratee The function invoked per iteration.
  18163. * @returns {Array} Returns `array`.
  18164. */
  18165. function arrayEachRight(array, iteratee) {
  18166. var length = array == null ? 0 : array.length;
  18167. while (length--) {
  18168. if (iteratee(array[length], length, array) === false) {
  18169. break;
  18170. }
  18171. }
  18172. return array;
  18173. }
  18174. /**
  18175. * A specialized version of `_.every` for arrays without support for
  18176. * iteratee shorthands.
  18177. *
  18178. * @private
  18179. * @param {Array} [array] The array to iterate over.
  18180. * @param {Function} predicate The function invoked per iteration.
  18181. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18182. * else `false`.
  18183. */
  18184. function arrayEvery(array, predicate) {
  18185. var index = -1,
  18186. length = array == null ? 0 : array.length;
  18187. while (++index < length) {
  18188. if (!predicate(array[index], index, array)) {
  18189. return false;
  18190. }
  18191. }
  18192. return true;
  18193. }
  18194. /**
  18195. * A specialized version of `_.filter` for arrays without support for
  18196. * iteratee shorthands.
  18197. *
  18198. * @private
  18199. * @param {Array} [array] The array to iterate over.
  18200. * @param {Function} predicate The function invoked per iteration.
  18201. * @returns {Array} Returns the new filtered array.
  18202. */
  18203. function arrayFilter(array, predicate) {
  18204. var index = -1,
  18205. length = array == null ? 0 : array.length,
  18206. resIndex = 0,
  18207. result = [];
  18208. while (++index < length) {
  18209. var value = array[index];
  18210. if (predicate(value, index, array)) {
  18211. result[resIndex++] = value;
  18212. }
  18213. }
  18214. return result;
  18215. }
  18216. /**
  18217. * A specialized version of `_.includes` for arrays without support for
  18218. * specifying an index to search from.
  18219. *
  18220. * @private
  18221. * @param {Array} [array] The array to inspect.
  18222. * @param {*} target The value to search for.
  18223. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18224. */
  18225. function arrayIncludes(array, value) {
  18226. var length = array == null ? 0 : array.length;
  18227. return !!length && baseIndexOf(array, value, 0) > -1;
  18228. }
  18229. /**
  18230. * This function is like `arrayIncludes` except that it accepts a comparator.
  18231. *
  18232. * @private
  18233. * @param {Array} [array] The array to inspect.
  18234. * @param {*} target The value to search for.
  18235. * @param {Function} comparator The comparator invoked per element.
  18236. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18237. */
  18238. function arrayIncludesWith(array, value, comparator) {
  18239. var index = -1,
  18240. length = array == null ? 0 : array.length;
  18241. while (++index < length) {
  18242. if (comparator(value, array[index])) {
  18243. return true;
  18244. }
  18245. }
  18246. return false;
  18247. }
  18248. /**
  18249. * A specialized version of `_.map` for arrays without support for iteratee
  18250. * shorthands.
  18251. *
  18252. * @private
  18253. * @param {Array} [array] The array to iterate over.
  18254. * @param {Function} iteratee The function invoked per iteration.
  18255. * @returns {Array} Returns the new mapped array.
  18256. */
  18257. function arrayMap(array, iteratee) {
  18258. var index = -1,
  18259. length = array == null ? 0 : array.length,
  18260. result = Array(length);
  18261. while (++index < length) {
  18262. result[index] = iteratee(array[index], index, array);
  18263. }
  18264. return result;
  18265. }
  18266. /**
  18267. * Appends the elements of `values` to `array`.
  18268. *
  18269. * @private
  18270. * @param {Array} array The array to modify.
  18271. * @param {Array} values The values to append.
  18272. * @returns {Array} Returns `array`.
  18273. */
  18274. function arrayPush(array, values) {
  18275. var index = -1,
  18276. length = values.length,
  18277. offset = array.length;
  18278. while (++index < length) {
  18279. array[offset + index] = values[index];
  18280. }
  18281. return array;
  18282. }
  18283. /**
  18284. * A specialized version of `_.reduce` for arrays without support for
  18285. * iteratee shorthands.
  18286. *
  18287. * @private
  18288. * @param {Array} [array] The array to iterate over.
  18289. * @param {Function} iteratee The function invoked per iteration.
  18290. * @param {*} [accumulator] The initial value.
  18291. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18292. * the initial value.
  18293. * @returns {*} Returns the accumulated value.
  18294. */
  18295. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18296. var index = -1,
  18297. length = array == null ? 0 : array.length;
  18298. if (initAccum && length) {
  18299. accumulator = array[++index];
  18300. }
  18301. while (++index < length) {
  18302. accumulator = iteratee(accumulator, array[index], index, array);
  18303. }
  18304. return accumulator;
  18305. }
  18306. /**
  18307. * A specialized version of `_.reduceRight` for arrays without support for
  18308. * iteratee shorthands.
  18309. *
  18310. * @private
  18311. * @param {Array} [array] The array to iterate over.
  18312. * @param {Function} iteratee The function invoked per iteration.
  18313. * @param {*} [accumulator] The initial value.
  18314. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18315. * the initial value.
  18316. * @returns {*} Returns the accumulated value.
  18317. */
  18318. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18319. var length = array == null ? 0 : array.length;
  18320. if (initAccum && length) {
  18321. accumulator = array[--length];
  18322. }
  18323. while (length--) {
  18324. accumulator = iteratee(accumulator, array[length], length, array);
  18325. }
  18326. return accumulator;
  18327. }
  18328. /**
  18329. * A specialized version of `_.some` for arrays without support for iteratee
  18330. * shorthands.
  18331. *
  18332. * @private
  18333. * @param {Array} [array] The array to iterate over.
  18334. * @param {Function} predicate The function invoked per iteration.
  18335. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18336. * else `false`.
  18337. */
  18338. function arraySome(array, predicate) {
  18339. var index = -1,
  18340. length = array == null ? 0 : array.length;
  18341. while (++index < length) {
  18342. if (predicate(array[index], index, array)) {
  18343. return true;
  18344. }
  18345. }
  18346. return false;
  18347. }
  18348. /**
  18349. * Gets the size of an ASCII `string`.
  18350. *
  18351. * @private
  18352. * @param {string} string The string inspect.
  18353. * @returns {number} Returns the string size.
  18354. */
  18355. var asciiSize = baseProperty('length');
  18356. /**
  18357. * Converts an ASCII `string` to an array.
  18358. *
  18359. * @private
  18360. * @param {string} string The string to convert.
  18361. * @returns {Array} Returns the converted array.
  18362. */
  18363. function asciiToArray(string) {
  18364. return string.split('');
  18365. }
  18366. /**
  18367. * Splits an ASCII `string` into an array of its words.
  18368. *
  18369. * @private
  18370. * @param {string} The string to inspect.
  18371. * @returns {Array} Returns the words of `string`.
  18372. */
  18373. function asciiWords(string) {
  18374. return string.match(reAsciiWord) || [];
  18375. }
  18376. /**
  18377. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18378. * without support for iteratee shorthands, which iterates over `collection`
  18379. * using `eachFunc`.
  18380. *
  18381. * @private
  18382. * @param {Array|Object} collection The collection to inspect.
  18383. * @param {Function} predicate The function invoked per iteration.
  18384. * @param {Function} eachFunc The function to iterate over `collection`.
  18385. * @returns {*} Returns the found element or its key, else `undefined`.
  18386. */
  18387. function baseFindKey(collection, predicate, eachFunc) {
  18388. var result;
  18389. eachFunc(collection, function(value, key, collection) {
  18390. if (predicate(value, key, collection)) {
  18391. result = key;
  18392. return false;
  18393. }
  18394. });
  18395. return result;
  18396. }
  18397. /**
  18398. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18399. * support for iteratee shorthands.
  18400. *
  18401. * @private
  18402. * @param {Array} array The array to inspect.
  18403. * @param {Function} predicate The function invoked per iteration.
  18404. * @param {number} fromIndex The index to search from.
  18405. * @param {boolean} [fromRight] Specify iterating from right to left.
  18406. * @returns {number} Returns the index of the matched value, else `-1`.
  18407. */
  18408. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18409. var length = array.length,
  18410. index = fromIndex + (fromRight ? 1 : -1);
  18411. while ((fromRight ? index-- : ++index < length)) {
  18412. if (predicate(array[index], index, array)) {
  18413. return index;
  18414. }
  18415. }
  18416. return -1;
  18417. }
  18418. /**
  18419. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18420. *
  18421. * @private
  18422. * @param {Array} array The array to inspect.
  18423. * @param {*} value The value to search for.
  18424. * @param {number} fromIndex The index to search from.
  18425. * @returns {number} Returns the index of the matched value, else `-1`.
  18426. */
  18427. function baseIndexOf(array, value, fromIndex) {
  18428. return value === value
  18429. ? strictIndexOf(array, value, fromIndex)
  18430. : baseFindIndex(array, baseIsNaN, fromIndex);
  18431. }
  18432. /**
  18433. * This function is like `baseIndexOf` except that it accepts a comparator.
  18434. *
  18435. * @private
  18436. * @param {Array} array The array to inspect.
  18437. * @param {*} value The value to search for.
  18438. * @param {number} fromIndex The index to search from.
  18439. * @param {Function} comparator The comparator invoked per element.
  18440. * @returns {number} Returns the index of the matched value, else `-1`.
  18441. */
  18442. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18443. var index = fromIndex - 1,
  18444. length = array.length;
  18445. while (++index < length) {
  18446. if (comparator(array[index], value)) {
  18447. return index;
  18448. }
  18449. }
  18450. return -1;
  18451. }
  18452. /**
  18453. * The base implementation of `_.isNaN` without support for number objects.
  18454. *
  18455. * @private
  18456. * @param {*} value The value to check.
  18457. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18458. */
  18459. function baseIsNaN(value) {
  18460. return value !== value;
  18461. }
  18462. /**
  18463. * The base implementation of `_.mean` and `_.meanBy` without support for
  18464. * iteratee shorthands.
  18465. *
  18466. * @private
  18467. * @param {Array} array The array to iterate over.
  18468. * @param {Function} iteratee The function invoked per iteration.
  18469. * @returns {number} Returns the mean.
  18470. */
  18471. function baseMean(array, iteratee) {
  18472. var length = array == null ? 0 : array.length;
  18473. return length ? (baseSum(array, iteratee) / length) : NAN;
  18474. }
  18475. /**
  18476. * The base implementation of `_.property` without support for deep paths.
  18477. *
  18478. * @private
  18479. * @param {string} key The key of the property to get.
  18480. * @returns {Function} Returns the new accessor function.
  18481. */
  18482. function baseProperty(key) {
  18483. return function(object) {
  18484. return object == null ? undefined : object[key];
  18485. };
  18486. }
  18487. /**
  18488. * The base implementation of `_.propertyOf` without support for deep paths.
  18489. *
  18490. * @private
  18491. * @param {Object} object The object to query.
  18492. * @returns {Function} Returns the new accessor function.
  18493. */
  18494. function basePropertyOf(object) {
  18495. return function(key) {
  18496. return object == null ? undefined : object[key];
  18497. };
  18498. }
  18499. /**
  18500. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18501. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18502. *
  18503. * @private
  18504. * @param {Array|Object} collection The collection to iterate over.
  18505. * @param {Function} iteratee The function invoked per iteration.
  18506. * @param {*} accumulator The initial value.
  18507. * @param {boolean} initAccum Specify using the first or last element of
  18508. * `collection` as the initial value.
  18509. * @param {Function} eachFunc The function to iterate over `collection`.
  18510. * @returns {*} Returns the accumulated value.
  18511. */
  18512. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18513. eachFunc(collection, function(value, index, collection) {
  18514. accumulator = initAccum
  18515. ? (initAccum = false, value)
  18516. : iteratee(accumulator, value, index, collection);
  18517. });
  18518. return accumulator;
  18519. }
  18520. /**
  18521. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18522. * sort order of `array` and replaces criteria objects with their corresponding
  18523. * values.
  18524. *
  18525. * @private
  18526. * @param {Array} array The array to sort.
  18527. * @param {Function} comparer The function to define sort order.
  18528. * @returns {Array} Returns `array`.
  18529. */
  18530. function baseSortBy(array, comparer) {
  18531. var length = array.length;
  18532. array.sort(comparer);
  18533. while (length--) {
  18534. array[length] = array[length].value;
  18535. }
  18536. return array;
  18537. }
  18538. /**
  18539. * The base implementation of `_.sum` and `_.sumBy` without support for
  18540. * iteratee shorthands.
  18541. *
  18542. * @private
  18543. * @param {Array} array The array to iterate over.
  18544. * @param {Function} iteratee The function invoked per iteration.
  18545. * @returns {number} Returns the sum.
  18546. */
  18547. function baseSum(array, iteratee) {
  18548. var result,
  18549. index = -1,
  18550. length = array.length;
  18551. while (++index < length) {
  18552. var current = iteratee(array[index]);
  18553. if (current !== undefined) {
  18554. result = result === undefined ? current : (result + current);
  18555. }
  18556. }
  18557. return result;
  18558. }
  18559. /**
  18560. * The base implementation of `_.times` without support for iteratee shorthands
  18561. * or max array length checks.
  18562. *
  18563. * @private
  18564. * @param {number} n The number of times to invoke `iteratee`.
  18565. * @param {Function} iteratee The function invoked per iteration.
  18566. * @returns {Array} Returns the array of results.
  18567. */
  18568. function baseTimes(n, iteratee) {
  18569. var index = -1,
  18570. result = Array(n);
  18571. while (++index < n) {
  18572. result[index] = iteratee(index);
  18573. }
  18574. return result;
  18575. }
  18576. /**
  18577. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18578. * of key-value pairs for `object` corresponding to the property names of `props`.
  18579. *
  18580. * @private
  18581. * @param {Object} object The object to query.
  18582. * @param {Array} props The property names to get values for.
  18583. * @returns {Object} Returns the key-value pairs.
  18584. */
  18585. function baseToPairs(object, props) {
  18586. return arrayMap(props, function(key) {
  18587. return [key, object[key]];
  18588. });
  18589. }
  18590. /**
  18591. * The base implementation of `_.unary` without support for storing metadata.
  18592. *
  18593. * @private
  18594. * @param {Function} func The function to cap arguments for.
  18595. * @returns {Function} Returns the new capped function.
  18596. */
  18597. function baseUnary(func) {
  18598. return function(value) {
  18599. return func(value);
  18600. };
  18601. }
  18602. /**
  18603. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18604. * array of `object` property values corresponding to the property names
  18605. * of `props`.
  18606. *
  18607. * @private
  18608. * @param {Object} object The object to query.
  18609. * @param {Array} props The property names to get values for.
  18610. * @returns {Object} Returns the array of property values.
  18611. */
  18612. function baseValues(object, props) {
  18613. return arrayMap(props, function(key) {
  18614. return object[key];
  18615. });
  18616. }
  18617. /**
  18618. * Checks if a `cache` value for `key` exists.
  18619. *
  18620. * @private
  18621. * @param {Object} cache The cache to query.
  18622. * @param {string} key The key of the entry to check.
  18623. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18624. */
  18625. function cacheHas(cache, key) {
  18626. return cache.has(key);
  18627. }
  18628. /**
  18629. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18630. * that is not found in the character symbols.
  18631. *
  18632. * @private
  18633. * @param {Array} strSymbols The string symbols to inspect.
  18634. * @param {Array} chrSymbols The character symbols to find.
  18635. * @returns {number} Returns the index of the first unmatched string symbol.
  18636. */
  18637. function charsStartIndex(strSymbols, chrSymbols) {
  18638. var index = -1,
  18639. length = strSymbols.length;
  18640. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18641. return index;
  18642. }
  18643. /**
  18644. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18645. * that is not found in the character symbols.
  18646. *
  18647. * @private
  18648. * @param {Array} strSymbols The string symbols to inspect.
  18649. * @param {Array} chrSymbols The character symbols to find.
  18650. * @returns {number} Returns the index of the last unmatched string symbol.
  18651. */
  18652. function charsEndIndex(strSymbols, chrSymbols) {
  18653. var index = strSymbols.length;
  18654. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18655. return index;
  18656. }
  18657. /**
  18658. * Gets the number of `placeholder` occurrences in `array`.
  18659. *
  18660. * @private
  18661. * @param {Array} array The array to inspect.
  18662. * @param {*} placeholder The placeholder to search for.
  18663. * @returns {number} Returns the placeholder count.
  18664. */
  18665. function countHolders(array, placeholder) {
  18666. var length = array.length,
  18667. result = 0;
  18668. while (length--) {
  18669. if (array[length] === placeholder) {
  18670. ++result;
  18671. }
  18672. }
  18673. return result;
  18674. }
  18675. /**
  18676. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18677. * letters to basic Latin letters.
  18678. *
  18679. * @private
  18680. * @param {string} letter The matched letter to deburr.
  18681. * @returns {string} Returns the deburred letter.
  18682. */
  18683. var deburrLetter = basePropertyOf(deburredLetters);
  18684. /**
  18685. * Used by `_.escape` to convert characters to HTML entities.
  18686. *
  18687. * @private
  18688. * @param {string} chr The matched character to escape.
  18689. * @returns {string} Returns the escaped character.
  18690. */
  18691. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18692. /**
  18693. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18694. *
  18695. * @private
  18696. * @param {string} chr The matched character to escape.
  18697. * @returns {string} Returns the escaped character.
  18698. */
  18699. function escapeStringChar(chr) {
  18700. return '\\' + stringEscapes[chr];
  18701. }
  18702. /**
  18703. * Gets the value at `key` of `object`.
  18704. *
  18705. * @private
  18706. * @param {Object} [object] The object to query.
  18707. * @param {string} key The key of the property to get.
  18708. * @returns {*} Returns the property value.
  18709. */
  18710. function getValue(object, key) {
  18711. return object == null ? undefined : object[key];
  18712. }
  18713. /**
  18714. * Checks if `string` contains Unicode symbols.
  18715. *
  18716. * @private
  18717. * @param {string} string The string to inspect.
  18718. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18719. */
  18720. function hasUnicode(string) {
  18721. return reHasUnicode.test(string);
  18722. }
  18723. /**
  18724. * Checks if `string` contains a word composed of Unicode symbols.
  18725. *
  18726. * @private
  18727. * @param {string} string The string to inspect.
  18728. * @returns {boolean} Returns `true` if a word is found, else `false`.
  18729. */
  18730. function hasUnicodeWord(string) {
  18731. return reHasUnicodeWord.test(string);
  18732. }
  18733. /**
  18734. * Converts `iterator` to an array.
  18735. *
  18736. * @private
  18737. * @param {Object} iterator The iterator to convert.
  18738. * @returns {Array} Returns the converted array.
  18739. */
  18740. function iteratorToArray(iterator) {
  18741. var data,
  18742. result = [];
  18743. while (!(data = iterator.next()).done) {
  18744. result.push(data.value);
  18745. }
  18746. return result;
  18747. }
  18748. /**
  18749. * Converts `map` to its key-value pairs.
  18750. *
  18751. * @private
  18752. * @param {Object} map The map to convert.
  18753. * @returns {Array} Returns the key-value pairs.
  18754. */
  18755. function mapToArray(map) {
  18756. var index = -1,
  18757. result = Array(map.size);
  18758. map.forEach(function(value, key) {
  18759. result[++index] = [key, value];
  18760. });
  18761. return result;
  18762. }
  18763. /**
  18764. * Creates a unary function that invokes `func` with its argument transformed.
  18765. *
  18766. * @private
  18767. * @param {Function} func The function to wrap.
  18768. * @param {Function} transform The argument transform.
  18769. * @returns {Function} Returns the new function.
  18770. */
  18771. function overArg(func, transform) {
  18772. return function(arg) {
  18773. return func(transform(arg));
  18774. };
  18775. }
  18776. /**
  18777. * Replaces all `placeholder` elements in `array` with an internal placeholder
  18778. * and returns an array of their indexes.
  18779. *
  18780. * @private
  18781. * @param {Array} array The array to modify.
  18782. * @param {*} placeholder The placeholder to replace.
  18783. * @returns {Array} Returns the new array of placeholder indexes.
  18784. */
  18785. function replaceHolders(array, placeholder) {
  18786. var index = -1,
  18787. length = array.length,
  18788. resIndex = 0,
  18789. result = [];
  18790. while (++index < length) {
  18791. var value = array[index];
  18792. if (value === placeholder || value === PLACEHOLDER) {
  18793. array[index] = PLACEHOLDER;
  18794. result[resIndex++] = index;
  18795. }
  18796. }
  18797. return result;
  18798. }
  18799. /**
  18800. * Converts `set` to an array of its values.
  18801. *
  18802. * @private
  18803. * @param {Object} set The set to convert.
  18804. * @returns {Array} Returns the values.
  18805. */
  18806. function setToArray(set) {
  18807. var index = -1,
  18808. result = Array(set.size);
  18809. set.forEach(function(value) {
  18810. result[++index] = value;
  18811. });
  18812. return result;
  18813. }
  18814. /**
  18815. * Converts `set` to its value-value pairs.
  18816. *
  18817. * @private
  18818. * @param {Object} set The set to convert.
  18819. * @returns {Array} Returns the value-value pairs.
  18820. */
  18821. function setToPairs(set) {
  18822. var index = -1,
  18823. result = Array(set.size);
  18824. set.forEach(function(value) {
  18825. result[++index] = [value, value];
  18826. });
  18827. return result;
  18828. }
  18829. /**
  18830. * A specialized version of `_.indexOf` which performs strict equality
  18831. * comparisons of values, i.e. `===`.
  18832. *
  18833. * @private
  18834. * @param {Array} array The array to inspect.
  18835. * @param {*} value The value to search for.
  18836. * @param {number} fromIndex The index to search from.
  18837. * @returns {number} Returns the index of the matched value, else `-1`.
  18838. */
  18839. function strictIndexOf(array, value, fromIndex) {
  18840. var index = fromIndex - 1,
  18841. length = array.length;
  18842. while (++index < length) {
  18843. if (array[index] === value) {
  18844. return index;
  18845. }
  18846. }
  18847. return -1;
  18848. }
  18849. /**
  18850. * A specialized version of `_.lastIndexOf` which performs strict equality
  18851. * comparisons of values, i.e. `===`.
  18852. *
  18853. * @private
  18854. * @param {Array} array The array to inspect.
  18855. * @param {*} value The value to search for.
  18856. * @param {number} fromIndex The index to search from.
  18857. * @returns {number} Returns the index of the matched value, else `-1`.
  18858. */
  18859. function strictLastIndexOf(array, value, fromIndex) {
  18860. var index = fromIndex + 1;
  18861. while (index--) {
  18862. if (array[index] === value) {
  18863. return index;
  18864. }
  18865. }
  18866. return index;
  18867. }
  18868. /**
  18869. * Gets the number of symbols in `string`.
  18870. *
  18871. * @private
  18872. * @param {string} string The string to inspect.
  18873. * @returns {number} Returns the string size.
  18874. */
  18875. function stringSize(string) {
  18876. return hasUnicode(string)
  18877. ? unicodeSize(string)
  18878. : asciiSize(string);
  18879. }
  18880. /**
  18881. * Converts `string` to an array.
  18882. *
  18883. * @private
  18884. * @param {string} string The string to convert.
  18885. * @returns {Array} Returns the converted array.
  18886. */
  18887. function stringToArray(string) {
  18888. return hasUnicode(string)
  18889. ? unicodeToArray(string)
  18890. : asciiToArray(string);
  18891. }
  18892. /**
  18893. * Used by `_.unescape` to convert HTML entities to characters.
  18894. *
  18895. * @private
  18896. * @param {string} chr The matched character to unescape.
  18897. * @returns {string} Returns the unescaped character.
  18898. */
  18899. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  18900. /**
  18901. * Gets the size of a Unicode `string`.
  18902. *
  18903. * @private
  18904. * @param {string} string The string inspect.
  18905. * @returns {number} Returns the string size.
  18906. */
  18907. function unicodeSize(string) {
  18908. var result = reUnicode.lastIndex = 0;
  18909. while (reUnicode.test(string)) {
  18910. ++result;
  18911. }
  18912. return result;
  18913. }
  18914. /**
  18915. * Converts a Unicode `string` to an array.
  18916. *
  18917. * @private
  18918. * @param {string} string The string to convert.
  18919. * @returns {Array} Returns the converted array.
  18920. */
  18921. function unicodeToArray(string) {
  18922. return string.match(reUnicode) || [];
  18923. }
  18924. /**
  18925. * Splits a Unicode `string` into an array of its words.
  18926. *
  18927. * @private
  18928. * @param {string} The string to inspect.
  18929. * @returns {Array} Returns the words of `string`.
  18930. */
  18931. function unicodeWords(string) {
  18932. return string.match(reUnicodeWord) || [];
  18933. }
  18934. /*--------------------------------------------------------------------------*/
  18935. /**
  18936. * Create a new pristine `lodash` function using the `context` object.
  18937. *
  18938. * @static
  18939. * @memberOf _
  18940. * @since 1.1.0
  18941. * @category Util
  18942. * @param {Object} [context=root] The context object.
  18943. * @returns {Function} Returns a new `lodash` function.
  18944. * @example
  18945. *
  18946. * _.mixin({ 'foo': _.constant('foo') });
  18947. *
  18948. * var lodash = _.runInContext();
  18949. * lodash.mixin({ 'bar': lodash.constant('bar') });
  18950. *
  18951. * _.isFunction(_.foo);
  18952. * // => true
  18953. * _.isFunction(_.bar);
  18954. * // => false
  18955. *
  18956. * lodash.isFunction(lodash.foo);
  18957. * // => false
  18958. * lodash.isFunction(lodash.bar);
  18959. * // => true
  18960. *
  18961. * // Create a suped-up `defer` in Node.js.
  18962. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  18963. */
  18964. var runInContext = (function runInContext(context) {
  18965. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  18966. /** Built-in constructor references. */
  18967. var Array = context.Array,
  18968. Date = context.Date,
  18969. Error = context.Error,
  18970. Function = context.Function,
  18971. Math = context.Math,
  18972. Object = context.Object,
  18973. RegExp = context.RegExp,
  18974. String = context.String,
  18975. TypeError = context.TypeError;
  18976. /** Used for built-in method references. */
  18977. var arrayProto = Array.prototype,
  18978. funcProto = Function.prototype,
  18979. objectProto = Object.prototype;
  18980. /** Used to detect overreaching core-js shims. */
  18981. var coreJsData = context['__core-js_shared__'];
  18982. /** Used to resolve the decompiled source of functions. */
  18983. var funcToString = funcProto.toString;
  18984. /** Used to check objects for own properties. */
  18985. var hasOwnProperty = objectProto.hasOwnProperty;
  18986. /** Used to generate unique IDs. */
  18987. var idCounter = 0;
  18988. /** Used to detect methods masquerading as native. */
  18989. var maskSrcKey = (function() {
  18990. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  18991. return uid ? ('Symbol(src)_1.' + uid) : '';
  18992. }());
  18993. /**
  18994. * Used to resolve the
  18995. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  18996. * of values.
  18997. */
  18998. var nativeObjectToString = objectProto.toString;
  18999. /** Used to infer the `Object` constructor. */
  19000. var objectCtorString = funcToString.call(Object);
  19001. /** Used to restore the original `_` reference in `_.noConflict`. */
  19002. var oldDash = root._;
  19003. /** Used to detect if a method is native. */
  19004. var reIsNative = RegExp('^' +
  19005. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19006. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19007. );
  19008. /** Built-in value references. */
  19009. var Buffer = moduleExports ? context.Buffer : undefined,
  19010. Symbol = context.Symbol,
  19011. Uint8Array = context.Uint8Array,
  19012. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19013. getPrototype = overArg(Object.getPrototypeOf, Object),
  19014. objectCreate = Object.create,
  19015. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19016. splice = arrayProto.splice,
  19017. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19018. symIterator = Symbol ? Symbol.iterator : undefined,
  19019. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19020. var defineProperty = (function() {
  19021. try {
  19022. var func = getNative(Object, 'defineProperty');
  19023. func({}, '', {});
  19024. return func;
  19025. } catch (e) {}
  19026. }());
  19027. /** Mocked built-ins. */
  19028. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19029. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19030. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19031. /* Built-in method references for those with the same name as other `lodash` methods. */
  19032. var nativeCeil = Math.ceil,
  19033. nativeFloor = Math.floor,
  19034. nativeGetSymbols = Object.getOwnPropertySymbols,
  19035. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19036. nativeIsFinite = context.isFinite,
  19037. nativeJoin = arrayProto.join,
  19038. nativeKeys = overArg(Object.keys, Object),
  19039. nativeMax = Math.max,
  19040. nativeMin = Math.min,
  19041. nativeNow = Date.now,
  19042. nativeParseInt = context.parseInt,
  19043. nativeRandom = Math.random,
  19044. nativeReverse = arrayProto.reverse;
  19045. /* Built-in method references that are verified to be native. */
  19046. var DataView = getNative(context, 'DataView'),
  19047. Map = getNative(context, 'Map'),
  19048. Promise = getNative(context, 'Promise'),
  19049. Set = getNative(context, 'Set'),
  19050. WeakMap = getNative(context, 'WeakMap'),
  19051. nativeCreate = getNative(Object, 'create');
  19052. /** Used to store function metadata. */
  19053. var metaMap = WeakMap && new WeakMap;
  19054. /** Used to lookup unminified function names. */
  19055. var realNames = {};
  19056. /** Used to detect maps, sets, and weakmaps. */
  19057. var dataViewCtorString = toSource(DataView),
  19058. mapCtorString = toSource(Map),
  19059. promiseCtorString = toSource(Promise),
  19060. setCtorString = toSource(Set),
  19061. weakMapCtorString = toSource(WeakMap);
  19062. /** Used to convert symbols to primitives and strings. */
  19063. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19064. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19065. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19066. /*------------------------------------------------------------------------*/
  19067. /**
  19068. * Creates a `lodash` object which wraps `value` to enable implicit method
  19069. * chain sequences. Methods that operate on and return arrays, collections,
  19070. * and functions can be chained together. Methods that retrieve a single value
  19071. * or may return a primitive value will automatically end the chain sequence
  19072. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19073. * with `_#value`.
  19074. *
  19075. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19076. * enabled using `_.chain`.
  19077. *
  19078. * The execution of chained methods is lazy, that is, it's deferred until
  19079. * `_#value` is implicitly or explicitly called.
  19080. *
  19081. * Lazy evaluation allows several methods to support shortcut fusion.
  19082. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19083. * the creation of intermediate arrays and can greatly reduce the number of
  19084. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19085. * fusion if the section is applied to an array and iteratees accept only
  19086. * one argument. The heuristic for whether a section qualifies for shortcut
  19087. * fusion is subject to change.
  19088. *
  19089. * Chaining is supported in custom builds as long as the `_#value` method is
  19090. * directly or indirectly included in the build.
  19091. *
  19092. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19093. *
  19094. * The wrapper `Array` methods are:
  19095. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19096. *
  19097. * The wrapper `String` methods are:
  19098. * `replace` and `split`
  19099. *
  19100. * The wrapper methods that support shortcut fusion are:
  19101. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19102. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19103. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19104. *
  19105. * The chainable wrapper methods are:
  19106. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19107. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19108. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19109. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19110. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19111. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19112. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19113. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19114. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19115. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19116. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19117. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19118. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19119. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19120. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19121. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19122. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19123. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19124. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19125. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19126. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19127. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19128. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19129. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19130. *
  19131. * The wrapper methods that are **not** chainable by default are:
  19132. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19133. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19134. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19135. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19136. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19137. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19138. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19139. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19140. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19141. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19142. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19143. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19144. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19145. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19146. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19147. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19148. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19149. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19150. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19151. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19152. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19153. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19154. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19155. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19156. * `upperFirst`, `value`, and `words`
  19157. *
  19158. * @name _
  19159. * @constructor
  19160. * @category Seq
  19161. * @param {*} value The value to wrap in a `lodash` instance.
  19162. * @returns {Object} Returns the new `lodash` wrapper instance.
  19163. * @example
  19164. *
  19165. * function square(n) {
  19166. * return n * n;
  19167. * }
  19168. *
  19169. * var wrapped = _([1, 2, 3]);
  19170. *
  19171. * // Returns an unwrapped value.
  19172. * wrapped.reduce(_.add);
  19173. * // => 6
  19174. *
  19175. * // Returns a wrapped value.
  19176. * var squares = wrapped.map(square);
  19177. *
  19178. * _.isArray(squares);
  19179. * // => false
  19180. *
  19181. * _.isArray(squares.value());
  19182. * // => true
  19183. */
  19184. function lodash(value) {
  19185. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19186. if (value instanceof LodashWrapper) {
  19187. return value;
  19188. }
  19189. if (hasOwnProperty.call(value, '__wrapped__')) {
  19190. return wrapperClone(value);
  19191. }
  19192. }
  19193. return new LodashWrapper(value);
  19194. }
  19195. /**
  19196. * The base implementation of `_.create` without support for assigning
  19197. * properties to the created object.
  19198. *
  19199. * @private
  19200. * @param {Object} proto The object to inherit from.
  19201. * @returns {Object} Returns the new object.
  19202. */
  19203. var baseCreate = (function() {
  19204. function object() {}
  19205. return function(proto) {
  19206. if (!isObject(proto)) {
  19207. return {};
  19208. }
  19209. if (objectCreate) {
  19210. return objectCreate(proto);
  19211. }
  19212. object.prototype = proto;
  19213. var result = new object;
  19214. object.prototype = undefined;
  19215. return result;
  19216. };
  19217. }());
  19218. /**
  19219. * The function whose prototype chain sequence wrappers inherit from.
  19220. *
  19221. * @private
  19222. */
  19223. function baseLodash() {
  19224. // No operation performed.
  19225. }
  19226. /**
  19227. * The base constructor for creating `lodash` wrapper objects.
  19228. *
  19229. * @private
  19230. * @param {*} value The value to wrap.
  19231. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19232. */
  19233. function LodashWrapper(value, chainAll) {
  19234. this.__wrapped__ = value;
  19235. this.__actions__ = [];
  19236. this.__chain__ = !!chainAll;
  19237. this.__index__ = 0;
  19238. this.__values__ = undefined;
  19239. }
  19240. /**
  19241. * By default, the template delimiters used by lodash are like those in
  19242. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19243. * following template settings to use alternative delimiters.
  19244. *
  19245. * @static
  19246. * @memberOf _
  19247. * @type {Object}
  19248. */
  19249. lodash.templateSettings = {
  19250. /**
  19251. * Used to detect `data` property values to be HTML-escaped.
  19252. *
  19253. * @memberOf _.templateSettings
  19254. * @type {RegExp}
  19255. */
  19256. 'escape': reEscape,
  19257. /**
  19258. * Used to detect code to be evaluated.
  19259. *
  19260. * @memberOf _.templateSettings
  19261. * @type {RegExp}
  19262. */
  19263. 'evaluate': reEvaluate,
  19264. /**
  19265. * Used to detect `data` property values to inject.
  19266. *
  19267. * @memberOf _.templateSettings
  19268. * @type {RegExp}
  19269. */
  19270. 'interpolate': reInterpolate,
  19271. /**
  19272. * Used to reference the data object in the template text.
  19273. *
  19274. * @memberOf _.templateSettings
  19275. * @type {string}
  19276. */
  19277. 'variable': '',
  19278. /**
  19279. * Used to import variables into the compiled template.
  19280. *
  19281. * @memberOf _.templateSettings
  19282. * @type {Object}
  19283. */
  19284. 'imports': {
  19285. /**
  19286. * A reference to the `lodash` function.
  19287. *
  19288. * @memberOf _.templateSettings.imports
  19289. * @type {Function}
  19290. */
  19291. '_': lodash
  19292. }
  19293. };
  19294. // Ensure wrappers are instances of `baseLodash`.
  19295. lodash.prototype = baseLodash.prototype;
  19296. lodash.prototype.constructor = lodash;
  19297. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19298. LodashWrapper.prototype.constructor = LodashWrapper;
  19299. /*------------------------------------------------------------------------*/
  19300. /**
  19301. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19302. *
  19303. * @private
  19304. * @constructor
  19305. * @param {*} value The value to wrap.
  19306. */
  19307. function LazyWrapper(value) {
  19308. this.__wrapped__ = value;
  19309. this.__actions__ = [];
  19310. this.__dir__ = 1;
  19311. this.__filtered__ = false;
  19312. this.__iteratees__ = [];
  19313. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19314. this.__views__ = [];
  19315. }
  19316. /**
  19317. * Creates a clone of the lazy wrapper object.
  19318. *
  19319. * @private
  19320. * @name clone
  19321. * @memberOf LazyWrapper
  19322. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19323. */
  19324. function lazyClone() {
  19325. var result = new LazyWrapper(this.__wrapped__);
  19326. result.__actions__ = copyArray(this.__actions__);
  19327. result.__dir__ = this.__dir__;
  19328. result.__filtered__ = this.__filtered__;
  19329. result.__iteratees__ = copyArray(this.__iteratees__);
  19330. result.__takeCount__ = this.__takeCount__;
  19331. result.__views__ = copyArray(this.__views__);
  19332. return result;
  19333. }
  19334. /**
  19335. * Reverses the direction of lazy iteration.
  19336. *
  19337. * @private
  19338. * @name reverse
  19339. * @memberOf LazyWrapper
  19340. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19341. */
  19342. function lazyReverse() {
  19343. if (this.__filtered__) {
  19344. var result = new LazyWrapper(this);
  19345. result.__dir__ = -1;
  19346. result.__filtered__ = true;
  19347. } else {
  19348. result = this.clone();
  19349. result.__dir__ *= -1;
  19350. }
  19351. return result;
  19352. }
  19353. /**
  19354. * Extracts the unwrapped value from its lazy wrapper.
  19355. *
  19356. * @private
  19357. * @name value
  19358. * @memberOf LazyWrapper
  19359. * @returns {*} Returns the unwrapped value.
  19360. */
  19361. function lazyValue() {
  19362. var array = this.__wrapped__.value(),
  19363. dir = this.__dir__,
  19364. isArr = isArray(array),
  19365. isRight = dir < 0,
  19366. arrLength = isArr ? array.length : 0,
  19367. view = getView(0, arrLength, this.__views__),
  19368. start = view.start,
  19369. end = view.end,
  19370. length = end - start,
  19371. index = isRight ? end : (start - 1),
  19372. iteratees = this.__iteratees__,
  19373. iterLength = iteratees.length,
  19374. resIndex = 0,
  19375. takeCount = nativeMin(length, this.__takeCount__);
  19376. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19377. return baseWrapperValue(array, this.__actions__);
  19378. }
  19379. var result = [];
  19380. outer:
  19381. while (length-- && resIndex < takeCount) {
  19382. index += dir;
  19383. var iterIndex = -1,
  19384. value = array[index];
  19385. while (++iterIndex < iterLength) {
  19386. var data = iteratees[iterIndex],
  19387. iteratee = data.iteratee,
  19388. type = data.type,
  19389. computed = iteratee(value);
  19390. if (type == LAZY_MAP_FLAG) {
  19391. value = computed;
  19392. } else if (!computed) {
  19393. if (type == LAZY_FILTER_FLAG) {
  19394. continue outer;
  19395. } else {
  19396. break outer;
  19397. }
  19398. }
  19399. }
  19400. result[resIndex++] = value;
  19401. }
  19402. return result;
  19403. }
  19404. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19405. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19406. LazyWrapper.prototype.constructor = LazyWrapper;
  19407. /*------------------------------------------------------------------------*/
  19408. /**
  19409. * Creates a hash object.
  19410. *
  19411. * @private
  19412. * @constructor
  19413. * @param {Array} [entries] The key-value pairs to cache.
  19414. */
  19415. function Hash(entries) {
  19416. var index = -1,
  19417. length = entries == null ? 0 : entries.length;
  19418. this.clear();
  19419. while (++index < length) {
  19420. var entry = entries[index];
  19421. this.set(entry[0], entry[1]);
  19422. }
  19423. }
  19424. /**
  19425. * Removes all key-value entries from the hash.
  19426. *
  19427. * @private
  19428. * @name clear
  19429. * @memberOf Hash
  19430. */
  19431. function hashClear() {
  19432. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19433. this.size = 0;
  19434. }
  19435. /**
  19436. * Removes `key` and its value from the hash.
  19437. *
  19438. * @private
  19439. * @name delete
  19440. * @memberOf Hash
  19441. * @param {Object} hash The hash to modify.
  19442. * @param {string} key The key of the value to remove.
  19443. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19444. */
  19445. function hashDelete(key) {
  19446. var result = this.has(key) && delete this.__data__[key];
  19447. this.size -= result ? 1 : 0;
  19448. return result;
  19449. }
  19450. /**
  19451. * Gets the hash value for `key`.
  19452. *
  19453. * @private
  19454. * @name get
  19455. * @memberOf Hash
  19456. * @param {string} key The key of the value to get.
  19457. * @returns {*} Returns the entry value.
  19458. */
  19459. function hashGet(key) {
  19460. var data = this.__data__;
  19461. if (nativeCreate) {
  19462. var result = data[key];
  19463. return result === HASH_UNDEFINED ? undefined : result;
  19464. }
  19465. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19466. }
  19467. /**
  19468. * Checks if a hash value for `key` exists.
  19469. *
  19470. * @private
  19471. * @name has
  19472. * @memberOf Hash
  19473. * @param {string} key The key of the entry to check.
  19474. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19475. */
  19476. function hashHas(key) {
  19477. var data = this.__data__;
  19478. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19479. }
  19480. /**
  19481. * Sets the hash `key` to `value`.
  19482. *
  19483. * @private
  19484. * @name set
  19485. * @memberOf Hash
  19486. * @param {string} key The key of the value to set.
  19487. * @param {*} value The value to set.
  19488. * @returns {Object} Returns the hash instance.
  19489. */
  19490. function hashSet(key, value) {
  19491. var data = this.__data__;
  19492. this.size += this.has(key) ? 0 : 1;
  19493. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19494. return this;
  19495. }
  19496. // Add methods to `Hash`.
  19497. Hash.prototype.clear = hashClear;
  19498. Hash.prototype['delete'] = hashDelete;
  19499. Hash.prototype.get = hashGet;
  19500. Hash.prototype.has = hashHas;
  19501. Hash.prototype.set = hashSet;
  19502. /*------------------------------------------------------------------------*/
  19503. /**
  19504. * Creates an list cache object.
  19505. *
  19506. * @private
  19507. * @constructor
  19508. * @param {Array} [entries] The key-value pairs to cache.
  19509. */
  19510. function ListCache(entries) {
  19511. var index = -1,
  19512. length = entries == null ? 0 : entries.length;
  19513. this.clear();
  19514. while (++index < length) {
  19515. var entry = entries[index];
  19516. this.set(entry[0], entry[1]);
  19517. }
  19518. }
  19519. /**
  19520. * Removes all key-value entries from the list cache.
  19521. *
  19522. * @private
  19523. * @name clear
  19524. * @memberOf ListCache
  19525. */
  19526. function listCacheClear() {
  19527. this.__data__ = [];
  19528. this.size = 0;
  19529. }
  19530. /**
  19531. * Removes `key` and its value from the list cache.
  19532. *
  19533. * @private
  19534. * @name delete
  19535. * @memberOf ListCache
  19536. * @param {string} key The key of the value to remove.
  19537. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19538. */
  19539. function listCacheDelete(key) {
  19540. var data = this.__data__,
  19541. index = assocIndexOf(data, key);
  19542. if (index < 0) {
  19543. return false;
  19544. }
  19545. var lastIndex = data.length - 1;
  19546. if (index == lastIndex) {
  19547. data.pop();
  19548. } else {
  19549. splice.call(data, index, 1);
  19550. }
  19551. --this.size;
  19552. return true;
  19553. }
  19554. /**
  19555. * Gets the list cache value for `key`.
  19556. *
  19557. * @private
  19558. * @name get
  19559. * @memberOf ListCache
  19560. * @param {string} key The key of the value to get.
  19561. * @returns {*} Returns the entry value.
  19562. */
  19563. function listCacheGet(key) {
  19564. var data = this.__data__,
  19565. index = assocIndexOf(data, key);
  19566. return index < 0 ? undefined : data[index][1];
  19567. }
  19568. /**
  19569. * Checks if a list cache value for `key` exists.
  19570. *
  19571. * @private
  19572. * @name has
  19573. * @memberOf ListCache
  19574. * @param {string} key The key of the entry to check.
  19575. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19576. */
  19577. function listCacheHas(key) {
  19578. return assocIndexOf(this.__data__, key) > -1;
  19579. }
  19580. /**
  19581. * Sets the list cache `key` to `value`.
  19582. *
  19583. * @private
  19584. * @name set
  19585. * @memberOf ListCache
  19586. * @param {string} key The key of the value to set.
  19587. * @param {*} value The value to set.
  19588. * @returns {Object} Returns the list cache instance.
  19589. */
  19590. function listCacheSet(key, value) {
  19591. var data = this.__data__,
  19592. index = assocIndexOf(data, key);
  19593. if (index < 0) {
  19594. ++this.size;
  19595. data.push([key, value]);
  19596. } else {
  19597. data[index][1] = value;
  19598. }
  19599. return this;
  19600. }
  19601. // Add methods to `ListCache`.
  19602. ListCache.prototype.clear = listCacheClear;
  19603. ListCache.prototype['delete'] = listCacheDelete;
  19604. ListCache.prototype.get = listCacheGet;
  19605. ListCache.prototype.has = listCacheHas;
  19606. ListCache.prototype.set = listCacheSet;
  19607. /*------------------------------------------------------------------------*/
  19608. /**
  19609. * Creates a map cache object to store key-value pairs.
  19610. *
  19611. * @private
  19612. * @constructor
  19613. * @param {Array} [entries] The key-value pairs to cache.
  19614. */
  19615. function MapCache(entries) {
  19616. var index = -1,
  19617. length = entries == null ? 0 : entries.length;
  19618. this.clear();
  19619. while (++index < length) {
  19620. var entry = entries[index];
  19621. this.set(entry[0], entry[1]);
  19622. }
  19623. }
  19624. /**
  19625. * Removes all key-value entries from the map.
  19626. *
  19627. * @private
  19628. * @name clear
  19629. * @memberOf MapCache
  19630. */
  19631. function mapCacheClear() {
  19632. this.size = 0;
  19633. this.__data__ = {
  19634. 'hash': new Hash,
  19635. 'map': new (Map || ListCache),
  19636. 'string': new Hash
  19637. };
  19638. }
  19639. /**
  19640. * Removes `key` and its value from the map.
  19641. *
  19642. * @private
  19643. * @name delete
  19644. * @memberOf MapCache
  19645. * @param {string} key The key of the value to remove.
  19646. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19647. */
  19648. function mapCacheDelete(key) {
  19649. var result = getMapData(this, key)['delete'](key);
  19650. this.size -= result ? 1 : 0;
  19651. return result;
  19652. }
  19653. /**
  19654. * Gets the map value for `key`.
  19655. *
  19656. * @private
  19657. * @name get
  19658. * @memberOf MapCache
  19659. * @param {string} key The key of the value to get.
  19660. * @returns {*} Returns the entry value.
  19661. */
  19662. function mapCacheGet(key) {
  19663. return getMapData(this, key).get(key);
  19664. }
  19665. /**
  19666. * Checks if a map value for `key` exists.
  19667. *
  19668. * @private
  19669. * @name has
  19670. * @memberOf MapCache
  19671. * @param {string} key The key of the entry to check.
  19672. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19673. */
  19674. function mapCacheHas(key) {
  19675. return getMapData(this, key).has(key);
  19676. }
  19677. /**
  19678. * Sets the map `key` to `value`.
  19679. *
  19680. * @private
  19681. * @name set
  19682. * @memberOf MapCache
  19683. * @param {string} key The key of the value to set.
  19684. * @param {*} value The value to set.
  19685. * @returns {Object} Returns the map cache instance.
  19686. */
  19687. function mapCacheSet(key, value) {
  19688. var data = getMapData(this, key),
  19689. size = data.size;
  19690. data.set(key, value);
  19691. this.size += data.size == size ? 0 : 1;
  19692. return this;
  19693. }
  19694. // Add methods to `MapCache`.
  19695. MapCache.prototype.clear = mapCacheClear;
  19696. MapCache.prototype['delete'] = mapCacheDelete;
  19697. MapCache.prototype.get = mapCacheGet;
  19698. MapCache.prototype.has = mapCacheHas;
  19699. MapCache.prototype.set = mapCacheSet;
  19700. /*------------------------------------------------------------------------*/
  19701. /**
  19702. *
  19703. * Creates an array cache object to store unique values.
  19704. *
  19705. * @private
  19706. * @constructor
  19707. * @param {Array} [values] The values to cache.
  19708. */
  19709. function SetCache(values) {
  19710. var index = -1,
  19711. length = values == null ? 0 : values.length;
  19712. this.__data__ = new MapCache;
  19713. while (++index < length) {
  19714. this.add(values[index]);
  19715. }
  19716. }
  19717. /**
  19718. * Adds `value` to the array cache.
  19719. *
  19720. * @private
  19721. * @name add
  19722. * @memberOf SetCache
  19723. * @alias push
  19724. * @param {*} value The value to cache.
  19725. * @returns {Object} Returns the cache instance.
  19726. */
  19727. function setCacheAdd(value) {
  19728. this.__data__.set(value, HASH_UNDEFINED);
  19729. return this;
  19730. }
  19731. /**
  19732. * Checks if `value` is in the array cache.
  19733. *
  19734. * @private
  19735. * @name has
  19736. * @memberOf SetCache
  19737. * @param {*} value The value to search for.
  19738. * @returns {number} Returns `true` if `value` is found, else `false`.
  19739. */
  19740. function setCacheHas(value) {
  19741. return this.__data__.has(value);
  19742. }
  19743. // Add methods to `SetCache`.
  19744. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  19745. SetCache.prototype.has = setCacheHas;
  19746. /*------------------------------------------------------------------------*/
  19747. /**
  19748. * Creates a stack cache object to store key-value pairs.
  19749. *
  19750. * @private
  19751. * @constructor
  19752. * @param {Array} [entries] The key-value pairs to cache.
  19753. */
  19754. function Stack(entries) {
  19755. var data = this.__data__ = new ListCache(entries);
  19756. this.size = data.size;
  19757. }
  19758. /**
  19759. * Removes all key-value entries from the stack.
  19760. *
  19761. * @private
  19762. * @name clear
  19763. * @memberOf Stack
  19764. */
  19765. function stackClear() {
  19766. this.__data__ = new ListCache;
  19767. this.size = 0;
  19768. }
  19769. /**
  19770. * Removes `key` and its value from the stack.
  19771. *
  19772. * @private
  19773. * @name delete
  19774. * @memberOf Stack
  19775. * @param {string} key The key of the value to remove.
  19776. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19777. */
  19778. function stackDelete(key) {
  19779. var data = this.__data__,
  19780. result = data['delete'](key);
  19781. this.size = data.size;
  19782. return result;
  19783. }
  19784. /**
  19785. * Gets the stack value for `key`.
  19786. *
  19787. * @private
  19788. * @name get
  19789. * @memberOf Stack
  19790. * @param {string} key The key of the value to get.
  19791. * @returns {*} Returns the entry value.
  19792. */
  19793. function stackGet(key) {
  19794. return this.__data__.get(key);
  19795. }
  19796. /**
  19797. * Checks if a stack value for `key` exists.
  19798. *
  19799. * @private
  19800. * @name has
  19801. * @memberOf Stack
  19802. * @param {string} key The key of the entry to check.
  19803. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19804. */
  19805. function stackHas(key) {
  19806. return this.__data__.has(key);
  19807. }
  19808. /**
  19809. * Sets the stack `key` to `value`.
  19810. *
  19811. * @private
  19812. * @name set
  19813. * @memberOf Stack
  19814. * @param {string} key The key of the value to set.
  19815. * @param {*} value The value to set.
  19816. * @returns {Object} Returns the stack cache instance.
  19817. */
  19818. function stackSet(key, value) {
  19819. var data = this.__data__;
  19820. if (data instanceof ListCache) {
  19821. var pairs = data.__data__;
  19822. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  19823. pairs.push([key, value]);
  19824. this.size = ++data.size;
  19825. return this;
  19826. }
  19827. data = this.__data__ = new MapCache(pairs);
  19828. }
  19829. data.set(key, value);
  19830. this.size = data.size;
  19831. return this;
  19832. }
  19833. // Add methods to `Stack`.
  19834. Stack.prototype.clear = stackClear;
  19835. Stack.prototype['delete'] = stackDelete;
  19836. Stack.prototype.get = stackGet;
  19837. Stack.prototype.has = stackHas;
  19838. Stack.prototype.set = stackSet;
  19839. /*------------------------------------------------------------------------*/
  19840. /**
  19841. * Creates an array of the enumerable property names of the array-like `value`.
  19842. *
  19843. * @private
  19844. * @param {*} value The value to query.
  19845. * @param {boolean} inherited Specify returning inherited property names.
  19846. * @returns {Array} Returns the array of property names.
  19847. */
  19848. function arrayLikeKeys(value, inherited) {
  19849. var isArr = isArray(value),
  19850. isArg = !isArr && isArguments(value),
  19851. isBuff = !isArr && !isArg && isBuffer(value),
  19852. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  19853. skipIndexes = isArr || isArg || isBuff || isType,
  19854. result = skipIndexes ? baseTimes(value.length, String) : [],
  19855. length = result.length;
  19856. for (var key in value) {
  19857. if ((inherited || hasOwnProperty.call(value, key)) &&
  19858. !(skipIndexes && (
  19859. // Safari 9 has enumerable `arguments.length` in strict mode.
  19860. key == 'length' ||
  19861. // Node.js 0.10 has enumerable non-index properties on buffers.
  19862. (isBuff && (key == 'offset' || key == 'parent')) ||
  19863. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  19864. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  19865. // Skip index properties.
  19866. isIndex(key, length)
  19867. ))) {
  19868. result.push(key);
  19869. }
  19870. }
  19871. return result;
  19872. }
  19873. /**
  19874. * A specialized version of `_.sample` for arrays.
  19875. *
  19876. * @private
  19877. * @param {Array} array The array to sample.
  19878. * @returns {*} Returns the random element.
  19879. */
  19880. function arraySample(array) {
  19881. var length = array.length;
  19882. return length ? array[baseRandom(0, length - 1)] : undefined;
  19883. }
  19884. /**
  19885. * A specialized version of `_.sampleSize` for arrays.
  19886. *
  19887. * @private
  19888. * @param {Array} array The array to sample.
  19889. * @param {number} n The number of elements to sample.
  19890. * @returns {Array} Returns the random elements.
  19891. */
  19892. function arraySampleSize(array, n) {
  19893. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  19894. }
  19895. /**
  19896. * A specialized version of `_.shuffle` for arrays.
  19897. *
  19898. * @private
  19899. * @param {Array} array The array to shuffle.
  19900. * @returns {Array} Returns the new shuffled array.
  19901. */
  19902. function arrayShuffle(array) {
  19903. return shuffleSelf(copyArray(array));
  19904. }
  19905. /**
  19906. * This function is like `assignValue` except that it doesn't assign
  19907. * `undefined` values.
  19908. *
  19909. * @private
  19910. * @param {Object} object The object to modify.
  19911. * @param {string} key The key of the property to assign.
  19912. * @param {*} value The value to assign.
  19913. */
  19914. function assignMergeValue(object, key, value) {
  19915. if ((value !== undefined && !eq(object[key], value)) ||
  19916. (value === undefined && !(key in object))) {
  19917. baseAssignValue(object, key, value);
  19918. }
  19919. }
  19920. /**
  19921. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  19922. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  19923. * for equality comparisons.
  19924. *
  19925. * @private
  19926. * @param {Object} object The object to modify.
  19927. * @param {string} key The key of the property to assign.
  19928. * @param {*} value The value to assign.
  19929. */
  19930. function assignValue(object, key, value) {
  19931. var objValue = object[key];
  19932. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  19933. (value === undefined && !(key in object))) {
  19934. baseAssignValue(object, key, value);
  19935. }
  19936. }
  19937. /**
  19938. * Gets the index at which the `key` is found in `array` of key-value pairs.
  19939. *
  19940. * @private
  19941. * @param {Array} array The array to inspect.
  19942. * @param {*} key The key to search for.
  19943. * @returns {number} Returns the index of the matched value, else `-1`.
  19944. */
  19945. function assocIndexOf(array, key) {
  19946. var length = array.length;
  19947. while (length--) {
  19948. if (eq(array[length][0], key)) {
  19949. return length;
  19950. }
  19951. }
  19952. return -1;
  19953. }
  19954. /**
  19955. * Aggregates elements of `collection` on `accumulator` with keys transformed
  19956. * by `iteratee` and values set by `setter`.
  19957. *
  19958. * @private
  19959. * @param {Array|Object} collection The collection to iterate over.
  19960. * @param {Function} setter The function to set `accumulator` values.
  19961. * @param {Function} iteratee The iteratee to transform keys.
  19962. * @param {Object} accumulator The initial aggregated object.
  19963. * @returns {Function} Returns `accumulator`.
  19964. */
  19965. function baseAggregator(collection, setter, iteratee, accumulator) {
  19966. baseEach(collection, function(value, key, collection) {
  19967. setter(accumulator, value, iteratee(value), collection);
  19968. });
  19969. return accumulator;
  19970. }
  19971. /**
  19972. * The base implementation of `_.assign` without support for multiple sources
  19973. * or `customizer` functions.
  19974. *
  19975. * @private
  19976. * @param {Object} object The destination object.
  19977. * @param {Object} source The source object.
  19978. * @returns {Object} Returns `object`.
  19979. */
  19980. function baseAssign(object, source) {
  19981. return object && copyObject(source, keys(source), object);
  19982. }
  19983. /**
  19984. * The base implementation of `_.assignIn` without support for multiple sources
  19985. * or `customizer` functions.
  19986. *
  19987. * @private
  19988. * @param {Object} object The destination object.
  19989. * @param {Object} source The source object.
  19990. * @returns {Object} Returns `object`.
  19991. */
  19992. function baseAssignIn(object, source) {
  19993. return object && copyObject(source, keysIn(source), object);
  19994. }
  19995. /**
  19996. * The base implementation of `assignValue` and `assignMergeValue` without
  19997. * value checks.
  19998. *
  19999. * @private
  20000. * @param {Object} object The object to modify.
  20001. * @param {string} key The key of the property to assign.
  20002. * @param {*} value The value to assign.
  20003. */
  20004. function baseAssignValue(object, key, value) {
  20005. if (key == '__proto__' && defineProperty) {
  20006. defineProperty(object, key, {
  20007. 'configurable': true,
  20008. 'enumerable': true,
  20009. 'value': value,
  20010. 'writable': true
  20011. });
  20012. } else {
  20013. object[key] = value;
  20014. }
  20015. }
  20016. /**
  20017. * The base implementation of `_.at` without support for individual paths.
  20018. *
  20019. * @private
  20020. * @param {Object} object The object to iterate over.
  20021. * @param {string[]} paths The property paths to pick.
  20022. * @returns {Array} Returns the picked elements.
  20023. */
  20024. function baseAt(object, paths) {
  20025. var index = -1,
  20026. length = paths.length,
  20027. result = Array(length),
  20028. skip = object == null;
  20029. while (++index < length) {
  20030. result[index] = skip ? undefined : get(object, paths[index]);
  20031. }
  20032. return result;
  20033. }
  20034. /**
  20035. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20036. *
  20037. * @private
  20038. * @param {number} number The number to clamp.
  20039. * @param {number} [lower] The lower bound.
  20040. * @param {number} upper The upper bound.
  20041. * @returns {number} Returns the clamped number.
  20042. */
  20043. function baseClamp(number, lower, upper) {
  20044. if (number === number) {
  20045. if (upper !== undefined) {
  20046. number = number <= upper ? number : upper;
  20047. }
  20048. if (lower !== undefined) {
  20049. number = number >= lower ? number : lower;
  20050. }
  20051. }
  20052. return number;
  20053. }
  20054. /**
  20055. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20056. * traversed objects.
  20057. *
  20058. * @private
  20059. * @param {*} value The value to clone.
  20060. * @param {boolean} bitmask The bitmask flags.
  20061. * 1 - Deep clone
  20062. * 2 - Flatten inherited properties
  20063. * 4 - Clone symbols
  20064. * @param {Function} [customizer] The function to customize cloning.
  20065. * @param {string} [key] The key of `value`.
  20066. * @param {Object} [object] The parent object of `value`.
  20067. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20068. * @returns {*} Returns the cloned value.
  20069. */
  20070. function baseClone(value, bitmask, customizer, key, object, stack) {
  20071. var result,
  20072. isDeep = bitmask & CLONE_DEEP_FLAG,
  20073. isFlat = bitmask & CLONE_FLAT_FLAG,
  20074. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20075. if (customizer) {
  20076. result = object ? customizer(value, key, object, stack) : customizer(value);
  20077. }
  20078. if (result !== undefined) {
  20079. return result;
  20080. }
  20081. if (!isObject(value)) {
  20082. return value;
  20083. }
  20084. var isArr = isArray(value);
  20085. if (isArr) {
  20086. result = initCloneArray(value);
  20087. if (!isDeep) {
  20088. return copyArray(value, result);
  20089. }
  20090. } else {
  20091. var tag = getTag(value),
  20092. isFunc = tag == funcTag || tag == genTag;
  20093. if (isBuffer(value)) {
  20094. return cloneBuffer(value, isDeep);
  20095. }
  20096. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20097. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20098. if (!isDeep) {
  20099. return isFlat
  20100. ? copySymbolsIn(value, baseAssignIn(result, value))
  20101. : copySymbols(value, baseAssign(result, value));
  20102. }
  20103. } else {
  20104. if (!cloneableTags[tag]) {
  20105. return object ? value : {};
  20106. }
  20107. result = initCloneByTag(value, tag, isDeep);
  20108. }
  20109. }
  20110. // Check for circular references and return its corresponding clone.
  20111. stack || (stack = new Stack);
  20112. var stacked = stack.get(value);
  20113. if (stacked) {
  20114. return stacked;
  20115. }
  20116. stack.set(value, result);
  20117. if (isSet(value)) {
  20118. value.forEach(function(subValue) {
  20119. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20120. });
  20121. } else if (isMap(value)) {
  20122. value.forEach(function(subValue, key) {
  20123. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20124. });
  20125. }
  20126. var keysFunc = isFull
  20127. ? (isFlat ? getAllKeysIn : getAllKeys)
  20128. : (isFlat ? keysIn : keys);
  20129. var props = isArr ? undefined : keysFunc(value);
  20130. arrayEach(props || value, function(subValue, key) {
  20131. if (props) {
  20132. key = subValue;
  20133. subValue = value[key];
  20134. }
  20135. // Recursively populate clone (susceptible to call stack limits).
  20136. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20137. });
  20138. return result;
  20139. }
  20140. /**
  20141. * The base implementation of `_.conforms` which doesn't clone `source`.
  20142. *
  20143. * @private
  20144. * @param {Object} source The object of property predicates to conform to.
  20145. * @returns {Function} Returns the new spec function.
  20146. */
  20147. function baseConforms(source) {
  20148. var props = keys(source);
  20149. return function(object) {
  20150. return baseConformsTo(object, source, props);
  20151. };
  20152. }
  20153. /**
  20154. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20155. *
  20156. * @private
  20157. * @param {Object} object The object to inspect.
  20158. * @param {Object} source The object of property predicates to conform to.
  20159. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20160. */
  20161. function baseConformsTo(object, source, props) {
  20162. var length = props.length;
  20163. if (object == null) {
  20164. return !length;
  20165. }
  20166. object = Object(object);
  20167. while (length--) {
  20168. var key = props[length],
  20169. predicate = source[key],
  20170. value = object[key];
  20171. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20172. return false;
  20173. }
  20174. }
  20175. return true;
  20176. }
  20177. /**
  20178. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20179. * to provide to `func`.
  20180. *
  20181. * @private
  20182. * @param {Function} func The function to delay.
  20183. * @param {number} wait The number of milliseconds to delay invocation.
  20184. * @param {Array} args The arguments to provide to `func`.
  20185. * @returns {number|Object} Returns the timer id or timeout object.
  20186. */
  20187. function baseDelay(func, wait, args) {
  20188. if (typeof func != 'function') {
  20189. throw new TypeError(FUNC_ERROR_TEXT);
  20190. }
  20191. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20192. }
  20193. /**
  20194. * The base implementation of methods like `_.difference` without support
  20195. * for excluding multiple arrays or iteratee shorthands.
  20196. *
  20197. * @private
  20198. * @param {Array} array The array to inspect.
  20199. * @param {Array} values The values to exclude.
  20200. * @param {Function} [iteratee] The iteratee invoked per element.
  20201. * @param {Function} [comparator] The comparator invoked per element.
  20202. * @returns {Array} Returns the new array of filtered values.
  20203. */
  20204. function baseDifference(array, values, iteratee, comparator) {
  20205. var index = -1,
  20206. includes = arrayIncludes,
  20207. isCommon = true,
  20208. length = array.length,
  20209. result = [],
  20210. valuesLength = values.length;
  20211. if (!length) {
  20212. return result;
  20213. }
  20214. if (iteratee) {
  20215. values = arrayMap(values, baseUnary(iteratee));
  20216. }
  20217. if (comparator) {
  20218. includes = arrayIncludesWith;
  20219. isCommon = false;
  20220. }
  20221. else if (values.length >= LARGE_ARRAY_SIZE) {
  20222. includes = cacheHas;
  20223. isCommon = false;
  20224. values = new SetCache(values);
  20225. }
  20226. outer:
  20227. while (++index < length) {
  20228. var value = array[index],
  20229. computed = iteratee == null ? value : iteratee(value);
  20230. value = (comparator || value !== 0) ? value : 0;
  20231. if (isCommon && computed === computed) {
  20232. var valuesIndex = valuesLength;
  20233. while (valuesIndex--) {
  20234. if (values[valuesIndex] === computed) {
  20235. continue outer;
  20236. }
  20237. }
  20238. result.push(value);
  20239. }
  20240. else if (!includes(values, computed, comparator)) {
  20241. result.push(value);
  20242. }
  20243. }
  20244. return result;
  20245. }
  20246. /**
  20247. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20248. *
  20249. * @private
  20250. * @param {Array|Object} collection The collection to iterate over.
  20251. * @param {Function} iteratee The function invoked per iteration.
  20252. * @returns {Array|Object} Returns `collection`.
  20253. */
  20254. var baseEach = createBaseEach(baseForOwn);
  20255. /**
  20256. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20257. *
  20258. * @private
  20259. * @param {Array|Object} collection The collection to iterate over.
  20260. * @param {Function} iteratee The function invoked per iteration.
  20261. * @returns {Array|Object} Returns `collection`.
  20262. */
  20263. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20264. /**
  20265. * The base implementation of `_.every` without support for iteratee shorthands.
  20266. *
  20267. * @private
  20268. * @param {Array|Object} collection The collection to iterate over.
  20269. * @param {Function} predicate The function invoked per iteration.
  20270. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20271. * else `false`
  20272. */
  20273. function baseEvery(collection, predicate) {
  20274. var result = true;
  20275. baseEach(collection, function(value, index, collection) {
  20276. result = !!predicate(value, index, collection);
  20277. return result;
  20278. });
  20279. return result;
  20280. }
  20281. /**
  20282. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20283. * `comparator` to determine the extremum value.
  20284. *
  20285. * @private
  20286. * @param {Array} array The array to iterate over.
  20287. * @param {Function} iteratee The iteratee invoked per iteration.
  20288. * @param {Function} comparator The comparator used to compare values.
  20289. * @returns {*} Returns the extremum value.
  20290. */
  20291. function baseExtremum(array, iteratee, comparator) {
  20292. var index = -1,
  20293. length = array.length;
  20294. while (++index < length) {
  20295. var value = array[index],
  20296. current = iteratee(value);
  20297. if (current != null && (computed === undefined
  20298. ? (current === current && !isSymbol(current))
  20299. : comparator(current, computed)
  20300. )) {
  20301. var computed = current,
  20302. result = value;
  20303. }
  20304. }
  20305. return result;
  20306. }
  20307. /**
  20308. * The base implementation of `_.fill` without an iteratee call guard.
  20309. *
  20310. * @private
  20311. * @param {Array} array The array to fill.
  20312. * @param {*} value The value to fill `array` with.
  20313. * @param {number} [start=0] The start position.
  20314. * @param {number} [end=array.length] The end position.
  20315. * @returns {Array} Returns `array`.
  20316. */
  20317. function baseFill(array, value, start, end) {
  20318. var length = array.length;
  20319. start = toInteger(start);
  20320. if (start < 0) {
  20321. start = -start > length ? 0 : (length + start);
  20322. }
  20323. end = (end === undefined || end > length) ? length : toInteger(end);
  20324. if (end < 0) {
  20325. end += length;
  20326. }
  20327. end = start > end ? 0 : toLength(end);
  20328. while (start < end) {
  20329. array[start++] = value;
  20330. }
  20331. return array;
  20332. }
  20333. /**
  20334. * The base implementation of `_.filter` without support for iteratee shorthands.
  20335. *
  20336. * @private
  20337. * @param {Array|Object} collection The collection to iterate over.
  20338. * @param {Function} predicate The function invoked per iteration.
  20339. * @returns {Array} Returns the new filtered array.
  20340. */
  20341. function baseFilter(collection, predicate) {
  20342. var result = [];
  20343. baseEach(collection, function(value, index, collection) {
  20344. if (predicate(value, index, collection)) {
  20345. result.push(value);
  20346. }
  20347. });
  20348. return result;
  20349. }
  20350. /**
  20351. * The base implementation of `_.flatten` with support for restricting flattening.
  20352. *
  20353. * @private
  20354. * @param {Array} array The array to flatten.
  20355. * @param {number} depth The maximum recursion depth.
  20356. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20357. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20358. * @param {Array} [result=[]] The initial result value.
  20359. * @returns {Array} Returns the new flattened array.
  20360. */
  20361. function baseFlatten(array, depth, predicate, isStrict, result) {
  20362. var index = -1,
  20363. length = array.length;
  20364. predicate || (predicate = isFlattenable);
  20365. result || (result = []);
  20366. while (++index < length) {
  20367. var value = array[index];
  20368. if (depth > 0 && predicate(value)) {
  20369. if (depth > 1) {
  20370. // Recursively flatten arrays (susceptible to call stack limits).
  20371. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20372. } else {
  20373. arrayPush(result, value);
  20374. }
  20375. } else if (!isStrict) {
  20376. result[result.length] = value;
  20377. }
  20378. }
  20379. return result;
  20380. }
  20381. /**
  20382. * The base implementation of `baseForOwn` which iterates over `object`
  20383. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20384. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20385. *
  20386. * @private
  20387. * @param {Object} object The object to iterate over.
  20388. * @param {Function} iteratee The function invoked per iteration.
  20389. * @param {Function} keysFunc The function to get the keys of `object`.
  20390. * @returns {Object} Returns `object`.
  20391. */
  20392. var baseFor = createBaseFor();
  20393. /**
  20394. * This function is like `baseFor` except that it iterates over properties
  20395. * in the opposite order.
  20396. *
  20397. * @private
  20398. * @param {Object} object The object to iterate over.
  20399. * @param {Function} iteratee The function invoked per iteration.
  20400. * @param {Function} keysFunc The function to get the keys of `object`.
  20401. * @returns {Object} Returns `object`.
  20402. */
  20403. var baseForRight = createBaseFor(true);
  20404. /**
  20405. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20406. *
  20407. * @private
  20408. * @param {Object} object The object to iterate over.
  20409. * @param {Function} iteratee The function invoked per iteration.
  20410. * @returns {Object} Returns `object`.
  20411. */
  20412. function baseForOwn(object, iteratee) {
  20413. return object && baseFor(object, iteratee, keys);
  20414. }
  20415. /**
  20416. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20417. *
  20418. * @private
  20419. * @param {Object} object The object to iterate over.
  20420. * @param {Function} iteratee The function invoked per iteration.
  20421. * @returns {Object} Returns `object`.
  20422. */
  20423. function baseForOwnRight(object, iteratee) {
  20424. return object && baseForRight(object, iteratee, keys);
  20425. }
  20426. /**
  20427. * The base implementation of `_.functions` which creates an array of
  20428. * `object` function property names filtered from `props`.
  20429. *
  20430. * @private
  20431. * @param {Object} object The object to inspect.
  20432. * @param {Array} props The property names to filter.
  20433. * @returns {Array} Returns the function names.
  20434. */
  20435. function baseFunctions(object, props) {
  20436. return arrayFilter(props, function(key) {
  20437. return isFunction(object[key]);
  20438. });
  20439. }
  20440. /**
  20441. * The base implementation of `_.get` without support for default values.
  20442. *
  20443. * @private
  20444. * @param {Object} object The object to query.
  20445. * @param {Array|string} path The path of the property to get.
  20446. * @returns {*} Returns the resolved value.
  20447. */
  20448. function baseGet(object, path) {
  20449. path = castPath(path, object);
  20450. var index = 0,
  20451. length = path.length;
  20452. while (object != null && index < length) {
  20453. object = object[toKey(path[index++])];
  20454. }
  20455. return (index && index == length) ? object : undefined;
  20456. }
  20457. /**
  20458. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20459. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20460. * symbols of `object`.
  20461. *
  20462. * @private
  20463. * @param {Object} object The object to query.
  20464. * @param {Function} keysFunc The function to get the keys of `object`.
  20465. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20466. * @returns {Array} Returns the array of property names and symbols.
  20467. */
  20468. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20469. var result = keysFunc(object);
  20470. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20471. }
  20472. /**
  20473. * The base implementation of `getTag` without fallbacks for buggy environments.
  20474. *
  20475. * @private
  20476. * @param {*} value The value to query.
  20477. * @returns {string} Returns the `toStringTag`.
  20478. */
  20479. function baseGetTag(value) {
  20480. if (value == null) {
  20481. return value === undefined ? undefinedTag : nullTag;
  20482. }
  20483. return (symToStringTag && symToStringTag in Object(value))
  20484. ? getRawTag(value)
  20485. : objectToString(value);
  20486. }
  20487. /**
  20488. * The base implementation of `_.gt` which doesn't coerce arguments.
  20489. *
  20490. * @private
  20491. * @param {*} value The value to compare.
  20492. * @param {*} other The other value to compare.
  20493. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20494. * else `false`.
  20495. */
  20496. function baseGt(value, other) {
  20497. return value > other;
  20498. }
  20499. /**
  20500. * The base implementation of `_.has` without support for deep paths.
  20501. *
  20502. * @private
  20503. * @param {Object} [object] The object to query.
  20504. * @param {Array|string} key The key to check.
  20505. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20506. */
  20507. function baseHas(object, key) {
  20508. return object != null && hasOwnProperty.call(object, key);
  20509. }
  20510. /**
  20511. * The base implementation of `_.hasIn` without support for deep paths.
  20512. *
  20513. * @private
  20514. * @param {Object} [object] The object to query.
  20515. * @param {Array|string} key The key to check.
  20516. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20517. */
  20518. function baseHasIn(object, key) {
  20519. return object != null && key in Object(object);
  20520. }
  20521. /**
  20522. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20523. *
  20524. * @private
  20525. * @param {number} number The number to check.
  20526. * @param {number} start The start of the range.
  20527. * @param {number} end The end of the range.
  20528. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20529. */
  20530. function baseInRange(number, start, end) {
  20531. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20532. }
  20533. /**
  20534. * The base implementation of methods like `_.intersection`, without support
  20535. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20536. *
  20537. * @private
  20538. * @param {Array} arrays The arrays to inspect.
  20539. * @param {Function} [iteratee] The iteratee invoked per element.
  20540. * @param {Function} [comparator] The comparator invoked per element.
  20541. * @returns {Array} Returns the new array of shared values.
  20542. */
  20543. function baseIntersection(arrays, iteratee, comparator) {
  20544. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20545. length = arrays[0].length,
  20546. othLength = arrays.length,
  20547. othIndex = othLength,
  20548. caches = Array(othLength),
  20549. maxLength = Infinity,
  20550. result = [];
  20551. while (othIndex--) {
  20552. var array = arrays[othIndex];
  20553. if (othIndex && iteratee) {
  20554. array = arrayMap(array, baseUnary(iteratee));
  20555. }
  20556. maxLength = nativeMin(array.length, maxLength);
  20557. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20558. ? new SetCache(othIndex && array)
  20559. : undefined;
  20560. }
  20561. array = arrays[0];
  20562. var index = -1,
  20563. seen = caches[0];
  20564. outer:
  20565. while (++index < length && result.length < maxLength) {
  20566. var value = array[index],
  20567. computed = iteratee ? iteratee(value) : value;
  20568. value = (comparator || value !== 0) ? value : 0;
  20569. if (!(seen
  20570. ? cacheHas(seen, computed)
  20571. : includes(result, computed, comparator)
  20572. )) {
  20573. othIndex = othLength;
  20574. while (--othIndex) {
  20575. var cache = caches[othIndex];
  20576. if (!(cache
  20577. ? cacheHas(cache, computed)
  20578. : includes(arrays[othIndex], computed, comparator))
  20579. ) {
  20580. continue outer;
  20581. }
  20582. }
  20583. if (seen) {
  20584. seen.push(computed);
  20585. }
  20586. result.push(value);
  20587. }
  20588. }
  20589. return result;
  20590. }
  20591. /**
  20592. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20593. * `object` with values transformed by `iteratee` and set by `setter`.
  20594. *
  20595. * @private
  20596. * @param {Object} object The object to iterate over.
  20597. * @param {Function} setter The function to set `accumulator` values.
  20598. * @param {Function} iteratee The iteratee to transform values.
  20599. * @param {Object} accumulator The initial inverted object.
  20600. * @returns {Function} Returns `accumulator`.
  20601. */
  20602. function baseInverter(object, setter, iteratee, accumulator) {
  20603. baseForOwn(object, function(value, key, object) {
  20604. setter(accumulator, iteratee(value), key, object);
  20605. });
  20606. return accumulator;
  20607. }
  20608. /**
  20609. * The base implementation of `_.invoke` without support for individual
  20610. * method arguments.
  20611. *
  20612. * @private
  20613. * @param {Object} object The object to query.
  20614. * @param {Array|string} path The path of the method to invoke.
  20615. * @param {Array} args The arguments to invoke the method with.
  20616. * @returns {*} Returns the result of the invoked method.
  20617. */
  20618. function baseInvoke(object, path, args) {
  20619. path = castPath(path, object);
  20620. object = parent(object, path);
  20621. var func = object == null ? object : object[toKey(last(path))];
  20622. return func == null ? undefined : apply(func, object, args);
  20623. }
  20624. /**
  20625. * The base implementation of `_.isArguments`.
  20626. *
  20627. * @private
  20628. * @param {*} value The value to check.
  20629. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20630. */
  20631. function baseIsArguments(value) {
  20632. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20633. }
  20634. /**
  20635. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20636. *
  20637. * @private
  20638. * @param {*} value The value to check.
  20639. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20640. */
  20641. function baseIsArrayBuffer(value) {
  20642. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20643. }
  20644. /**
  20645. * The base implementation of `_.isDate` without Node.js optimizations.
  20646. *
  20647. * @private
  20648. * @param {*} value The value to check.
  20649. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20650. */
  20651. function baseIsDate(value) {
  20652. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20653. }
  20654. /**
  20655. * The base implementation of `_.isEqual` which supports partial comparisons
  20656. * and tracks traversed objects.
  20657. *
  20658. * @private
  20659. * @param {*} value The value to compare.
  20660. * @param {*} other The other value to compare.
  20661. * @param {boolean} bitmask The bitmask flags.
  20662. * 1 - Unordered comparison
  20663. * 2 - Partial comparison
  20664. * @param {Function} [customizer] The function to customize comparisons.
  20665. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20666. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20667. */
  20668. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20669. if (value === other) {
  20670. return true;
  20671. }
  20672. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20673. return value !== value && other !== other;
  20674. }
  20675. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20676. }
  20677. /**
  20678. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20679. * deep comparisons and tracks traversed objects enabling objects with circular
  20680. * references to be compared.
  20681. *
  20682. * @private
  20683. * @param {Object} object The object to compare.
  20684. * @param {Object} other The other object to compare.
  20685. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20686. * @param {Function} customizer The function to customize comparisons.
  20687. * @param {Function} equalFunc The function to determine equivalents of values.
  20688. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20689. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20690. */
  20691. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20692. var objIsArr = isArray(object),
  20693. othIsArr = isArray(other),
  20694. objTag = objIsArr ? arrayTag : getTag(object),
  20695. othTag = othIsArr ? arrayTag : getTag(other);
  20696. objTag = objTag == argsTag ? objectTag : objTag;
  20697. othTag = othTag == argsTag ? objectTag : othTag;
  20698. var objIsObj = objTag == objectTag,
  20699. othIsObj = othTag == objectTag,
  20700. isSameTag = objTag == othTag;
  20701. if (isSameTag && isBuffer(object)) {
  20702. if (!isBuffer(other)) {
  20703. return false;
  20704. }
  20705. objIsArr = true;
  20706. objIsObj = false;
  20707. }
  20708. if (isSameTag && !objIsObj) {
  20709. stack || (stack = new Stack);
  20710. return (objIsArr || isTypedArray(object))
  20711. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  20712. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  20713. }
  20714. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  20715. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  20716. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  20717. if (objIsWrapped || othIsWrapped) {
  20718. var objUnwrapped = objIsWrapped ? object.value() : object,
  20719. othUnwrapped = othIsWrapped ? other.value() : other;
  20720. stack || (stack = new Stack);
  20721. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  20722. }
  20723. }
  20724. if (!isSameTag) {
  20725. return false;
  20726. }
  20727. stack || (stack = new Stack);
  20728. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  20729. }
  20730. /**
  20731. * The base implementation of `_.isMap` without Node.js optimizations.
  20732. *
  20733. * @private
  20734. * @param {*} value The value to check.
  20735. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  20736. */
  20737. function baseIsMap(value) {
  20738. return isObjectLike(value) && getTag(value) == mapTag;
  20739. }
  20740. /**
  20741. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  20742. *
  20743. * @private
  20744. * @param {Object} object The object to inspect.
  20745. * @param {Object} source The object of property values to match.
  20746. * @param {Array} matchData The property names, values, and compare flags to match.
  20747. * @param {Function} [customizer] The function to customize comparisons.
  20748. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  20749. */
  20750. function baseIsMatch(object, source, matchData, customizer) {
  20751. var index = matchData.length,
  20752. length = index,
  20753. noCustomizer = !customizer;
  20754. if (object == null) {
  20755. return !length;
  20756. }
  20757. object = Object(object);
  20758. while (index--) {
  20759. var data = matchData[index];
  20760. if ((noCustomizer && data[2])
  20761. ? data[1] !== object[data[0]]
  20762. : !(data[0] in object)
  20763. ) {
  20764. return false;
  20765. }
  20766. }
  20767. while (++index < length) {
  20768. data = matchData[index];
  20769. var key = data[0],
  20770. objValue = object[key],
  20771. srcValue = data[1];
  20772. if (noCustomizer && data[2]) {
  20773. if (objValue === undefined && !(key in object)) {
  20774. return false;
  20775. }
  20776. } else {
  20777. var stack = new Stack;
  20778. if (customizer) {
  20779. var result = customizer(objValue, srcValue, key, object, source, stack);
  20780. }
  20781. if (!(result === undefined
  20782. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  20783. : result
  20784. )) {
  20785. return false;
  20786. }
  20787. }
  20788. }
  20789. return true;
  20790. }
  20791. /**
  20792. * The base implementation of `_.isNative` without bad shim checks.
  20793. *
  20794. * @private
  20795. * @param {*} value The value to check.
  20796. * @returns {boolean} Returns `true` if `value` is a native function,
  20797. * else `false`.
  20798. */
  20799. function baseIsNative(value) {
  20800. if (!isObject(value) || isMasked(value)) {
  20801. return false;
  20802. }
  20803. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  20804. return pattern.test(toSource(value));
  20805. }
  20806. /**
  20807. * The base implementation of `_.isRegExp` without Node.js optimizations.
  20808. *
  20809. * @private
  20810. * @param {*} value The value to check.
  20811. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  20812. */
  20813. function baseIsRegExp(value) {
  20814. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  20815. }
  20816. /**
  20817. * The base implementation of `_.isSet` without Node.js optimizations.
  20818. *
  20819. * @private
  20820. * @param {*} value The value to check.
  20821. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  20822. */
  20823. function baseIsSet(value) {
  20824. return isObjectLike(value) && getTag(value) == setTag;
  20825. }
  20826. /**
  20827. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  20828. *
  20829. * @private
  20830. * @param {*} value The value to check.
  20831. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  20832. */
  20833. function baseIsTypedArray(value) {
  20834. return isObjectLike(value) &&
  20835. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  20836. }
  20837. /**
  20838. * The base implementation of `_.iteratee`.
  20839. *
  20840. * @private
  20841. * @param {*} [value=_.identity] The value to convert to an iteratee.
  20842. * @returns {Function} Returns the iteratee.
  20843. */
  20844. function baseIteratee(value) {
  20845. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  20846. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  20847. if (typeof value == 'function') {
  20848. return value;
  20849. }
  20850. if (value == null) {
  20851. return identity;
  20852. }
  20853. if (typeof value == 'object') {
  20854. return isArray(value)
  20855. ? baseMatchesProperty(value[0], value[1])
  20856. : baseMatches(value);
  20857. }
  20858. return property(value);
  20859. }
  20860. /**
  20861. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  20862. *
  20863. * @private
  20864. * @param {Object} object The object to query.
  20865. * @returns {Array} Returns the array of property names.
  20866. */
  20867. function baseKeys(object) {
  20868. if (!isPrototype(object)) {
  20869. return nativeKeys(object);
  20870. }
  20871. var result = [];
  20872. for (var key in Object(object)) {
  20873. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  20874. result.push(key);
  20875. }
  20876. }
  20877. return result;
  20878. }
  20879. /**
  20880. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  20881. *
  20882. * @private
  20883. * @param {Object} object The object to query.
  20884. * @returns {Array} Returns the array of property names.
  20885. */
  20886. function baseKeysIn(object) {
  20887. if (!isObject(object)) {
  20888. return nativeKeysIn(object);
  20889. }
  20890. var isProto = isPrototype(object),
  20891. result = [];
  20892. for (var key in object) {
  20893. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  20894. result.push(key);
  20895. }
  20896. }
  20897. return result;
  20898. }
  20899. /**
  20900. * The base implementation of `_.lt` which doesn't coerce arguments.
  20901. *
  20902. * @private
  20903. * @param {*} value The value to compare.
  20904. * @param {*} other The other value to compare.
  20905. * @returns {boolean} Returns `true` if `value` is less than `other`,
  20906. * else `false`.
  20907. */
  20908. function baseLt(value, other) {
  20909. return value < other;
  20910. }
  20911. /**
  20912. * The base implementation of `_.map` without support for iteratee shorthands.
  20913. *
  20914. * @private
  20915. * @param {Array|Object} collection The collection to iterate over.
  20916. * @param {Function} iteratee The function invoked per iteration.
  20917. * @returns {Array} Returns the new mapped array.
  20918. */
  20919. function baseMap(collection, iteratee) {
  20920. var index = -1,
  20921. result = isArrayLike(collection) ? Array(collection.length) : [];
  20922. baseEach(collection, function(value, key, collection) {
  20923. result[++index] = iteratee(value, key, collection);
  20924. });
  20925. return result;
  20926. }
  20927. /**
  20928. * The base implementation of `_.matches` which doesn't clone `source`.
  20929. *
  20930. * @private
  20931. * @param {Object} source The object of property values to match.
  20932. * @returns {Function} Returns the new spec function.
  20933. */
  20934. function baseMatches(source) {
  20935. var matchData = getMatchData(source);
  20936. if (matchData.length == 1 && matchData[0][2]) {
  20937. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  20938. }
  20939. return function(object) {
  20940. return object === source || baseIsMatch(object, source, matchData);
  20941. };
  20942. }
  20943. /**
  20944. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  20945. *
  20946. * @private
  20947. * @param {string} path The path of the property to get.
  20948. * @param {*} srcValue The value to match.
  20949. * @returns {Function} Returns the new spec function.
  20950. */
  20951. function baseMatchesProperty(path, srcValue) {
  20952. if (isKey(path) && isStrictComparable(srcValue)) {
  20953. return matchesStrictComparable(toKey(path), srcValue);
  20954. }
  20955. return function(object) {
  20956. var objValue = get(object, path);
  20957. return (objValue === undefined && objValue === srcValue)
  20958. ? hasIn(object, path)
  20959. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  20960. };
  20961. }
  20962. /**
  20963. * The base implementation of `_.merge` without support for multiple sources.
  20964. *
  20965. * @private
  20966. * @param {Object} object The destination object.
  20967. * @param {Object} source The source object.
  20968. * @param {number} srcIndex The index of `source`.
  20969. * @param {Function} [customizer] The function to customize merged values.
  20970. * @param {Object} [stack] Tracks traversed source values and their merged
  20971. * counterparts.
  20972. */
  20973. function baseMerge(object, source, srcIndex, customizer, stack) {
  20974. if (object === source) {
  20975. return;
  20976. }
  20977. baseFor(source, function(srcValue, key) {
  20978. stack || (stack = new Stack);
  20979. if (isObject(srcValue)) {
  20980. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  20981. }
  20982. else {
  20983. var newValue = customizer
  20984. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  20985. : undefined;
  20986. if (newValue === undefined) {
  20987. newValue = srcValue;
  20988. }
  20989. assignMergeValue(object, key, newValue);
  20990. }
  20991. }, keysIn);
  20992. }
  20993. /**
  20994. * A specialized version of `baseMerge` for arrays and objects which performs
  20995. * deep merges and tracks traversed objects enabling objects with circular
  20996. * references to be merged.
  20997. *
  20998. * @private
  20999. * @param {Object} object The destination object.
  21000. * @param {Object} source The source object.
  21001. * @param {string} key The key of the value to merge.
  21002. * @param {number} srcIndex The index of `source`.
  21003. * @param {Function} mergeFunc The function to merge values.
  21004. * @param {Function} [customizer] The function to customize assigned values.
  21005. * @param {Object} [stack] Tracks traversed source values and their merged
  21006. * counterparts.
  21007. */
  21008. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21009. var objValue = safeGet(object, key),
  21010. srcValue = safeGet(source, key),
  21011. stacked = stack.get(srcValue);
  21012. if (stacked) {
  21013. assignMergeValue(object, key, stacked);
  21014. return;
  21015. }
  21016. var newValue = customizer
  21017. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21018. : undefined;
  21019. var isCommon = newValue === undefined;
  21020. if (isCommon) {
  21021. var isArr = isArray(srcValue),
  21022. isBuff = !isArr && isBuffer(srcValue),
  21023. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21024. newValue = srcValue;
  21025. if (isArr || isBuff || isTyped) {
  21026. if (isArray(objValue)) {
  21027. newValue = objValue;
  21028. }
  21029. else if (isArrayLikeObject(objValue)) {
  21030. newValue = copyArray(objValue);
  21031. }
  21032. else if (isBuff) {
  21033. isCommon = false;
  21034. newValue = cloneBuffer(srcValue, true);
  21035. }
  21036. else if (isTyped) {
  21037. isCommon = false;
  21038. newValue = cloneTypedArray(srcValue, true);
  21039. }
  21040. else {
  21041. newValue = [];
  21042. }
  21043. }
  21044. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21045. newValue = objValue;
  21046. if (isArguments(objValue)) {
  21047. newValue = toPlainObject(objValue);
  21048. }
  21049. else if (!isObject(objValue) || isFunction(objValue)) {
  21050. newValue = initCloneObject(srcValue);
  21051. }
  21052. }
  21053. else {
  21054. isCommon = false;
  21055. }
  21056. }
  21057. if (isCommon) {
  21058. // Recursively merge objects and arrays (susceptible to call stack limits).
  21059. stack.set(srcValue, newValue);
  21060. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21061. stack['delete'](srcValue);
  21062. }
  21063. assignMergeValue(object, key, newValue);
  21064. }
  21065. /**
  21066. * The base implementation of `_.nth` which doesn't coerce arguments.
  21067. *
  21068. * @private
  21069. * @param {Array} array The array to query.
  21070. * @param {number} n The index of the element to return.
  21071. * @returns {*} Returns the nth element of `array`.
  21072. */
  21073. function baseNth(array, n) {
  21074. var length = array.length;
  21075. if (!length) {
  21076. return;
  21077. }
  21078. n += n < 0 ? length : 0;
  21079. return isIndex(n, length) ? array[n] : undefined;
  21080. }
  21081. /**
  21082. * The base implementation of `_.orderBy` without param guards.
  21083. *
  21084. * @private
  21085. * @param {Array|Object} collection The collection to iterate over.
  21086. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21087. * @param {string[]} orders The sort orders of `iteratees`.
  21088. * @returns {Array} Returns the new sorted array.
  21089. */
  21090. function baseOrderBy(collection, iteratees, orders) {
  21091. var index = -1;
  21092. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21093. var result = baseMap(collection, function(value, key, collection) {
  21094. var criteria = arrayMap(iteratees, function(iteratee) {
  21095. return iteratee(value);
  21096. });
  21097. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21098. });
  21099. return baseSortBy(result, function(object, other) {
  21100. return compareMultiple(object, other, orders);
  21101. });
  21102. }
  21103. /**
  21104. * The base implementation of `_.pick` without support for individual
  21105. * property identifiers.
  21106. *
  21107. * @private
  21108. * @param {Object} object The source object.
  21109. * @param {string[]} paths The property paths to pick.
  21110. * @returns {Object} Returns the new object.
  21111. */
  21112. function basePick(object, paths) {
  21113. return basePickBy(object, paths, function(value, path) {
  21114. return hasIn(object, path);
  21115. });
  21116. }
  21117. /**
  21118. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21119. *
  21120. * @private
  21121. * @param {Object} object The source object.
  21122. * @param {string[]} paths The property paths to pick.
  21123. * @param {Function} predicate The function invoked per property.
  21124. * @returns {Object} Returns the new object.
  21125. */
  21126. function basePickBy(object, paths, predicate) {
  21127. var index = -1,
  21128. length = paths.length,
  21129. result = {};
  21130. while (++index < length) {
  21131. var path = paths[index],
  21132. value = baseGet(object, path);
  21133. if (predicate(value, path)) {
  21134. baseSet(result, castPath(path, object), value);
  21135. }
  21136. }
  21137. return result;
  21138. }
  21139. /**
  21140. * A specialized version of `baseProperty` which supports deep paths.
  21141. *
  21142. * @private
  21143. * @param {Array|string} path The path of the property to get.
  21144. * @returns {Function} Returns the new accessor function.
  21145. */
  21146. function basePropertyDeep(path) {
  21147. return function(object) {
  21148. return baseGet(object, path);
  21149. };
  21150. }
  21151. /**
  21152. * The base implementation of `_.pullAllBy` without support for iteratee
  21153. * shorthands.
  21154. *
  21155. * @private
  21156. * @param {Array} array The array to modify.
  21157. * @param {Array} values The values to remove.
  21158. * @param {Function} [iteratee] The iteratee invoked per element.
  21159. * @param {Function} [comparator] The comparator invoked per element.
  21160. * @returns {Array} Returns `array`.
  21161. */
  21162. function basePullAll(array, values, iteratee, comparator) {
  21163. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21164. index = -1,
  21165. length = values.length,
  21166. seen = array;
  21167. if (array === values) {
  21168. values = copyArray(values);
  21169. }
  21170. if (iteratee) {
  21171. seen = arrayMap(array, baseUnary(iteratee));
  21172. }
  21173. while (++index < length) {
  21174. var fromIndex = 0,
  21175. value = values[index],
  21176. computed = iteratee ? iteratee(value) : value;
  21177. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21178. if (seen !== array) {
  21179. splice.call(seen, fromIndex, 1);
  21180. }
  21181. splice.call(array, fromIndex, 1);
  21182. }
  21183. }
  21184. return array;
  21185. }
  21186. /**
  21187. * The base implementation of `_.pullAt` without support for individual
  21188. * indexes or capturing the removed elements.
  21189. *
  21190. * @private
  21191. * @param {Array} array The array to modify.
  21192. * @param {number[]} indexes The indexes of elements to remove.
  21193. * @returns {Array} Returns `array`.
  21194. */
  21195. function basePullAt(array, indexes) {
  21196. var length = array ? indexes.length : 0,
  21197. lastIndex = length - 1;
  21198. while (length--) {
  21199. var index = indexes[length];
  21200. if (length == lastIndex || index !== previous) {
  21201. var previous = index;
  21202. if (isIndex(index)) {
  21203. splice.call(array, index, 1);
  21204. } else {
  21205. baseUnset(array, index);
  21206. }
  21207. }
  21208. }
  21209. return array;
  21210. }
  21211. /**
  21212. * The base implementation of `_.random` without support for returning
  21213. * floating-point numbers.
  21214. *
  21215. * @private
  21216. * @param {number} lower The lower bound.
  21217. * @param {number} upper The upper bound.
  21218. * @returns {number} Returns the random number.
  21219. */
  21220. function baseRandom(lower, upper) {
  21221. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21222. }
  21223. /**
  21224. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21225. * coerce arguments.
  21226. *
  21227. * @private
  21228. * @param {number} start The start of the range.
  21229. * @param {number} end The end of the range.
  21230. * @param {number} step The value to increment or decrement by.
  21231. * @param {boolean} [fromRight] Specify iterating from right to left.
  21232. * @returns {Array} Returns the range of numbers.
  21233. */
  21234. function baseRange(start, end, step, fromRight) {
  21235. var index = -1,
  21236. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21237. result = Array(length);
  21238. while (length--) {
  21239. result[fromRight ? length : ++index] = start;
  21240. start += step;
  21241. }
  21242. return result;
  21243. }
  21244. /**
  21245. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21246. *
  21247. * @private
  21248. * @param {string} string The string to repeat.
  21249. * @param {number} n The number of times to repeat the string.
  21250. * @returns {string} Returns the repeated string.
  21251. */
  21252. function baseRepeat(string, n) {
  21253. var result = '';
  21254. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21255. return result;
  21256. }
  21257. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21258. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21259. do {
  21260. if (n % 2) {
  21261. result += string;
  21262. }
  21263. n = nativeFloor(n / 2);
  21264. if (n) {
  21265. string += string;
  21266. }
  21267. } while (n);
  21268. return result;
  21269. }
  21270. /**
  21271. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21272. *
  21273. * @private
  21274. * @param {Function} func The function to apply a rest parameter to.
  21275. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21276. * @returns {Function} Returns the new function.
  21277. */
  21278. function baseRest(func, start) {
  21279. return setToString(overRest(func, start, identity), func + '');
  21280. }
  21281. /**
  21282. * The base implementation of `_.sample`.
  21283. *
  21284. * @private
  21285. * @param {Array|Object} collection The collection to sample.
  21286. * @returns {*} Returns the random element.
  21287. */
  21288. function baseSample(collection) {
  21289. return arraySample(values(collection));
  21290. }
  21291. /**
  21292. * The base implementation of `_.sampleSize` without param guards.
  21293. *
  21294. * @private
  21295. * @param {Array|Object} collection The collection to sample.
  21296. * @param {number} n The number of elements to sample.
  21297. * @returns {Array} Returns the random elements.
  21298. */
  21299. function baseSampleSize(collection, n) {
  21300. var array = values(collection);
  21301. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21302. }
  21303. /**
  21304. * The base implementation of `_.set`.
  21305. *
  21306. * @private
  21307. * @param {Object} object The object to modify.
  21308. * @param {Array|string} path The path of the property to set.
  21309. * @param {*} value The value to set.
  21310. * @param {Function} [customizer] The function to customize path creation.
  21311. * @returns {Object} Returns `object`.
  21312. */
  21313. function baseSet(object, path, value, customizer) {
  21314. if (!isObject(object)) {
  21315. return object;
  21316. }
  21317. path = castPath(path, object);
  21318. var index = -1,
  21319. length = path.length,
  21320. lastIndex = length - 1,
  21321. nested = object;
  21322. while (nested != null && ++index < length) {
  21323. var key = toKey(path[index]),
  21324. newValue = value;
  21325. if (index != lastIndex) {
  21326. var objValue = nested[key];
  21327. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21328. if (newValue === undefined) {
  21329. newValue = isObject(objValue)
  21330. ? objValue
  21331. : (isIndex(path[index + 1]) ? [] : {});
  21332. }
  21333. }
  21334. assignValue(nested, key, newValue);
  21335. nested = nested[key];
  21336. }
  21337. return object;
  21338. }
  21339. /**
  21340. * The base implementation of `setData` without support for hot loop shorting.
  21341. *
  21342. * @private
  21343. * @param {Function} func The function to associate metadata with.
  21344. * @param {*} data The metadata.
  21345. * @returns {Function} Returns `func`.
  21346. */
  21347. var baseSetData = !metaMap ? identity : function(func, data) {
  21348. metaMap.set(func, data);
  21349. return func;
  21350. };
  21351. /**
  21352. * The base implementation of `setToString` without support for hot loop shorting.
  21353. *
  21354. * @private
  21355. * @param {Function} func The function to modify.
  21356. * @param {Function} string The `toString` result.
  21357. * @returns {Function} Returns `func`.
  21358. */
  21359. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21360. return defineProperty(func, 'toString', {
  21361. 'configurable': true,
  21362. 'enumerable': false,
  21363. 'value': constant(string),
  21364. 'writable': true
  21365. });
  21366. };
  21367. /**
  21368. * The base implementation of `_.shuffle`.
  21369. *
  21370. * @private
  21371. * @param {Array|Object} collection The collection to shuffle.
  21372. * @returns {Array} Returns the new shuffled array.
  21373. */
  21374. function baseShuffle(collection) {
  21375. return shuffleSelf(values(collection));
  21376. }
  21377. /**
  21378. * The base implementation of `_.slice` without an iteratee call guard.
  21379. *
  21380. * @private
  21381. * @param {Array} array The array to slice.
  21382. * @param {number} [start=0] The start position.
  21383. * @param {number} [end=array.length] The end position.
  21384. * @returns {Array} Returns the slice of `array`.
  21385. */
  21386. function baseSlice(array, start, end) {
  21387. var index = -1,
  21388. length = array.length;
  21389. if (start < 0) {
  21390. start = -start > length ? 0 : (length + start);
  21391. }
  21392. end = end > length ? length : end;
  21393. if (end < 0) {
  21394. end += length;
  21395. }
  21396. length = start > end ? 0 : ((end - start) >>> 0);
  21397. start >>>= 0;
  21398. var result = Array(length);
  21399. while (++index < length) {
  21400. result[index] = array[index + start];
  21401. }
  21402. return result;
  21403. }
  21404. /**
  21405. * The base implementation of `_.some` without support for iteratee shorthands.
  21406. *
  21407. * @private
  21408. * @param {Array|Object} collection The collection to iterate over.
  21409. * @param {Function} predicate The function invoked per iteration.
  21410. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21411. * else `false`.
  21412. */
  21413. function baseSome(collection, predicate) {
  21414. var result;
  21415. baseEach(collection, function(value, index, collection) {
  21416. result = predicate(value, index, collection);
  21417. return !result;
  21418. });
  21419. return !!result;
  21420. }
  21421. /**
  21422. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21423. * performs a binary search of `array` to determine the index at which `value`
  21424. * should be inserted into `array` in order to maintain its sort order.
  21425. *
  21426. * @private
  21427. * @param {Array} array The sorted array to inspect.
  21428. * @param {*} value The value to evaluate.
  21429. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21430. * @returns {number} Returns the index at which `value` should be inserted
  21431. * into `array`.
  21432. */
  21433. function baseSortedIndex(array, value, retHighest) {
  21434. var low = 0,
  21435. high = array == null ? low : array.length;
  21436. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21437. while (low < high) {
  21438. var mid = (low + high) >>> 1,
  21439. computed = array[mid];
  21440. if (computed !== null && !isSymbol(computed) &&
  21441. (retHighest ? (computed <= value) : (computed < value))) {
  21442. low = mid + 1;
  21443. } else {
  21444. high = mid;
  21445. }
  21446. }
  21447. return high;
  21448. }
  21449. return baseSortedIndexBy(array, value, identity, retHighest);
  21450. }
  21451. /**
  21452. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21453. * which invokes `iteratee` for `value` and each element of `array` to compute
  21454. * their sort ranking. The iteratee is invoked with one argument; (value).
  21455. *
  21456. * @private
  21457. * @param {Array} array The sorted array to inspect.
  21458. * @param {*} value The value to evaluate.
  21459. * @param {Function} iteratee The iteratee invoked per element.
  21460. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21461. * @returns {number} Returns the index at which `value` should be inserted
  21462. * into `array`.
  21463. */
  21464. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21465. value = iteratee(value);
  21466. var low = 0,
  21467. high = array == null ? 0 : array.length,
  21468. valIsNaN = value !== value,
  21469. valIsNull = value === null,
  21470. valIsSymbol = isSymbol(value),
  21471. valIsUndefined = value === undefined;
  21472. while (low < high) {
  21473. var mid = nativeFloor((low + high) / 2),
  21474. computed = iteratee(array[mid]),
  21475. othIsDefined = computed !== undefined,
  21476. othIsNull = computed === null,
  21477. othIsReflexive = computed === computed,
  21478. othIsSymbol = isSymbol(computed);
  21479. if (valIsNaN) {
  21480. var setLow = retHighest || othIsReflexive;
  21481. } else if (valIsUndefined) {
  21482. setLow = othIsReflexive && (retHighest || othIsDefined);
  21483. } else if (valIsNull) {
  21484. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21485. } else if (valIsSymbol) {
  21486. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21487. } else if (othIsNull || othIsSymbol) {
  21488. setLow = false;
  21489. } else {
  21490. setLow = retHighest ? (computed <= value) : (computed < value);
  21491. }
  21492. if (setLow) {
  21493. low = mid + 1;
  21494. } else {
  21495. high = mid;
  21496. }
  21497. }
  21498. return nativeMin(high, MAX_ARRAY_INDEX);
  21499. }
  21500. /**
  21501. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21502. * support for iteratee shorthands.
  21503. *
  21504. * @private
  21505. * @param {Array} array The array to inspect.
  21506. * @param {Function} [iteratee] The iteratee invoked per element.
  21507. * @returns {Array} Returns the new duplicate free array.
  21508. */
  21509. function baseSortedUniq(array, iteratee) {
  21510. var index = -1,
  21511. length = array.length,
  21512. resIndex = 0,
  21513. result = [];
  21514. while (++index < length) {
  21515. var value = array[index],
  21516. computed = iteratee ? iteratee(value) : value;
  21517. if (!index || !eq(computed, seen)) {
  21518. var seen = computed;
  21519. result[resIndex++] = value === 0 ? 0 : value;
  21520. }
  21521. }
  21522. return result;
  21523. }
  21524. /**
  21525. * The base implementation of `_.toNumber` which doesn't ensure correct
  21526. * conversions of binary, hexadecimal, or octal string values.
  21527. *
  21528. * @private
  21529. * @param {*} value The value to process.
  21530. * @returns {number} Returns the number.
  21531. */
  21532. function baseToNumber(value) {
  21533. if (typeof value == 'number') {
  21534. return value;
  21535. }
  21536. if (isSymbol(value)) {
  21537. return NAN;
  21538. }
  21539. return +value;
  21540. }
  21541. /**
  21542. * The base implementation of `_.toString` which doesn't convert nullish
  21543. * values to empty strings.
  21544. *
  21545. * @private
  21546. * @param {*} value The value to process.
  21547. * @returns {string} Returns the string.
  21548. */
  21549. function baseToString(value) {
  21550. // Exit early for strings to avoid a performance hit in some environments.
  21551. if (typeof value == 'string') {
  21552. return value;
  21553. }
  21554. if (isArray(value)) {
  21555. // Recursively convert values (susceptible to call stack limits).
  21556. return arrayMap(value, baseToString) + '';
  21557. }
  21558. if (isSymbol(value)) {
  21559. return symbolToString ? symbolToString.call(value) : '';
  21560. }
  21561. var result = (value + '');
  21562. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21563. }
  21564. /**
  21565. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21566. *
  21567. * @private
  21568. * @param {Array} array The array to inspect.
  21569. * @param {Function} [iteratee] The iteratee invoked per element.
  21570. * @param {Function} [comparator] The comparator invoked per element.
  21571. * @returns {Array} Returns the new duplicate free array.
  21572. */
  21573. function baseUniq(array, iteratee, comparator) {
  21574. var index = -1,
  21575. includes = arrayIncludes,
  21576. length = array.length,
  21577. isCommon = true,
  21578. result = [],
  21579. seen = result;
  21580. if (comparator) {
  21581. isCommon = false;
  21582. includes = arrayIncludesWith;
  21583. }
  21584. else if (length >= LARGE_ARRAY_SIZE) {
  21585. var set = iteratee ? null : createSet(array);
  21586. if (set) {
  21587. return setToArray(set);
  21588. }
  21589. isCommon = false;
  21590. includes = cacheHas;
  21591. seen = new SetCache;
  21592. }
  21593. else {
  21594. seen = iteratee ? [] : result;
  21595. }
  21596. outer:
  21597. while (++index < length) {
  21598. var value = array[index],
  21599. computed = iteratee ? iteratee(value) : value;
  21600. value = (comparator || value !== 0) ? value : 0;
  21601. if (isCommon && computed === computed) {
  21602. var seenIndex = seen.length;
  21603. while (seenIndex--) {
  21604. if (seen[seenIndex] === computed) {
  21605. continue outer;
  21606. }
  21607. }
  21608. if (iteratee) {
  21609. seen.push(computed);
  21610. }
  21611. result.push(value);
  21612. }
  21613. else if (!includes(seen, computed, comparator)) {
  21614. if (seen !== result) {
  21615. seen.push(computed);
  21616. }
  21617. result.push(value);
  21618. }
  21619. }
  21620. return result;
  21621. }
  21622. /**
  21623. * The base implementation of `_.unset`.
  21624. *
  21625. * @private
  21626. * @param {Object} object The object to modify.
  21627. * @param {Array|string} path The property path to unset.
  21628. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21629. */
  21630. function baseUnset(object, path) {
  21631. path = castPath(path, object);
  21632. object = parent(object, path);
  21633. return object == null || delete object[toKey(last(path))];
  21634. }
  21635. /**
  21636. * The base implementation of `_.update`.
  21637. *
  21638. * @private
  21639. * @param {Object} object The object to modify.
  21640. * @param {Array|string} path The path of the property to update.
  21641. * @param {Function} updater The function to produce the updated value.
  21642. * @param {Function} [customizer] The function to customize path creation.
  21643. * @returns {Object} Returns `object`.
  21644. */
  21645. function baseUpdate(object, path, updater, customizer) {
  21646. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21647. }
  21648. /**
  21649. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21650. * without support for iteratee shorthands.
  21651. *
  21652. * @private
  21653. * @param {Array} array The array to query.
  21654. * @param {Function} predicate The function invoked per iteration.
  21655. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21656. * @param {boolean} [fromRight] Specify iterating from right to left.
  21657. * @returns {Array} Returns the slice of `array`.
  21658. */
  21659. function baseWhile(array, predicate, isDrop, fromRight) {
  21660. var length = array.length,
  21661. index = fromRight ? length : -1;
  21662. while ((fromRight ? index-- : ++index < length) &&
  21663. predicate(array[index], index, array)) {}
  21664. return isDrop
  21665. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21666. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21667. }
  21668. /**
  21669. * The base implementation of `wrapperValue` which returns the result of
  21670. * performing a sequence of actions on the unwrapped `value`, where each
  21671. * successive action is supplied the return value of the previous.
  21672. *
  21673. * @private
  21674. * @param {*} value The unwrapped value.
  21675. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21676. * @returns {*} Returns the resolved value.
  21677. */
  21678. function baseWrapperValue(value, actions) {
  21679. var result = value;
  21680. if (result instanceof LazyWrapper) {
  21681. result = result.value();
  21682. }
  21683. return arrayReduce(actions, function(result, action) {
  21684. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21685. }, result);
  21686. }
  21687. /**
  21688. * The base implementation of methods like `_.xor`, without support for
  21689. * iteratee shorthands, that accepts an array of arrays to inspect.
  21690. *
  21691. * @private
  21692. * @param {Array} arrays The arrays to inspect.
  21693. * @param {Function} [iteratee] The iteratee invoked per element.
  21694. * @param {Function} [comparator] The comparator invoked per element.
  21695. * @returns {Array} Returns the new array of values.
  21696. */
  21697. function baseXor(arrays, iteratee, comparator) {
  21698. var length = arrays.length;
  21699. if (length < 2) {
  21700. return length ? baseUniq(arrays[0]) : [];
  21701. }
  21702. var index = -1,
  21703. result = Array(length);
  21704. while (++index < length) {
  21705. var array = arrays[index],
  21706. othIndex = -1;
  21707. while (++othIndex < length) {
  21708. if (othIndex != index) {
  21709. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  21710. }
  21711. }
  21712. }
  21713. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  21714. }
  21715. /**
  21716. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  21717. *
  21718. * @private
  21719. * @param {Array} props The property identifiers.
  21720. * @param {Array} values The property values.
  21721. * @param {Function} assignFunc The function to assign values.
  21722. * @returns {Object} Returns the new object.
  21723. */
  21724. function baseZipObject(props, values, assignFunc) {
  21725. var index = -1,
  21726. length = props.length,
  21727. valsLength = values.length,
  21728. result = {};
  21729. while (++index < length) {
  21730. var value = index < valsLength ? values[index] : undefined;
  21731. assignFunc(result, props[index], value);
  21732. }
  21733. return result;
  21734. }
  21735. /**
  21736. * Casts `value` to an empty array if it's not an array like object.
  21737. *
  21738. * @private
  21739. * @param {*} value The value to inspect.
  21740. * @returns {Array|Object} Returns the cast array-like object.
  21741. */
  21742. function castArrayLikeObject(value) {
  21743. return isArrayLikeObject(value) ? value : [];
  21744. }
  21745. /**
  21746. * Casts `value` to `identity` if it's not a function.
  21747. *
  21748. * @private
  21749. * @param {*} value The value to inspect.
  21750. * @returns {Function} Returns cast function.
  21751. */
  21752. function castFunction(value) {
  21753. return typeof value == 'function' ? value : identity;
  21754. }
  21755. /**
  21756. * Casts `value` to a path array if it's not one.
  21757. *
  21758. * @private
  21759. * @param {*} value The value to inspect.
  21760. * @param {Object} [object] The object to query keys on.
  21761. * @returns {Array} Returns the cast property path array.
  21762. */
  21763. function castPath(value, object) {
  21764. if (isArray(value)) {
  21765. return value;
  21766. }
  21767. return isKey(value, object) ? [value] : stringToPath(toString(value));
  21768. }
  21769. /**
  21770. * A `baseRest` alias which can be replaced with `identity` by module
  21771. * replacement plugins.
  21772. *
  21773. * @private
  21774. * @type {Function}
  21775. * @param {Function} func The function to apply a rest parameter to.
  21776. * @returns {Function} Returns the new function.
  21777. */
  21778. var castRest = baseRest;
  21779. /**
  21780. * Casts `array` to a slice if it's needed.
  21781. *
  21782. * @private
  21783. * @param {Array} array The array to inspect.
  21784. * @param {number} start The start position.
  21785. * @param {number} [end=array.length] The end position.
  21786. * @returns {Array} Returns the cast slice.
  21787. */
  21788. function castSlice(array, start, end) {
  21789. var length = array.length;
  21790. end = end === undefined ? length : end;
  21791. return (!start && end >= length) ? array : baseSlice(array, start, end);
  21792. }
  21793. /**
  21794. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  21795. *
  21796. * @private
  21797. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  21798. */
  21799. var clearTimeout = ctxClearTimeout || function(id) {
  21800. return root.clearTimeout(id);
  21801. };
  21802. /**
  21803. * Creates a clone of `buffer`.
  21804. *
  21805. * @private
  21806. * @param {Buffer} buffer The buffer to clone.
  21807. * @param {boolean} [isDeep] Specify a deep clone.
  21808. * @returns {Buffer} Returns the cloned buffer.
  21809. */
  21810. function cloneBuffer(buffer, isDeep) {
  21811. if (isDeep) {
  21812. return buffer.slice();
  21813. }
  21814. var length = buffer.length,
  21815. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  21816. buffer.copy(result);
  21817. return result;
  21818. }
  21819. /**
  21820. * Creates a clone of `arrayBuffer`.
  21821. *
  21822. * @private
  21823. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  21824. * @returns {ArrayBuffer} Returns the cloned array buffer.
  21825. */
  21826. function cloneArrayBuffer(arrayBuffer) {
  21827. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  21828. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  21829. return result;
  21830. }
  21831. /**
  21832. * Creates a clone of `dataView`.
  21833. *
  21834. * @private
  21835. * @param {Object} dataView The data view to clone.
  21836. * @param {boolean} [isDeep] Specify a deep clone.
  21837. * @returns {Object} Returns the cloned data view.
  21838. */
  21839. function cloneDataView(dataView, isDeep) {
  21840. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  21841. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  21842. }
  21843. /**
  21844. * Creates a clone of `regexp`.
  21845. *
  21846. * @private
  21847. * @param {Object} regexp The regexp to clone.
  21848. * @returns {Object} Returns the cloned regexp.
  21849. */
  21850. function cloneRegExp(regexp) {
  21851. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  21852. result.lastIndex = regexp.lastIndex;
  21853. return result;
  21854. }
  21855. /**
  21856. * Creates a clone of the `symbol` object.
  21857. *
  21858. * @private
  21859. * @param {Object} symbol The symbol object to clone.
  21860. * @returns {Object} Returns the cloned symbol object.
  21861. */
  21862. function cloneSymbol(symbol) {
  21863. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  21864. }
  21865. /**
  21866. * Creates a clone of `typedArray`.
  21867. *
  21868. * @private
  21869. * @param {Object} typedArray The typed array to clone.
  21870. * @param {boolean} [isDeep] Specify a deep clone.
  21871. * @returns {Object} Returns the cloned typed array.
  21872. */
  21873. function cloneTypedArray(typedArray, isDeep) {
  21874. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  21875. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  21876. }
  21877. /**
  21878. * Compares values to sort them in ascending order.
  21879. *
  21880. * @private
  21881. * @param {*} value The value to compare.
  21882. * @param {*} other The other value to compare.
  21883. * @returns {number} Returns the sort order indicator for `value`.
  21884. */
  21885. function compareAscending(value, other) {
  21886. if (value !== other) {
  21887. var valIsDefined = value !== undefined,
  21888. valIsNull = value === null,
  21889. valIsReflexive = value === value,
  21890. valIsSymbol = isSymbol(value);
  21891. var othIsDefined = other !== undefined,
  21892. othIsNull = other === null,
  21893. othIsReflexive = other === other,
  21894. othIsSymbol = isSymbol(other);
  21895. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  21896. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  21897. (valIsNull && othIsDefined && othIsReflexive) ||
  21898. (!valIsDefined && othIsReflexive) ||
  21899. !valIsReflexive) {
  21900. return 1;
  21901. }
  21902. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  21903. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  21904. (othIsNull && valIsDefined && valIsReflexive) ||
  21905. (!othIsDefined && valIsReflexive) ||
  21906. !othIsReflexive) {
  21907. return -1;
  21908. }
  21909. }
  21910. return 0;
  21911. }
  21912. /**
  21913. * Used by `_.orderBy` to compare multiple properties of a value to another
  21914. * and stable sort them.
  21915. *
  21916. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  21917. * specify an order of "desc" for descending or "asc" for ascending sort order
  21918. * of corresponding values.
  21919. *
  21920. * @private
  21921. * @param {Object} object The object to compare.
  21922. * @param {Object} other The other object to compare.
  21923. * @param {boolean[]|string[]} orders The order to sort by for each property.
  21924. * @returns {number} Returns the sort order indicator for `object`.
  21925. */
  21926. function compareMultiple(object, other, orders) {
  21927. var index = -1,
  21928. objCriteria = object.criteria,
  21929. othCriteria = other.criteria,
  21930. length = objCriteria.length,
  21931. ordersLength = orders.length;
  21932. while (++index < length) {
  21933. var result = compareAscending(objCriteria[index], othCriteria[index]);
  21934. if (result) {
  21935. if (index >= ordersLength) {
  21936. return result;
  21937. }
  21938. var order = orders[index];
  21939. return result * (order == 'desc' ? -1 : 1);
  21940. }
  21941. }
  21942. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  21943. // that causes it, under certain circumstances, to provide the same value for
  21944. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  21945. // for more details.
  21946. //
  21947. // This also ensures a stable sort in V8 and other engines.
  21948. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  21949. return object.index - other.index;
  21950. }
  21951. /**
  21952. * Creates an array that is the composition of partially applied arguments,
  21953. * placeholders, and provided arguments into a single array of arguments.
  21954. *
  21955. * @private
  21956. * @param {Array} args The provided arguments.
  21957. * @param {Array} partials The arguments to prepend to those provided.
  21958. * @param {Array} holders The `partials` placeholder indexes.
  21959. * @params {boolean} [isCurried] Specify composing for a curried function.
  21960. * @returns {Array} Returns the new array of composed arguments.
  21961. */
  21962. function composeArgs(args, partials, holders, isCurried) {
  21963. var argsIndex = -1,
  21964. argsLength = args.length,
  21965. holdersLength = holders.length,
  21966. leftIndex = -1,
  21967. leftLength = partials.length,
  21968. rangeLength = nativeMax(argsLength - holdersLength, 0),
  21969. result = Array(leftLength + rangeLength),
  21970. isUncurried = !isCurried;
  21971. while (++leftIndex < leftLength) {
  21972. result[leftIndex] = partials[leftIndex];
  21973. }
  21974. while (++argsIndex < holdersLength) {
  21975. if (isUncurried || argsIndex < argsLength) {
  21976. result[holders[argsIndex]] = args[argsIndex];
  21977. }
  21978. }
  21979. while (rangeLength--) {
  21980. result[leftIndex++] = args[argsIndex++];
  21981. }
  21982. return result;
  21983. }
  21984. /**
  21985. * This function is like `composeArgs` except that the arguments composition
  21986. * is tailored for `_.partialRight`.
  21987. *
  21988. * @private
  21989. * @param {Array} args The provided arguments.
  21990. * @param {Array} partials The arguments to append to those provided.
  21991. * @param {Array} holders The `partials` placeholder indexes.
  21992. * @params {boolean} [isCurried] Specify composing for a curried function.
  21993. * @returns {Array} Returns the new array of composed arguments.
  21994. */
  21995. function composeArgsRight(args, partials, holders, isCurried) {
  21996. var argsIndex = -1,
  21997. argsLength = args.length,
  21998. holdersIndex = -1,
  21999. holdersLength = holders.length,
  22000. rightIndex = -1,
  22001. rightLength = partials.length,
  22002. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22003. result = Array(rangeLength + rightLength),
  22004. isUncurried = !isCurried;
  22005. while (++argsIndex < rangeLength) {
  22006. result[argsIndex] = args[argsIndex];
  22007. }
  22008. var offset = argsIndex;
  22009. while (++rightIndex < rightLength) {
  22010. result[offset + rightIndex] = partials[rightIndex];
  22011. }
  22012. while (++holdersIndex < holdersLength) {
  22013. if (isUncurried || argsIndex < argsLength) {
  22014. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22015. }
  22016. }
  22017. return result;
  22018. }
  22019. /**
  22020. * Copies the values of `source` to `array`.
  22021. *
  22022. * @private
  22023. * @param {Array} source The array to copy values from.
  22024. * @param {Array} [array=[]] The array to copy values to.
  22025. * @returns {Array} Returns `array`.
  22026. */
  22027. function copyArray(source, array) {
  22028. var index = -1,
  22029. length = source.length;
  22030. array || (array = Array(length));
  22031. while (++index < length) {
  22032. array[index] = source[index];
  22033. }
  22034. return array;
  22035. }
  22036. /**
  22037. * Copies properties of `source` to `object`.
  22038. *
  22039. * @private
  22040. * @param {Object} source The object to copy properties from.
  22041. * @param {Array} props The property identifiers to copy.
  22042. * @param {Object} [object={}] The object to copy properties to.
  22043. * @param {Function} [customizer] The function to customize copied values.
  22044. * @returns {Object} Returns `object`.
  22045. */
  22046. function copyObject(source, props, object, customizer) {
  22047. var isNew = !object;
  22048. object || (object = {});
  22049. var index = -1,
  22050. length = props.length;
  22051. while (++index < length) {
  22052. var key = props[index];
  22053. var newValue = customizer
  22054. ? customizer(object[key], source[key], key, object, source)
  22055. : undefined;
  22056. if (newValue === undefined) {
  22057. newValue = source[key];
  22058. }
  22059. if (isNew) {
  22060. baseAssignValue(object, key, newValue);
  22061. } else {
  22062. assignValue(object, key, newValue);
  22063. }
  22064. }
  22065. return object;
  22066. }
  22067. /**
  22068. * Copies own symbols of `source` to `object`.
  22069. *
  22070. * @private
  22071. * @param {Object} source The object to copy symbols from.
  22072. * @param {Object} [object={}] The object to copy symbols to.
  22073. * @returns {Object} Returns `object`.
  22074. */
  22075. function copySymbols(source, object) {
  22076. return copyObject(source, getSymbols(source), object);
  22077. }
  22078. /**
  22079. * Copies own and inherited symbols of `source` to `object`.
  22080. *
  22081. * @private
  22082. * @param {Object} source The object to copy symbols from.
  22083. * @param {Object} [object={}] The object to copy symbols to.
  22084. * @returns {Object} Returns `object`.
  22085. */
  22086. function copySymbolsIn(source, object) {
  22087. return copyObject(source, getSymbolsIn(source), object);
  22088. }
  22089. /**
  22090. * Creates a function like `_.groupBy`.
  22091. *
  22092. * @private
  22093. * @param {Function} setter The function to set accumulator values.
  22094. * @param {Function} [initializer] The accumulator object initializer.
  22095. * @returns {Function} Returns the new aggregator function.
  22096. */
  22097. function createAggregator(setter, initializer) {
  22098. return function(collection, iteratee) {
  22099. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22100. accumulator = initializer ? initializer() : {};
  22101. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22102. };
  22103. }
  22104. /**
  22105. * Creates a function like `_.assign`.
  22106. *
  22107. * @private
  22108. * @param {Function} assigner The function to assign values.
  22109. * @returns {Function} Returns the new assigner function.
  22110. */
  22111. function createAssigner(assigner) {
  22112. return baseRest(function(object, sources) {
  22113. var index = -1,
  22114. length = sources.length,
  22115. customizer = length > 1 ? sources[length - 1] : undefined,
  22116. guard = length > 2 ? sources[2] : undefined;
  22117. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22118. ? (length--, customizer)
  22119. : undefined;
  22120. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22121. customizer = length < 3 ? undefined : customizer;
  22122. length = 1;
  22123. }
  22124. object = Object(object);
  22125. while (++index < length) {
  22126. var source = sources[index];
  22127. if (source) {
  22128. assigner(object, source, index, customizer);
  22129. }
  22130. }
  22131. return object;
  22132. });
  22133. }
  22134. /**
  22135. * Creates a `baseEach` or `baseEachRight` function.
  22136. *
  22137. * @private
  22138. * @param {Function} eachFunc The function to iterate over a collection.
  22139. * @param {boolean} [fromRight] Specify iterating from right to left.
  22140. * @returns {Function} Returns the new base function.
  22141. */
  22142. function createBaseEach(eachFunc, fromRight) {
  22143. return function(collection, iteratee) {
  22144. if (collection == null) {
  22145. return collection;
  22146. }
  22147. if (!isArrayLike(collection)) {
  22148. return eachFunc(collection, iteratee);
  22149. }
  22150. var length = collection.length,
  22151. index = fromRight ? length : -1,
  22152. iterable = Object(collection);
  22153. while ((fromRight ? index-- : ++index < length)) {
  22154. if (iteratee(iterable[index], index, iterable) === false) {
  22155. break;
  22156. }
  22157. }
  22158. return collection;
  22159. };
  22160. }
  22161. /**
  22162. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22163. *
  22164. * @private
  22165. * @param {boolean} [fromRight] Specify iterating from right to left.
  22166. * @returns {Function} Returns the new base function.
  22167. */
  22168. function createBaseFor(fromRight) {
  22169. return function(object, iteratee, keysFunc) {
  22170. var index = -1,
  22171. iterable = Object(object),
  22172. props = keysFunc(object),
  22173. length = props.length;
  22174. while (length--) {
  22175. var key = props[fromRight ? length : ++index];
  22176. if (iteratee(iterable[key], key, iterable) === false) {
  22177. break;
  22178. }
  22179. }
  22180. return object;
  22181. };
  22182. }
  22183. /**
  22184. * Creates a function that wraps `func` to invoke it with the optional `this`
  22185. * binding of `thisArg`.
  22186. *
  22187. * @private
  22188. * @param {Function} func The function to wrap.
  22189. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22190. * @param {*} [thisArg] The `this` binding of `func`.
  22191. * @returns {Function} Returns the new wrapped function.
  22192. */
  22193. function createBind(func, bitmask, thisArg) {
  22194. var isBind = bitmask & WRAP_BIND_FLAG,
  22195. Ctor = createCtor(func);
  22196. function wrapper() {
  22197. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22198. return fn.apply(isBind ? thisArg : this, arguments);
  22199. }
  22200. return wrapper;
  22201. }
  22202. /**
  22203. * Creates a function like `_.lowerFirst`.
  22204. *
  22205. * @private
  22206. * @param {string} methodName The name of the `String` case method to use.
  22207. * @returns {Function} Returns the new case function.
  22208. */
  22209. function createCaseFirst(methodName) {
  22210. return function(string) {
  22211. string = toString(string);
  22212. var strSymbols = hasUnicode(string)
  22213. ? stringToArray(string)
  22214. : undefined;
  22215. var chr = strSymbols
  22216. ? strSymbols[0]
  22217. : string.charAt(0);
  22218. var trailing = strSymbols
  22219. ? castSlice(strSymbols, 1).join('')
  22220. : string.slice(1);
  22221. return chr[methodName]() + trailing;
  22222. };
  22223. }
  22224. /**
  22225. * Creates a function like `_.camelCase`.
  22226. *
  22227. * @private
  22228. * @param {Function} callback The function to combine each word.
  22229. * @returns {Function} Returns the new compounder function.
  22230. */
  22231. function createCompounder(callback) {
  22232. return function(string) {
  22233. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22234. };
  22235. }
  22236. /**
  22237. * Creates a function that produces an instance of `Ctor` regardless of
  22238. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22239. *
  22240. * @private
  22241. * @param {Function} Ctor The constructor to wrap.
  22242. * @returns {Function} Returns the new wrapped function.
  22243. */
  22244. function createCtor(Ctor) {
  22245. return function() {
  22246. // Use a `switch` statement to work with class constructors. See
  22247. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22248. // for more details.
  22249. var args = arguments;
  22250. switch (args.length) {
  22251. case 0: return new Ctor;
  22252. case 1: return new Ctor(args[0]);
  22253. case 2: return new Ctor(args[0], args[1]);
  22254. case 3: return new Ctor(args[0], args[1], args[2]);
  22255. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22256. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22257. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22258. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22259. }
  22260. var thisBinding = baseCreate(Ctor.prototype),
  22261. result = Ctor.apply(thisBinding, args);
  22262. // Mimic the constructor's `return` behavior.
  22263. // See https://es5.github.io/#x13.2.2 for more details.
  22264. return isObject(result) ? result : thisBinding;
  22265. };
  22266. }
  22267. /**
  22268. * Creates a function that wraps `func` to enable currying.
  22269. *
  22270. * @private
  22271. * @param {Function} func The function to wrap.
  22272. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22273. * @param {number} arity The arity of `func`.
  22274. * @returns {Function} Returns the new wrapped function.
  22275. */
  22276. function createCurry(func, bitmask, arity) {
  22277. var Ctor = createCtor(func);
  22278. function wrapper() {
  22279. var length = arguments.length,
  22280. args = Array(length),
  22281. index = length,
  22282. placeholder = getHolder(wrapper);
  22283. while (index--) {
  22284. args[index] = arguments[index];
  22285. }
  22286. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22287. ? []
  22288. : replaceHolders(args, placeholder);
  22289. length -= holders.length;
  22290. if (length < arity) {
  22291. return createRecurry(
  22292. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22293. args, holders, undefined, undefined, arity - length);
  22294. }
  22295. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22296. return apply(fn, this, args);
  22297. }
  22298. return wrapper;
  22299. }
  22300. /**
  22301. * Creates a `_.find` or `_.findLast` function.
  22302. *
  22303. * @private
  22304. * @param {Function} findIndexFunc The function to find the collection index.
  22305. * @returns {Function} Returns the new find function.
  22306. */
  22307. function createFind(findIndexFunc) {
  22308. return function(collection, predicate, fromIndex) {
  22309. var iterable = Object(collection);
  22310. if (!isArrayLike(collection)) {
  22311. var iteratee = getIteratee(predicate, 3);
  22312. collection = keys(collection);
  22313. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22314. }
  22315. var index = findIndexFunc(collection, predicate, fromIndex);
  22316. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22317. };
  22318. }
  22319. /**
  22320. * Creates a `_.flow` or `_.flowRight` function.
  22321. *
  22322. * @private
  22323. * @param {boolean} [fromRight] Specify iterating from right to left.
  22324. * @returns {Function} Returns the new flow function.
  22325. */
  22326. function createFlow(fromRight) {
  22327. return flatRest(function(funcs) {
  22328. var length = funcs.length,
  22329. index = length,
  22330. prereq = LodashWrapper.prototype.thru;
  22331. if (fromRight) {
  22332. funcs.reverse();
  22333. }
  22334. while (index--) {
  22335. var func = funcs[index];
  22336. if (typeof func != 'function') {
  22337. throw new TypeError(FUNC_ERROR_TEXT);
  22338. }
  22339. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22340. var wrapper = new LodashWrapper([], true);
  22341. }
  22342. }
  22343. index = wrapper ? index : length;
  22344. while (++index < length) {
  22345. func = funcs[index];
  22346. var funcName = getFuncName(func),
  22347. data = funcName == 'wrapper' ? getData(func) : undefined;
  22348. if (data && isLaziable(data[0]) &&
  22349. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22350. !data[4].length && data[9] == 1
  22351. ) {
  22352. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22353. } else {
  22354. wrapper = (func.length == 1 && isLaziable(func))
  22355. ? wrapper[funcName]()
  22356. : wrapper.thru(func);
  22357. }
  22358. }
  22359. return function() {
  22360. var args = arguments,
  22361. value = args[0];
  22362. if (wrapper && args.length == 1 && isArray(value)) {
  22363. return wrapper.plant(value).value();
  22364. }
  22365. var index = 0,
  22366. result = length ? funcs[index].apply(this, args) : value;
  22367. while (++index < length) {
  22368. result = funcs[index].call(this, result);
  22369. }
  22370. return result;
  22371. };
  22372. });
  22373. }
  22374. /**
  22375. * Creates a function that wraps `func` to invoke it with optional `this`
  22376. * binding of `thisArg`, partial application, and currying.
  22377. *
  22378. * @private
  22379. * @param {Function|string} func The function or method name to wrap.
  22380. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22381. * @param {*} [thisArg] The `this` binding of `func`.
  22382. * @param {Array} [partials] The arguments to prepend to those provided to
  22383. * the new function.
  22384. * @param {Array} [holders] The `partials` placeholder indexes.
  22385. * @param {Array} [partialsRight] The arguments to append to those provided
  22386. * to the new function.
  22387. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22388. * @param {Array} [argPos] The argument positions of the new function.
  22389. * @param {number} [ary] The arity cap of `func`.
  22390. * @param {number} [arity] The arity of `func`.
  22391. * @returns {Function} Returns the new wrapped function.
  22392. */
  22393. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22394. var isAry = bitmask & WRAP_ARY_FLAG,
  22395. isBind = bitmask & WRAP_BIND_FLAG,
  22396. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22397. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22398. isFlip = bitmask & WRAP_FLIP_FLAG,
  22399. Ctor = isBindKey ? undefined : createCtor(func);
  22400. function wrapper() {
  22401. var length = arguments.length,
  22402. args = Array(length),
  22403. index = length;
  22404. while (index--) {
  22405. args[index] = arguments[index];
  22406. }
  22407. if (isCurried) {
  22408. var placeholder = getHolder(wrapper),
  22409. holdersCount = countHolders(args, placeholder);
  22410. }
  22411. if (partials) {
  22412. args = composeArgs(args, partials, holders, isCurried);
  22413. }
  22414. if (partialsRight) {
  22415. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22416. }
  22417. length -= holdersCount;
  22418. if (isCurried && length < arity) {
  22419. var newHolders = replaceHolders(args, placeholder);
  22420. return createRecurry(
  22421. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22422. args, newHolders, argPos, ary, arity - length
  22423. );
  22424. }
  22425. var thisBinding = isBind ? thisArg : this,
  22426. fn = isBindKey ? thisBinding[func] : func;
  22427. length = args.length;
  22428. if (argPos) {
  22429. args = reorder(args, argPos);
  22430. } else if (isFlip && length > 1) {
  22431. args.reverse();
  22432. }
  22433. if (isAry && ary < length) {
  22434. args.length = ary;
  22435. }
  22436. if (this && this !== root && this instanceof wrapper) {
  22437. fn = Ctor || createCtor(fn);
  22438. }
  22439. return fn.apply(thisBinding, args);
  22440. }
  22441. return wrapper;
  22442. }
  22443. /**
  22444. * Creates a function like `_.invertBy`.
  22445. *
  22446. * @private
  22447. * @param {Function} setter The function to set accumulator values.
  22448. * @param {Function} toIteratee The function to resolve iteratees.
  22449. * @returns {Function} Returns the new inverter function.
  22450. */
  22451. function createInverter(setter, toIteratee) {
  22452. return function(object, iteratee) {
  22453. return baseInverter(object, setter, toIteratee(iteratee), {});
  22454. };
  22455. }
  22456. /**
  22457. * Creates a function that performs a mathematical operation on two values.
  22458. *
  22459. * @private
  22460. * @param {Function} operator The function to perform the operation.
  22461. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22462. * @returns {Function} Returns the new mathematical operation function.
  22463. */
  22464. function createMathOperation(operator, defaultValue) {
  22465. return function(value, other) {
  22466. var result;
  22467. if (value === undefined && other === undefined) {
  22468. return defaultValue;
  22469. }
  22470. if (value !== undefined) {
  22471. result = value;
  22472. }
  22473. if (other !== undefined) {
  22474. if (result === undefined) {
  22475. return other;
  22476. }
  22477. if (typeof value == 'string' || typeof other == 'string') {
  22478. value = baseToString(value);
  22479. other = baseToString(other);
  22480. } else {
  22481. value = baseToNumber(value);
  22482. other = baseToNumber(other);
  22483. }
  22484. result = operator(value, other);
  22485. }
  22486. return result;
  22487. };
  22488. }
  22489. /**
  22490. * Creates a function like `_.over`.
  22491. *
  22492. * @private
  22493. * @param {Function} arrayFunc The function to iterate over iteratees.
  22494. * @returns {Function} Returns the new over function.
  22495. */
  22496. function createOver(arrayFunc) {
  22497. return flatRest(function(iteratees) {
  22498. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22499. return baseRest(function(args) {
  22500. var thisArg = this;
  22501. return arrayFunc(iteratees, function(iteratee) {
  22502. return apply(iteratee, thisArg, args);
  22503. });
  22504. });
  22505. });
  22506. }
  22507. /**
  22508. * Creates the padding for `string` based on `length`. The `chars` string
  22509. * is truncated if the number of characters exceeds `length`.
  22510. *
  22511. * @private
  22512. * @param {number} length The padding length.
  22513. * @param {string} [chars=' '] The string used as padding.
  22514. * @returns {string} Returns the padding for `string`.
  22515. */
  22516. function createPadding(length, chars) {
  22517. chars = chars === undefined ? ' ' : baseToString(chars);
  22518. var charsLength = chars.length;
  22519. if (charsLength < 2) {
  22520. return charsLength ? baseRepeat(chars, length) : chars;
  22521. }
  22522. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22523. return hasUnicode(chars)
  22524. ? castSlice(stringToArray(result), 0, length).join('')
  22525. : result.slice(0, length);
  22526. }
  22527. /**
  22528. * Creates a function that wraps `func` to invoke it with the `this` binding
  22529. * of `thisArg` and `partials` prepended to the arguments it receives.
  22530. *
  22531. * @private
  22532. * @param {Function} func The function to wrap.
  22533. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22534. * @param {*} thisArg The `this` binding of `func`.
  22535. * @param {Array} partials The arguments to prepend to those provided to
  22536. * the new function.
  22537. * @returns {Function} Returns the new wrapped function.
  22538. */
  22539. function createPartial(func, bitmask, thisArg, partials) {
  22540. var isBind = bitmask & WRAP_BIND_FLAG,
  22541. Ctor = createCtor(func);
  22542. function wrapper() {
  22543. var argsIndex = -1,
  22544. argsLength = arguments.length,
  22545. leftIndex = -1,
  22546. leftLength = partials.length,
  22547. args = Array(leftLength + argsLength),
  22548. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22549. while (++leftIndex < leftLength) {
  22550. args[leftIndex] = partials[leftIndex];
  22551. }
  22552. while (argsLength--) {
  22553. args[leftIndex++] = arguments[++argsIndex];
  22554. }
  22555. return apply(fn, isBind ? thisArg : this, args);
  22556. }
  22557. return wrapper;
  22558. }
  22559. /**
  22560. * Creates a `_.range` or `_.rangeRight` function.
  22561. *
  22562. * @private
  22563. * @param {boolean} [fromRight] Specify iterating from right to left.
  22564. * @returns {Function} Returns the new range function.
  22565. */
  22566. function createRange(fromRight) {
  22567. return function(start, end, step) {
  22568. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22569. end = step = undefined;
  22570. }
  22571. // Ensure the sign of `-0` is preserved.
  22572. start = toFinite(start);
  22573. if (end === undefined) {
  22574. end = start;
  22575. start = 0;
  22576. } else {
  22577. end = toFinite(end);
  22578. }
  22579. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22580. return baseRange(start, end, step, fromRight);
  22581. };
  22582. }
  22583. /**
  22584. * Creates a function that performs a relational operation on two values.
  22585. *
  22586. * @private
  22587. * @param {Function} operator The function to perform the operation.
  22588. * @returns {Function} Returns the new relational operation function.
  22589. */
  22590. function createRelationalOperation(operator) {
  22591. return function(value, other) {
  22592. if (!(typeof value == 'string' && typeof other == 'string')) {
  22593. value = toNumber(value);
  22594. other = toNumber(other);
  22595. }
  22596. return operator(value, other);
  22597. };
  22598. }
  22599. /**
  22600. * Creates a function that wraps `func` to continue currying.
  22601. *
  22602. * @private
  22603. * @param {Function} func The function to wrap.
  22604. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22605. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22606. * @param {*} placeholder The placeholder value.
  22607. * @param {*} [thisArg] The `this` binding of `func`.
  22608. * @param {Array} [partials] The arguments to prepend to those provided to
  22609. * the new function.
  22610. * @param {Array} [holders] The `partials` placeholder indexes.
  22611. * @param {Array} [argPos] The argument positions of the new function.
  22612. * @param {number} [ary] The arity cap of `func`.
  22613. * @param {number} [arity] The arity of `func`.
  22614. * @returns {Function} Returns the new wrapped function.
  22615. */
  22616. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22617. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22618. newHolders = isCurry ? holders : undefined,
  22619. newHoldersRight = isCurry ? undefined : holders,
  22620. newPartials = isCurry ? partials : undefined,
  22621. newPartialsRight = isCurry ? undefined : partials;
  22622. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22623. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22624. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22625. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22626. }
  22627. var newData = [
  22628. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22629. newHoldersRight, argPos, ary, arity
  22630. ];
  22631. var result = wrapFunc.apply(undefined, newData);
  22632. if (isLaziable(func)) {
  22633. setData(result, newData);
  22634. }
  22635. result.placeholder = placeholder;
  22636. return setWrapToString(result, func, bitmask);
  22637. }
  22638. /**
  22639. * Creates a function like `_.round`.
  22640. *
  22641. * @private
  22642. * @param {string} methodName The name of the `Math` method to use when rounding.
  22643. * @returns {Function} Returns the new round function.
  22644. */
  22645. function createRound(methodName) {
  22646. var func = Math[methodName];
  22647. return function(number, precision) {
  22648. number = toNumber(number);
  22649. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22650. if (precision && nativeIsFinite(number)) {
  22651. // Shift with exponential notation to avoid floating-point issues.
  22652. // See [MDN](https://mdn.io/round#Examples) for more details.
  22653. var pair = (toString(number) + 'e').split('e'),
  22654. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22655. pair = (toString(value) + 'e').split('e');
  22656. return +(pair[0] + 'e' + (+pair[1] - precision));
  22657. }
  22658. return func(number);
  22659. };
  22660. }
  22661. /**
  22662. * Creates a set object of `values`.
  22663. *
  22664. * @private
  22665. * @param {Array} values The values to add to the set.
  22666. * @returns {Object} Returns the new set.
  22667. */
  22668. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22669. return new Set(values);
  22670. };
  22671. /**
  22672. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22673. *
  22674. * @private
  22675. * @param {Function} keysFunc The function to get the keys of a given object.
  22676. * @returns {Function} Returns the new pairs function.
  22677. */
  22678. function createToPairs(keysFunc) {
  22679. return function(object) {
  22680. var tag = getTag(object);
  22681. if (tag == mapTag) {
  22682. return mapToArray(object);
  22683. }
  22684. if (tag == setTag) {
  22685. return setToPairs(object);
  22686. }
  22687. return baseToPairs(object, keysFunc(object));
  22688. };
  22689. }
  22690. /**
  22691. * Creates a function that either curries or invokes `func` with optional
  22692. * `this` binding and partially applied arguments.
  22693. *
  22694. * @private
  22695. * @param {Function|string} func The function or method name to wrap.
  22696. * @param {number} bitmask The bitmask flags.
  22697. * 1 - `_.bind`
  22698. * 2 - `_.bindKey`
  22699. * 4 - `_.curry` or `_.curryRight` of a bound function
  22700. * 8 - `_.curry`
  22701. * 16 - `_.curryRight`
  22702. * 32 - `_.partial`
  22703. * 64 - `_.partialRight`
  22704. * 128 - `_.rearg`
  22705. * 256 - `_.ary`
  22706. * 512 - `_.flip`
  22707. * @param {*} [thisArg] The `this` binding of `func`.
  22708. * @param {Array} [partials] The arguments to be partially applied.
  22709. * @param {Array} [holders] The `partials` placeholder indexes.
  22710. * @param {Array} [argPos] The argument positions of the new function.
  22711. * @param {number} [ary] The arity cap of `func`.
  22712. * @param {number} [arity] The arity of `func`.
  22713. * @returns {Function} Returns the new wrapped function.
  22714. */
  22715. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  22716. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  22717. if (!isBindKey && typeof func != 'function') {
  22718. throw new TypeError(FUNC_ERROR_TEXT);
  22719. }
  22720. var length = partials ? partials.length : 0;
  22721. if (!length) {
  22722. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  22723. partials = holders = undefined;
  22724. }
  22725. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  22726. arity = arity === undefined ? arity : toInteger(arity);
  22727. length -= holders ? holders.length : 0;
  22728. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  22729. var partialsRight = partials,
  22730. holdersRight = holders;
  22731. partials = holders = undefined;
  22732. }
  22733. var data = isBindKey ? undefined : getData(func);
  22734. var newData = [
  22735. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  22736. argPos, ary, arity
  22737. ];
  22738. if (data) {
  22739. mergeData(newData, data);
  22740. }
  22741. func = newData[0];
  22742. bitmask = newData[1];
  22743. thisArg = newData[2];
  22744. partials = newData[3];
  22745. holders = newData[4];
  22746. arity = newData[9] = newData[9] === undefined
  22747. ? (isBindKey ? 0 : func.length)
  22748. : nativeMax(newData[9] - length, 0);
  22749. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  22750. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  22751. }
  22752. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  22753. var result = createBind(func, bitmask, thisArg);
  22754. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  22755. result = createCurry(func, bitmask, arity);
  22756. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  22757. result = createPartial(func, bitmask, thisArg, partials);
  22758. } else {
  22759. result = createHybrid.apply(undefined, newData);
  22760. }
  22761. var setter = data ? baseSetData : setData;
  22762. return setWrapToString(setter(result, newData), func, bitmask);
  22763. }
  22764. /**
  22765. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  22766. * of source objects to the destination object for all destination properties
  22767. * that resolve to `undefined`.
  22768. *
  22769. * @private
  22770. * @param {*} objValue The destination value.
  22771. * @param {*} srcValue The source value.
  22772. * @param {string} key The key of the property to assign.
  22773. * @param {Object} object The parent object of `objValue`.
  22774. * @returns {*} Returns the value to assign.
  22775. */
  22776. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  22777. if (objValue === undefined ||
  22778. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  22779. return srcValue;
  22780. }
  22781. return objValue;
  22782. }
  22783. /**
  22784. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  22785. * objects into destination objects that are passed thru.
  22786. *
  22787. * @private
  22788. * @param {*} objValue The destination value.
  22789. * @param {*} srcValue The source value.
  22790. * @param {string} key The key of the property to merge.
  22791. * @param {Object} object The parent object of `objValue`.
  22792. * @param {Object} source The parent object of `srcValue`.
  22793. * @param {Object} [stack] Tracks traversed source values and their merged
  22794. * counterparts.
  22795. * @returns {*} Returns the value to assign.
  22796. */
  22797. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  22798. if (isObject(objValue) && isObject(srcValue)) {
  22799. // Recursively merge objects and arrays (susceptible to call stack limits).
  22800. stack.set(srcValue, objValue);
  22801. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  22802. stack['delete'](srcValue);
  22803. }
  22804. return objValue;
  22805. }
  22806. /**
  22807. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  22808. * objects.
  22809. *
  22810. * @private
  22811. * @param {*} value The value to inspect.
  22812. * @param {string} key The key of the property to inspect.
  22813. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  22814. */
  22815. function customOmitClone(value) {
  22816. return isPlainObject(value) ? undefined : value;
  22817. }
  22818. /**
  22819. * A specialized version of `baseIsEqualDeep` for arrays with support for
  22820. * partial deep comparisons.
  22821. *
  22822. * @private
  22823. * @param {Array} array The array to compare.
  22824. * @param {Array} other The other array to compare.
  22825. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22826. * @param {Function} customizer The function to customize comparisons.
  22827. * @param {Function} equalFunc The function to determine equivalents of values.
  22828. * @param {Object} stack Tracks traversed `array` and `other` objects.
  22829. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  22830. */
  22831. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  22832. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  22833. arrLength = array.length,
  22834. othLength = other.length;
  22835. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  22836. return false;
  22837. }
  22838. // Assume cyclic values are equal.
  22839. var stacked = stack.get(array);
  22840. if (stacked && stack.get(other)) {
  22841. return stacked == other;
  22842. }
  22843. var index = -1,
  22844. result = true,
  22845. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  22846. stack.set(array, other);
  22847. stack.set(other, array);
  22848. // Ignore non-index properties.
  22849. while (++index < arrLength) {
  22850. var arrValue = array[index],
  22851. othValue = other[index];
  22852. if (customizer) {
  22853. var compared = isPartial
  22854. ? customizer(othValue, arrValue, index, other, array, stack)
  22855. : customizer(arrValue, othValue, index, array, other, stack);
  22856. }
  22857. if (compared !== undefined) {
  22858. if (compared) {
  22859. continue;
  22860. }
  22861. result = false;
  22862. break;
  22863. }
  22864. // Recursively compare arrays (susceptible to call stack limits).
  22865. if (seen) {
  22866. if (!arraySome(other, function(othValue, othIndex) {
  22867. if (!cacheHas(seen, othIndex) &&
  22868. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  22869. return seen.push(othIndex);
  22870. }
  22871. })) {
  22872. result = false;
  22873. break;
  22874. }
  22875. } else if (!(
  22876. arrValue === othValue ||
  22877. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  22878. )) {
  22879. result = false;
  22880. break;
  22881. }
  22882. }
  22883. stack['delete'](array);
  22884. stack['delete'](other);
  22885. return result;
  22886. }
  22887. /**
  22888. * A specialized version of `baseIsEqualDeep` for comparing objects of
  22889. * the same `toStringTag`.
  22890. *
  22891. * **Note:** This function only supports comparing values with tags of
  22892. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  22893. *
  22894. * @private
  22895. * @param {Object} object The object to compare.
  22896. * @param {Object} other The other object to compare.
  22897. * @param {string} tag The `toStringTag` of the objects to compare.
  22898. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22899. * @param {Function} customizer The function to customize comparisons.
  22900. * @param {Function} equalFunc The function to determine equivalents of values.
  22901. * @param {Object} stack Tracks traversed `object` and `other` objects.
  22902. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22903. */
  22904. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  22905. switch (tag) {
  22906. case dataViewTag:
  22907. if ((object.byteLength != other.byteLength) ||
  22908. (object.byteOffset != other.byteOffset)) {
  22909. return false;
  22910. }
  22911. object = object.buffer;
  22912. other = other.buffer;
  22913. case arrayBufferTag:
  22914. if ((object.byteLength != other.byteLength) ||
  22915. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  22916. return false;
  22917. }
  22918. return true;
  22919. case boolTag:
  22920. case dateTag:
  22921. case numberTag:
  22922. // Coerce booleans to `1` or `0` and dates to milliseconds.
  22923. // Invalid dates are coerced to `NaN`.
  22924. return eq(+object, +other);
  22925. case errorTag:
  22926. return object.name == other.name && object.message == other.message;
  22927. case regexpTag:
  22928. case stringTag:
  22929. // Coerce regexes to strings and treat strings, primitives and objects,
  22930. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  22931. // for more details.
  22932. return object == (other + '');
  22933. case mapTag:
  22934. var convert = mapToArray;
  22935. case setTag:
  22936. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  22937. convert || (convert = setToArray);
  22938. if (object.size != other.size && !isPartial) {
  22939. return false;
  22940. }
  22941. // Assume cyclic values are equal.
  22942. var stacked = stack.get(object);
  22943. if (stacked) {
  22944. return stacked == other;
  22945. }
  22946. bitmask |= COMPARE_UNORDERED_FLAG;
  22947. // Recursively compare objects (susceptible to call stack limits).
  22948. stack.set(object, other);
  22949. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  22950. stack['delete'](object);
  22951. return result;
  22952. case symbolTag:
  22953. if (symbolValueOf) {
  22954. return symbolValueOf.call(object) == symbolValueOf.call(other);
  22955. }
  22956. }
  22957. return false;
  22958. }
  22959. /**
  22960. * A specialized version of `baseIsEqualDeep` for objects with support for
  22961. * partial deep comparisons.
  22962. *
  22963. * @private
  22964. * @param {Object} object The object to compare.
  22965. * @param {Object} other The other object to compare.
  22966. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22967. * @param {Function} customizer The function to customize comparisons.
  22968. * @param {Function} equalFunc The function to determine equivalents of values.
  22969. * @param {Object} stack Tracks traversed `object` and `other` objects.
  22970. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22971. */
  22972. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  22973. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  22974. objProps = getAllKeys(object),
  22975. objLength = objProps.length,
  22976. othProps = getAllKeys(other),
  22977. othLength = othProps.length;
  22978. if (objLength != othLength && !isPartial) {
  22979. return false;
  22980. }
  22981. var index = objLength;
  22982. while (index--) {
  22983. var key = objProps[index];
  22984. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  22985. return false;
  22986. }
  22987. }
  22988. // Assume cyclic values are equal.
  22989. var stacked = stack.get(object);
  22990. if (stacked && stack.get(other)) {
  22991. return stacked == other;
  22992. }
  22993. var result = true;
  22994. stack.set(object, other);
  22995. stack.set(other, object);
  22996. var skipCtor = isPartial;
  22997. while (++index < objLength) {
  22998. key = objProps[index];
  22999. var objValue = object[key],
  23000. othValue = other[key];
  23001. if (customizer) {
  23002. var compared = isPartial
  23003. ? customizer(othValue, objValue, key, other, object, stack)
  23004. : customizer(objValue, othValue, key, object, other, stack);
  23005. }
  23006. // Recursively compare objects (susceptible to call stack limits).
  23007. if (!(compared === undefined
  23008. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23009. : compared
  23010. )) {
  23011. result = false;
  23012. break;
  23013. }
  23014. skipCtor || (skipCtor = key == 'constructor');
  23015. }
  23016. if (result && !skipCtor) {
  23017. var objCtor = object.constructor,
  23018. othCtor = other.constructor;
  23019. // Non `Object` object instances with different constructors are not equal.
  23020. if (objCtor != othCtor &&
  23021. ('constructor' in object && 'constructor' in other) &&
  23022. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23023. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23024. result = false;
  23025. }
  23026. }
  23027. stack['delete'](object);
  23028. stack['delete'](other);
  23029. return result;
  23030. }
  23031. /**
  23032. * A specialized version of `baseRest` which flattens the rest array.
  23033. *
  23034. * @private
  23035. * @param {Function} func The function to apply a rest parameter to.
  23036. * @returns {Function} Returns the new function.
  23037. */
  23038. function flatRest(func) {
  23039. return setToString(overRest(func, undefined, flatten), func + '');
  23040. }
  23041. /**
  23042. * Creates an array of own enumerable property names and symbols of `object`.
  23043. *
  23044. * @private
  23045. * @param {Object} object The object to query.
  23046. * @returns {Array} Returns the array of property names and symbols.
  23047. */
  23048. function getAllKeys(object) {
  23049. return baseGetAllKeys(object, keys, getSymbols);
  23050. }
  23051. /**
  23052. * Creates an array of own and inherited enumerable property names and
  23053. * symbols of `object`.
  23054. *
  23055. * @private
  23056. * @param {Object} object The object to query.
  23057. * @returns {Array} Returns the array of property names and symbols.
  23058. */
  23059. function getAllKeysIn(object) {
  23060. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23061. }
  23062. /**
  23063. * Gets metadata for `func`.
  23064. *
  23065. * @private
  23066. * @param {Function} func The function to query.
  23067. * @returns {*} Returns the metadata for `func`.
  23068. */
  23069. var getData = !metaMap ? noop : function(func) {
  23070. return metaMap.get(func);
  23071. };
  23072. /**
  23073. * Gets the name of `func`.
  23074. *
  23075. * @private
  23076. * @param {Function} func The function to query.
  23077. * @returns {string} Returns the function name.
  23078. */
  23079. function getFuncName(func) {
  23080. var result = (func.name + ''),
  23081. array = realNames[result],
  23082. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23083. while (length--) {
  23084. var data = array[length],
  23085. otherFunc = data.func;
  23086. if (otherFunc == null || otherFunc == func) {
  23087. return data.name;
  23088. }
  23089. }
  23090. return result;
  23091. }
  23092. /**
  23093. * Gets the argument placeholder value for `func`.
  23094. *
  23095. * @private
  23096. * @param {Function} func The function to inspect.
  23097. * @returns {*} Returns the placeholder value.
  23098. */
  23099. function getHolder(func) {
  23100. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23101. return object.placeholder;
  23102. }
  23103. /**
  23104. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23105. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23106. * If arguments are provided, the chosen function is invoked with them and
  23107. * its result is returned.
  23108. *
  23109. * @private
  23110. * @param {*} [value] The value to convert to an iteratee.
  23111. * @param {number} [arity] The arity of the created iteratee.
  23112. * @returns {Function} Returns the chosen function or its result.
  23113. */
  23114. function getIteratee() {
  23115. var result = lodash.iteratee || iteratee;
  23116. result = result === iteratee ? baseIteratee : result;
  23117. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23118. }
  23119. /**
  23120. * Gets the data for `map`.
  23121. *
  23122. * @private
  23123. * @param {Object} map The map to query.
  23124. * @param {string} key The reference key.
  23125. * @returns {*} Returns the map data.
  23126. */
  23127. function getMapData(map, key) {
  23128. var data = map.__data__;
  23129. return isKeyable(key)
  23130. ? data[typeof key == 'string' ? 'string' : 'hash']
  23131. : data.map;
  23132. }
  23133. /**
  23134. * Gets the property names, values, and compare flags of `object`.
  23135. *
  23136. * @private
  23137. * @param {Object} object The object to query.
  23138. * @returns {Array} Returns the match data of `object`.
  23139. */
  23140. function getMatchData(object) {
  23141. var result = keys(object),
  23142. length = result.length;
  23143. while (length--) {
  23144. var key = result[length],
  23145. value = object[key];
  23146. result[length] = [key, value, isStrictComparable(value)];
  23147. }
  23148. return result;
  23149. }
  23150. /**
  23151. * Gets the native function at `key` of `object`.
  23152. *
  23153. * @private
  23154. * @param {Object} object The object to query.
  23155. * @param {string} key The key of the method to get.
  23156. * @returns {*} Returns the function if it's native, else `undefined`.
  23157. */
  23158. function getNative(object, key) {
  23159. var value = getValue(object, key);
  23160. return baseIsNative(value) ? value : undefined;
  23161. }
  23162. /**
  23163. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23164. *
  23165. * @private
  23166. * @param {*} value The value to query.
  23167. * @returns {string} Returns the raw `toStringTag`.
  23168. */
  23169. function getRawTag(value) {
  23170. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23171. tag = value[symToStringTag];
  23172. try {
  23173. value[symToStringTag] = undefined;
  23174. var unmasked = true;
  23175. } catch (e) {}
  23176. var result = nativeObjectToString.call(value);
  23177. if (unmasked) {
  23178. if (isOwn) {
  23179. value[symToStringTag] = tag;
  23180. } else {
  23181. delete value[symToStringTag];
  23182. }
  23183. }
  23184. return result;
  23185. }
  23186. /**
  23187. * Creates an array of the own enumerable symbols of `object`.
  23188. *
  23189. * @private
  23190. * @param {Object} object The object to query.
  23191. * @returns {Array} Returns the array of symbols.
  23192. */
  23193. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23194. if (object == null) {
  23195. return [];
  23196. }
  23197. object = Object(object);
  23198. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23199. return propertyIsEnumerable.call(object, symbol);
  23200. });
  23201. };
  23202. /**
  23203. * Creates an array of the own and inherited enumerable symbols of `object`.
  23204. *
  23205. * @private
  23206. * @param {Object} object The object to query.
  23207. * @returns {Array} Returns the array of symbols.
  23208. */
  23209. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23210. var result = [];
  23211. while (object) {
  23212. arrayPush(result, getSymbols(object));
  23213. object = getPrototype(object);
  23214. }
  23215. return result;
  23216. };
  23217. /**
  23218. * Gets the `toStringTag` of `value`.
  23219. *
  23220. * @private
  23221. * @param {*} value The value to query.
  23222. * @returns {string} Returns the `toStringTag`.
  23223. */
  23224. var getTag = baseGetTag;
  23225. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23226. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23227. (Map && getTag(new Map) != mapTag) ||
  23228. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23229. (Set && getTag(new Set) != setTag) ||
  23230. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23231. getTag = function(value) {
  23232. var result = baseGetTag(value),
  23233. Ctor = result == objectTag ? value.constructor : undefined,
  23234. ctorString = Ctor ? toSource(Ctor) : '';
  23235. if (ctorString) {
  23236. switch (ctorString) {
  23237. case dataViewCtorString: return dataViewTag;
  23238. case mapCtorString: return mapTag;
  23239. case promiseCtorString: return promiseTag;
  23240. case setCtorString: return setTag;
  23241. case weakMapCtorString: return weakMapTag;
  23242. }
  23243. }
  23244. return result;
  23245. };
  23246. }
  23247. /**
  23248. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23249. *
  23250. * @private
  23251. * @param {number} start The start of the view.
  23252. * @param {number} end The end of the view.
  23253. * @param {Array} transforms The transformations to apply to the view.
  23254. * @returns {Object} Returns an object containing the `start` and `end`
  23255. * positions of the view.
  23256. */
  23257. function getView(start, end, transforms) {
  23258. var index = -1,
  23259. length = transforms.length;
  23260. while (++index < length) {
  23261. var data = transforms[index],
  23262. size = data.size;
  23263. switch (data.type) {
  23264. case 'drop': start += size; break;
  23265. case 'dropRight': end -= size; break;
  23266. case 'take': end = nativeMin(end, start + size); break;
  23267. case 'takeRight': start = nativeMax(start, end - size); break;
  23268. }
  23269. }
  23270. return { 'start': start, 'end': end };
  23271. }
  23272. /**
  23273. * Extracts wrapper details from the `source` body comment.
  23274. *
  23275. * @private
  23276. * @param {string} source The source to inspect.
  23277. * @returns {Array} Returns the wrapper details.
  23278. */
  23279. function getWrapDetails(source) {
  23280. var match = source.match(reWrapDetails);
  23281. return match ? match[1].split(reSplitDetails) : [];
  23282. }
  23283. /**
  23284. * Checks if `path` exists on `object`.
  23285. *
  23286. * @private
  23287. * @param {Object} object The object to query.
  23288. * @param {Array|string} path The path to check.
  23289. * @param {Function} hasFunc The function to check properties.
  23290. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23291. */
  23292. function hasPath(object, path, hasFunc) {
  23293. path = castPath(path, object);
  23294. var index = -1,
  23295. length = path.length,
  23296. result = false;
  23297. while (++index < length) {
  23298. var key = toKey(path[index]);
  23299. if (!(result = object != null && hasFunc(object, key))) {
  23300. break;
  23301. }
  23302. object = object[key];
  23303. }
  23304. if (result || ++index != length) {
  23305. return result;
  23306. }
  23307. length = object == null ? 0 : object.length;
  23308. return !!length && isLength(length) && isIndex(key, length) &&
  23309. (isArray(object) || isArguments(object));
  23310. }
  23311. /**
  23312. * Initializes an array clone.
  23313. *
  23314. * @private
  23315. * @param {Array} array The array to clone.
  23316. * @returns {Array} Returns the initialized clone.
  23317. */
  23318. function initCloneArray(array) {
  23319. var length = array.length,
  23320. result = new array.constructor(length);
  23321. // Add properties assigned by `RegExp#exec`.
  23322. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23323. result.index = array.index;
  23324. result.input = array.input;
  23325. }
  23326. return result;
  23327. }
  23328. /**
  23329. * Initializes an object clone.
  23330. *
  23331. * @private
  23332. * @param {Object} object The object to clone.
  23333. * @returns {Object} Returns the initialized clone.
  23334. */
  23335. function initCloneObject(object) {
  23336. return (typeof object.constructor == 'function' && !isPrototype(object))
  23337. ? baseCreate(getPrototype(object))
  23338. : {};
  23339. }
  23340. /**
  23341. * Initializes an object clone based on its `toStringTag`.
  23342. *
  23343. * **Note:** This function only supports cloning values with tags of
  23344. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23345. *
  23346. * @private
  23347. * @param {Object} object The object to clone.
  23348. * @param {string} tag The `toStringTag` of the object to clone.
  23349. * @param {boolean} [isDeep] Specify a deep clone.
  23350. * @returns {Object} Returns the initialized clone.
  23351. */
  23352. function initCloneByTag(object, tag, isDeep) {
  23353. var Ctor = object.constructor;
  23354. switch (tag) {
  23355. case arrayBufferTag:
  23356. return cloneArrayBuffer(object);
  23357. case boolTag:
  23358. case dateTag:
  23359. return new Ctor(+object);
  23360. case dataViewTag:
  23361. return cloneDataView(object, isDeep);
  23362. case float32Tag: case float64Tag:
  23363. case int8Tag: case int16Tag: case int32Tag:
  23364. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23365. return cloneTypedArray(object, isDeep);
  23366. case mapTag:
  23367. return new Ctor;
  23368. case numberTag:
  23369. case stringTag:
  23370. return new Ctor(object);
  23371. case regexpTag:
  23372. return cloneRegExp(object);
  23373. case setTag:
  23374. return new Ctor;
  23375. case symbolTag:
  23376. return cloneSymbol(object);
  23377. }
  23378. }
  23379. /**
  23380. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23381. *
  23382. * @private
  23383. * @param {string} source The source to modify.
  23384. * @returns {Array} details The details to insert.
  23385. * @returns {string} Returns the modified source.
  23386. */
  23387. function insertWrapDetails(source, details) {
  23388. var length = details.length;
  23389. if (!length) {
  23390. return source;
  23391. }
  23392. var lastIndex = length - 1;
  23393. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23394. details = details.join(length > 2 ? ', ' : ' ');
  23395. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23396. }
  23397. /**
  23398. * Checks if `value` is a flattenable `arguments` object or array.
  23399. *
  23400. * @private
  23401. * @param {*} value The value to check.
  23402. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23403. */
  23404. function isFlattenable(value) {
  23405. return isArray(value) || isArguments(value) ||
  23406. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23407. }
  23408. /**
  23409. * Checks if `value` is a valid array-like index.
  23410. *
  23411. * @private
  23412. * @param {*} value The value to check.
  23413. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23414. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23415. */
  23416. function isIndex(value, length) {
  23417. var type = typeof value;
  23418. length = length == null ? MAX_SAFE_INTEGER : length;
  23419. return !!length &&
  23420. (type == 'number' ||
  23421. (type != 'symbol' && reIsUint.test(value))) &&
  23422. (value > -1 && value % 1 == 0 && value < length);
  23423. }
  23424. /**
  23425. * Checks if the given arguments are from an iteratee call.
  23426. *
  23427. * @private
  23428. * @param {*} value The potential iteratee value argument.
  23429. * @param {*} index The potential iteratee index or key argument.
  23430. * @param {*} object The potential iteratee object argument.
  23431. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23432. * else `false`.
  23433. */
  23434. function isIterateeCall(value, index, object) {
  23435. if (!isObject(object)) {
  23436. return false;
  23437. }
  23438. var type = typeof index;
  23439. if (type == 'number'
  23440. ? (isArrayLike(object) && isIndex(index, object.length))
  23441. : (type == 'string' && index in object)
  23442. ) {
  23443. return eq(object[index], value);
  23444. }
  23445. return false;
  23446. }
  23447. /**
  23448. * Checks if `value` is a property name and not a property path.
  23449. *
  23450. * @private
  23451. * @param {*} value The value to check.
  23452. * @param {Object} [object] The object to query keys on.
  23453. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23454. */
  23455. function isKey(value, object) {
  23456. if (isArray(value)) {
  23457. return false;
  23458. }
  23459. var type = typeof value;
  23460. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23461. value == null || isSymbol(value)) {
  23462. return true;
  23463. }
  23464. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23465. (object != null && value in Object(object));
  23466. }
  23467. /**
  23468. * Checks if `value` is suitable for use as unique object key.
  23469. *
  23470. * @private
  23471. * @param {*} value The value to check.
  23472. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23473. */
  23474. function isKeyable(value) {
  23475. var type = typeof value;
  23476. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23477. ? (value !== '__proto__')
  23478. : (value === null);
  23479. }
  23480. /**
  23481. * Checks if `func` has a lazy counterpart.
  23482. *
  23483. * @private
  23484. * @param {Function} func The function to check.
  23485. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23486. * else `false`.
  23487. */
  23488. function isLaziable(func) {
  23489. var funcName = getFuncName(func),
  23490. other = lodash[funcName];
  23491. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23492. return false;
  23493. }
  23494. if (func === other) {
  23495. return true;
  23496. }
  23497. var data = getData(other);
  23498. return !!data && func === data[0];
  23499. }
  23500. /**
  23501. * Checks if `func` has its source masked.
  23502. *
  23503. * @private
  23504. * @param {Function} func The function to check.
  23505. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23506. */
  23507. function isMasked(func) {
  23508. return !!maskSrcKey && (maskSrcKey in func);
  23509. }
  23510. /**
  23511. * Checks if `func` is capable of being masked.
  23512. *
  23513. * @private
  23514. * @param {*} value The value to check.
  23515. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23516. */
  23517. var isMaskable = coreJsData ? isFunction : stubFalse;
  23518. /**
  23519. * Checks if `value` is likely a prototype object.
  23520. *
  23521. * @private
  23522. * @param {*} value The value to check.
  23523. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23524. */
  23525. function isPrototype(value) {
  23526. var Ctor = value && value.constructor,
  23527. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23528. return value === proto;
  23529. }
  23530. /**
  23531. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23532. *
  23533. * @private
  23534. * @param {*} value The value to check.
  23535. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23536. * equality comparisons, else `false`.
  23537. */
  23538. function isStrictComparable(value) {
  23539. return value === value && !isObject(value);
  23540. }
  23541. /**
  23542. * A specialized version of `matchesProperty` for source values suitable
  23543. * for strict equality comparisons, i.e. `===`.
  23544. *
  23545. * @private
  23546. * @param {string} key The key of the property to get.
  23547. * @param {*} srcValue The value to match.
  23548. * @returns {Function} Returns the new spec function.
  23549. */
  23550. function matchesStrictComparable(key, srcValue) {
  23551. return function(object) {
  23552. if (object == null) {
  23553. return false;
  23554. }
  23555. return object[key] === srcValue &&
  23556. (srcValue !== undefined || (key in Object(object)));
  23557. };
  23558. }
  23559. /**
  23560. * A specialized version of `_.memoize` which clears the memoized function's
  23561. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23562. *
  23563. * @private
  23564. * @param {Function} func The function to have its output memoized.
  23565. * @returns {Function} Returns the new memoized function.
  23566. */
  23567. function memoizeCapped(func) {
  23568. var result = memoize(func, function(key) {
  23569. if (cache.size === MAX_MEMOIZE_SIZE) {
  23570. cache.clear();
  23571. }
  23572. return key;
  23573. });
  23574. var cache = result.cache;
  23575. return result;
  23576. }
  23577. /**
  23578. * Merges the function metadata of `source` into `data`.
  23579. *
  23580. * Merging metadata reduces the number of wrappers used to invoke a function.
  23581. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23582. * may be applied regardless of execution order. Methods like `_.ary` and
  23583. * `_.rearg` modify function arguments, making the order in which they are
  23584. * executed important, preventing the merging of metadata. However, we make
  23585. * an exception for a safe combined case where curried functions have `_.ary`
  23586. * and or `_.rearg` applied.
  23587. *
  23588. * @private
  23589. * @param {Array} data The destination metadata.
  23590. * @param {Array} source The source metadata.
  23591. * @returns {Array} Returns `data`.
  23592. */
  23593. function mergeData(data, source) {
  23594. var bitmask = data[1],
  23595. srcBitmask = source[1],
  23596. newBitmask = bitmask | srcBitmask,
  23597. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23598. var isCombo =
  23599. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23600. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23601. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23602. // Exit early if metadata can't be merged.
  23603. if (!(isCommon || isCombo)) {
  23604. return data;
  23605. }
  23606. // Use source `thisArg` if available.
  23607. if (srcBitmask & WRAP_BIND_FLAG) {
  23608. data[2] = source[2];
  23609. // Set when currying a bound function.
  23610. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23611. }
  23612. // Compose partial arguments.
  23613. var value = source[3];
  23614. if (value) {
  23615. var partials = data[3];
  23616. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23617. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23618. }
  23619. // Compose partial right arguments.
  23620. value = source[5];
  23621. if (value) {
  23622. partials = data[5];
  23623. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23624. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23625. }
  23626. // Use source `argPos` if available.
  23627. value = source[7];
  23628. if (value) {
  23629. data[7] = value;
  23630. }
  23631. // Use source `ary` if it's smaller.
  23632. if (srcBitmask & WRAP_ARY_FLAG) {
  23633. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23634. }
  23635. // Use source `arity` if one is not provided.
  23636. if (data[9] == null) {
  23637. data[9] = source[9];
  23638. }
  23639. // Use source `func` and merge bitmasks.
  23640. data[0] = source[0];
  23641. data[1] = newBitmask;
  23642. return data;
  23643. }
  23644. /**
  23645. * This function is like
  23646. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23647. * except that it includes inherited enumerable properties.
  23648. *
  23649. * @private
  23650. * @param {Object} object The object to query.
  23651. * @returns {Array} Returns the array of property names.
  23652. */
  23653. function nativeKeysIn(object) {
  23654. var result = [];
  23655. if (object != null) {
  23656. for (var key in Object(object)) {
  23657. result.push(key);
  23658. }
  23659. }
  23660. return result;
  23661. }
  23662. /**
  23663. * Converts `value` to a string using `Object.prototype.toString`.
  23664. *
  23665. * @private
  23666. * @param {*} value The value to convert.
  23667. * @returns {string} Returns the converted string.
  23668. */
  23669. function objectToString(value) {
  23670. return nativeObjectToString.call(value);
  23671. }
  23672. /**
  23673. * A specialized version of `baseRest` which transforms the rest array.
  23674. *
  23675. * @private
  23676. * @param {Function} func The function to apply a rest parameter to.
  23677. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23678. * @param {Function} transform The rest array transform.
  23679. * @returns {Function} Returns the new function.
  23680. */
  23681. function overRest(func, start, transform) {
  23682. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23683. return function() {
  23684. var args = arguments,
  23685. index = -1,
  23686. length = nativeMax(args.length - start, 0),
  23687. array = Array(length);
  23688. while (++index < length) {
  23689. array[index] = args[start + index];
  23690. }
  23691. index = -1;
  23692. var otherArgs = Array(start + 1);
  23693. while (++index < start) {
  23694. otherArgs[index] = args[index];
  23695. }
  23696. otherArgs[start] = transform(array);
  23697. return apply(func, this, otherArgs);
  23698. };
  23699. }
  23700. /**
  23701. * Gets the parent value at `path` of `object`.
  23702. *
  23703. * @private
  23704. * @param {Object} object The object to query.
  23705. * @param {Array} path The path to get the parent value of.
  23706. * @returns {*} Returns the parent value.
  23707. */
  23708. function parent(object, path) {
  23709. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  23710. }
  23711. /**
  23712. * Reorder `array` according to the specified indexes where the element at
  23713. * the first index is assigned as the first element, the element at
  23714. * the second index is assigned as the second element, and so on.
  23715. *
  23716. * @private
  23717. * @param {Array} array The array to reorder.
  23718. * @param {Array} indexes The arranged array indexes.
  23719. * @returns {Array} Returns `array`.
  23720. */
  23721. function reorder(array, indexes) {
  23722. var arrLength = array.length,
  23723. length = nativeMin(indexes.length, arrLength),
  23724. oldArray = copyArray(array);
  23725. while (length--) {
  23726. var index = indexes[length];
  23727. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  23728. }
  23729. return array;
  23730. }
  23731. /**
  23732. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  23733. *
  23734. * @private
  23735. * @param {Object} object The object to query.
  23736. * @param {string} key The key of the property to get.
  23737. * @returns {*} Returns the property value.
  23738. */
  23739. function safeGet(object, key) {
  23740. if (key === 'constructor' && typeof object[key] === 'function') {
  23741. return;
  23742. }
  23743. if (key == '__proto__') {
  23744. return;
  23745. }
  23746. return object[key];
  23747. }
  23748. /**
  23749. * Sets metadata for `func`.
  23750. *
  23751. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  23752. * period of time, it will trip its breaker and transition to an identity
  23753. * function to avoid garbage collection pauses in V8. See
  23754. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  23755. * for more details.
  23756. *
  23757. * @private
  23758. * @param {Function} func The function to associate metadata with.
  23759. * @param {*} data The metadata.
  23760. * @returns {Function} Returns `func`.
  23761. */
  23762. var setData = shortOut(baseSetData);
  23763. /**
  23764. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  23765. *
  23766. * @private
  23767. * @param {Function} func The function to delay.
  23768. * @param {number} wait The number of milliseconds to delay invocation.
  23769. * @returns {number|Object} Returns the timer id or timeout object.
  23770. */
  23771. var setTimeout = ctxSetTimeout || function(func, wait) {
  23772. return root.setTimeout(func, wait);
  23773. };
  23774. /**
  23775. * Sets the `toString` method of `func` to return `string`.
  23776. *
  23777. * @private
  23778. * @param {Function} func The function to modify.
  23779. * @param {Function} string The `toString` result.
  23780. * @returns {Function} Returns `func`.
  23781. */
  23782. var setToString = shortOut(baseSetToString);
  23783. /**
  23784. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  23785. * with wrapper details in a comment at the top of the source body.
  23786. *
  23787. * @private
  23788. * @param {Function} wrapper The function to modify.
  23789. * @param {Function} reference The reference function.
  23790. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23791. * @returns {Function} Returns `wrapper`.
  23792. */
  23793. function setWrapToString(wrapper, reference, bitmask) {
  23794. var source = (reference + '');
  23795. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  23796. }
  23797. /**
  23798. * Creates a function that'll short out and invoke `identity` instead
  23799. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  23800. * milliseconds.
  23801. *
  23802. * @private
  23803. * @param {Function} func The function to restrict.
  23804. * @returns {Function} Returns the new shortable function.
  23805. */
  23806. function shortOut(func) {
  23807. var count = 0,
  23808. lastCalled = 0;
  23809. return function() {
  23810. var stamp = nativeNow(),
  23811. remaining = HOT_SPAN - (stamp - lastCalled);
  23812. lastCalled = stamp;
  23813. if (remaining > 0) {
  23814. if (++count >= HOT_COUNT) {
  23815. return arguments[0];
  23816. }
  23817. } else {
  23818. count = 0;
  23819. }
  23820. return func.apply(undefined, arguments);
  23821. };
  23822. }
  23823. /**
  23824. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  23825. *
  23826. * @private
  23827. * @param {Array} array The array to shuffle.
  23828. * @param {number} [size=array.length] The size of `array`.
  23829. * @returns {Array} Returns `array`.
  23830. */
  23831. function shuffleSelf(array, size) {
  23832. var index = -1,
  23833. length = array.length,
  23834. lastIndex = length - 1;
  23835. size = size === undefined ? length : size;
  23836. while (++index < size) {
  23837. var rand = baseRandom(index, lastIndex),
  23838. value = array[rand];
  23839. array[rand] = array[index];
  23840. array[index] = value;
  23841. }
  23842. array.length = size;
  23843. return array;
  23844. }
  23845. /**
  23846. * Converts `string` to a property path array.
  23847. *
  23848. * @private
  23849. * @param {string} string The string to convert.
  23850. * @returns {Array} Returns the property path array.
  23851. */
  23852. var stringToPath = memoizeCapped(function(string) {
  23853. var result = [];
  23854. if (string.charCodeAt(0) === 46 /* . */) {
  23855. result.push('');
  23856. }
  23857. string.replace(rePropName, function(match, number, quote, subString) {
  23858. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  23859. });
  23860. return result;
  23861. });
  23862. /**
  23863. * Converts `value` to a string key if it's not a string or symbol.
  23864. *
  23865. * @private
  23866. * @param {*} value The value to inspect.
  23867. * @returns {string|symbol} Returns the key.
  23868. */
  23869. function toKey(value) {
  23870. if (typeof value == 'string' || isSymbol(value)) {
  23871. return value;
  23872. }
  23873. var result = (value + '');
  23874. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  23875. }
  23876. /**
  23877. * Converts `func` to its source code.
  23878. *
  23879. * @private
  23880. * @param {Function} func The function to convert.
  23881. * @returns {string} Returns the source code.
  23882. */
  23883. function toSource(func) {
  23884. if (func != null) {
  23885. try {
  23886. return funcToString.call(func);
  23887. } catch (e) {}
  23888. try {
  23889. return (func + '');
  23890. } catch (e) {}
  23891. }
  23892. return '';
  23893. }
  23894. /**
  23895. * Updates wrapper `details` based on `bitmask` flags.
  23896. *
  23897. * @private
  23898. * @returns {Array} details The details to modify.
  23899. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23900. * @returns {Array} Returns `details`.
  23901. */
  23902. function updateWrapDetails(details, bitmask) {
  23903. arrayEach(wrapFlags, function(pair) {
  23904. var value = '_.' + pair[0];
  23905. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  23906. details.push(value);
  23907. }
  23908. });
  23909. return details.sort();
  23910. }
  23911. /**
  23912. * Creates a clone of `wrapper`.
  23913. *
  23914. * @private
  23915. * @param {Object} wrapper The wrapper to clone.
  23916. * @returns {Object} Returns the cloned wrapper.
  23917. */
  23918. function wrapperClone(wrapper) {
  23919. if (wrapper instanceof LazyWrapper) {
  23920. return wrapper.clone();
  23921. }
  23922. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  23923. result.__actions__ = copyArray(wrapper.__actions__);
  23924. result.__index__ = wrapper.__index__;
  23925. result.__values__ = wrapper.__values__;
  23926. return result;
  23927. }
  23928. /*------------------------------------------------------------------------*/
  23929. /**
  23930. * Creates an array of elements split into groups the length of `size`.
  23931. * If `array` can't be split evenly, the final chunk will be the remaining
  23932. * elements.
  23933. *
  23934. * @static
  23935. * @memberOf _
  23936. * @since 3.0.0
  23937. * @category Array
  23938. * @param {Array} array The array to process.
  23939. * @param {number} [size=1] The length of each chunk
  23940. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  23941. * @returns {Array} Returns the new array of chunks.
  23942. * @example
  23943. *
  23944. * _.chunk(['a', 'b', 'c', 'd'], 2);
  23945. * // => [['a', 'b'], ['c', 'd']]
  23946. *
  23947. * _.chunk(['a', 'b', 'c', 'd'], 3);
  23948. * // => [['a', 'b', 'c'], ['d']]
  23949. */
  23950. function chunk(array, size, guard) {
  23951. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  23952. size = 1;
  23953. } else {
  23954. size = nativeMax(toInteger(size), 0);
  23955. }
  23956. var length = array == null ? 0 : array.length;
  23957. if (!length || size < 1) {
  23958. return [];
  23959. }
  23960. var index = 0,
  23961. resIndex = 0,
  23962. result = Array(nativeCeil(length / size));
  23963. while (index < length) {
  23964. result[resIndex++] = baseSlice(array, index, (index += size));
  23965. }
  23966. return result;
  23967. }
  23968. /**
  23969. * Creates an array with all falsey values removed. The values `false`, `null`,
  23970. * `0`, `""`, `undefined`, and `NaN` are falsey.
  23971. *
  23972. * @static
  23973. * @memberOf _
  23974. * @since 0.1.0
  23975. * @category Array
  23976. * @param {Array} array The array to compact.
  23977. * @returns {Array} Returns the new array of filtered values.
  23978. * @example
  23979. *
  23980. * _.compact([0, 1, false, 2, '', 3]);
  23981. * // => [1, 2, 3]
  23982. */
  23983. function compact(array) {
  23984. var index = -1,
  23985. length = array == null ? 0 : array.length,
  23986. resIndex = 0,
  23987. result = [];
  23988. while (++index < length) {
  23989. var value = array[index];
  23990. if (value) {
  23991. result[resIndex++] = value;
  23992. }
  23993. }
  23994. return result;
  23995. }
  23996. /**
  23997. * Creates a new array concatenating `array` with any additional arrays
  23998. * and/or values.
  23999. *
  24000. * @static
  24001. * @memberOf _
  24002. * @since 4.0.0
  24003. * @category Array
  24004. * @param {Array} array The array to concatenate.
  24005. * @param {...*} [values] The values to concatenate.
  24006. * @returns {Array} Returns the new concatenated array.
  24007. * @example
  24008. *
  24009. * var array = [1];
  24010. * var other = _.concat(array, 2, [3], [[4]]);
  24011. *
  24012. * console.log(other);
  24013. * // => [1, 2, 3, [4]]
  24014. *
  24015. * console.log(array);
  24016. * // => [1]
  24017. */
  24018. function concat() {
  24019. var length = arguments.length;
  24020. if (!length) {
  24021. return [];
  24022. }
  24023. var args = Array(length - 1),
  24024. array = arguments[0],
  24025. index = length;
  24026. while (index--) {
  24027. args[index - 1] = arguments[index];
  24028. }
  24029. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24030. }
  24031. /**
  24032. * Creates an array of `array` values not included in the other given arrays
  24033. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24034. * for equality comparisons. The order and references of result values are
  24035. * determined by the first array.
  24036. *
  24037. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24038. *
  24039. * @static
  24040. * @memberOf _
  24041. * @since 0.1.0
  24042. * @category Array
  24043. * @param {Array} array The array to inspect.
  24044. * @param {...Array} [values] The values to exclude.
  24045. * @returns {Array} Returns the new array of filtered values.
  24046. * @see _.without, _.xor
  24047. * @example
  24048. *
  24049. * _.difference([2, 1], [2, 3]);
  24050. * // => [1]
  24051. */
  24052. var difference = baseRest(function(array, values) {
  24053. return isArrayLikeObject(array)
  24054. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24055. : [];
  24056. });
  24057. /**
  24058. * This method is like `_.difference` except that it accepts `iteratee` which
  24059. * is invoked for each element of `array` and `values` to generate the criterion
  24060. * by which they're compared. The order and references of result values are
  24061. * determined by the first array. The iteratee is invoked with one argument:
  24062. * (value).
  24063. *
  24064. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24065. *
  24066. * @static
  24067. * @memberOf _
  24068. * @since 4.0.0
  24069. * @category Array
  24070. * @param {Array} array The array to inspect.
  24071. * @param {...Array} [values] The values to exclude.
  24072. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24073. * @returns {Array} Returns the new array of filtered values.
  24074. * @example
  24075. *
  24076. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24077. * // => [1.2]
  24078. *
  24079. * // The `_.property` iteratee shorthand.
  24080. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24081. * // => [{ 'x': 2 }]
  24082. */
  24083. var differenceBy = baseRest(function(array, values) {
  24084. var iteratee = last(values);
  24085. if (isArrayLikeObject(iteratee)) {
  24086. iteratee = undefined;
  24087. }
  24088. return isArrayLikeObject(array)
  24089. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24090. : [];
  24091. });
  24092. /**
  24093. * This method is like `_.difference` except that it accepts `comparator`
  24094. * which is invoked to compare elements of `array` to `values`. The order and
  24095. * references of result values are determined by the first array. The comparator
  24096. * is invoked with two arguments: (arrVal, othVal).
  24097. *
  24098. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24099. *
  24100. * @static
  24101. * @memberOf _
  24102. * @since 4.0.0
  24103. * @category Array
  24104. * @param {Array} array The array to inspect.
  24105. * @param {...Array} [values] The values to exclude.
  24106. * @param {Function} [comparator] The comparator invoked per element.
  24107. * @returns {Array} Returns the new array of filtered values.
  24108. * @example
  24109. *
  24110. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24111. *
  24112. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24113. * // => [{ 'x': 2, 'y': 1 }]
  24114. */
  24115. var differenceWith = baseRest(function(array, values) {
  24116. var comparator = last(values);
  24117. if (isArrayLikeObject(comparator)) {
  24118. comparator = undefined;
  24119. }
  24120. return isArrayLikeObject(array)
  24121. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24122. : [];
  24123. });
  24124. /**
  24125. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24126. *
  24127. * @static
  24128. * @memberOf _
  24129. * @since 0.5.0
  24130. * @category Array
  24131. * @param {Array} array The array to query.
  24132. * @param {number} [n=1] The number of elements to drop.
  24133. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24134. * @returns {Array} Returns the slice of `array`.
  24135. * @example
  24136. *
  24137. * _.drop([1, 2, 3]);
  24138. * // => [2, 3]
  24139. *
  24140. * _.drop([1, 2, 3], 2);
  24141. * // => [3]
  24142. *
  24143. * _.drop([1, 2, 3], 5);
  24144. * // => []
  24145. *
  24146. * _.drop([1, 2, 3], 0);
  24147. * // => [1, 2, 3]
  24148. */
  24149. function drop(array, n, guard) {
  24150. var length = array == null ? 0 : array.length;
  24151. if (!length) {
  24152. return [];
  24153. }
  24154. n = (guard || n === undefined) ? 1 : toInteger(n);
  24155. return baseSlice(array, n < 0 ? 0 : n, length);
  24156. }
  24157. /**
  24158. * Creates a slice of `array` with `n` elements dropped from the end.
  24159. *
  24160. * @static
  24161. * @memberOf _
  24162. * @since 3.0.0
  24163. * @category Array
  24164. * @param {Array} array The array to query.
  24165. * @param {number} [n=1] The number of elements to drop.
  24166. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24167. * @returns {Array} Returns the slice of `array`.
  24168. * @example
  24169. *
  24170. * _.dropRight([1, 2, 3]);
  24171. * // => [1, 2]
  24172. *
  24173. * _.dropRight([1, 2, 3], 2);
  24174. * // => [1]
  24175. *
  24176. * _.dropRight([1, 2, 3], 5);
  24177. * // => []
  24178. *
  24179. * _.dropRight([1, 2, 3], 0);
  24180. * // => [1, 2, 3]
  24181. */
  24182. function dropRight(array, n, guard) {
  24183. var length = array == null ? 0 : array.length;
  24184. if (!length) {
  24185. return [];
  24186. }
  24187. n = (guard || n === undefined) ? 1 : toInteger(n);
  24188. n = length - n;
  24189. return baseSlice(array, 0, n < 0 ? 0 : n);
  24190. }
  24191. /**
  24192. * Creates a slice of `array` excluding elements dropped from the end.
  24193. * Elements are dropped until `predicate` returns falsey. The predicate is
  24194. * invoked with three arguments: (value, index, array).
  24195. *
  24196. * @static
  24197. * @memberOf _
  24198. * @since 3.0.0
  24199. * @category Array
  24200. * @param {Array} array The array to query.
  24201. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24202. * @returns {Array} Returns the slice of `array`.
  24203. * @example
  24204. *
  24205. * var users = [
  24206. * { 'user': 'barney', 'active': true },
  24207. * { 'user': 'fred', 'active': false },
  24208. * { 'user': 'pebbles', 'active': false }
  24209. * ];
  24210. *
  24211. * _.dropRightWhile(users, function(o) { return !o.active; });
  24212. * // => objects for ['barney']
  24213. *
  24214. * // The `_.matches` iteratee shorthand.
  24215. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24216. * // => objects for ['barney', 'fred']
  24217. *
  24218. * // The `_.matchesProperty` iteratee shorthand.
  24219. * _.dropRightWhile(users, ['active', false]);
  24220. * // => objects for ['barney']
  24221. *
  24222. * // The `_.property` iteratee shorthand.
  24223. * _.dropRightWhile(users, 'active');
  24224. * // => objects for ['barney', 'fred', 'pebbles']
  24225. */
  24226. function dropRightWhile(array, predicate) {
  24227. return (array && array.length)
  24228. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24229. : [];
  24230. }
  24231. /**
  24232. * Creates a slice of `array` excluding elements dropped from the beginning.
  24233. * Elements are dropped until `predicate` returns falsey. The predicate is
  24234. * invoked with three arguments: (value, index, array).
  24235. *
  24236. * @static
  24237. * @memberOf _
  24238. * @since 3.0.0
  24239. * @category Array
  24240. * @param {Array} array The array to query.
  24241. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24242. * @returns {Array} Returns the slice of `array`.
  24243. * @example
  24244. *
  24245. * var users = [
  24246. * { 'user': 'barney', 'active': false },
  24247. * { 'user': 'fred', 'active': false },
  24248. * { 'user': 'pebbles', 'active': true }
  24249. * ];
  24250. *
  24251. * _.dropWhile(users, function(o) { return !o.active; });
  24252. * // => objects for ['pebbles']
  24253. *
  24254. * // The `_.matches` iteratee shorthand.
  24255. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24256. * // => objects for ['fred', 'pebbles']
  24257. *
  24258. * // The `_.matchesProperty` iteratee shorthand.
  24259. * _.dropWhile(users, ['active', false]);
  24260. * // => objects for ['pebbles']
  24261. *
  24262. * // The `_.property` iteratee shorthand.
  24263. * _.dropWhile(users, 'active');
  24264. * // => objects for ['barney', 'fred', 'pebbles']
  24265. */
  24266. function dropWhile(array, predicate) {
  24267. return (array && array.length)
  24268. ? baseWhile(array, getIteratee(predicate, 3), true)
  24269. : [];
  24270. }
  24271. /**
  24272. * Fills elements of `array` with `value` from `start` up to, but not
  24273. * including, `end`.
  24274. *
  24275. * **Note:** This method mutates `array`.
  24276. *
  24277. * @static
  24278. * @memberOf _
  24279. * @since 3.2.0
  24280. * @category Array
  24281. * @param {Array} array The array to fill.
  24282. * @param {*} value The value to fill `array` with.
  24283. * @param {number} [start=0] The start position.
  24284. * @param {number} [end=array.length] The end position.
  24285. * @returns {Array} Returns `array`.
  24286. * @example
  24287. *
  24288. * var array = [1, 2, 3];
  24289. *
  24290. * _.fill(array, 'a');
  24291. * console.log(array);
  24292. * // => ['a', 'a', 'a']
  24293. *
  24294. * _.fill(Array(3), 2);
  24295. * // => [2, 2, 2]
  24296. *
  24297. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24298. * // => [4, '*', '*', 10]
  24299. */
  24300. function fill(array, value, start, end) {
  24301. var length = array == null ? 0 : array.length;
  24302. if (!length) {
  24303. return [];
  24304. }
  24305. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24306. start = 0;
  24307. end = length;
  24308. }
  24309. return baseFill(array, value, start, end);
  24310. }
  24311. /**
  24312. * This method is like `_.find` except that it returns the index of the first
  24313. * element `predicate` returns truthy for instead of the element itself.
  24314. *
  24315. * @static
  24316. * @memberOf _
  24317. * @since 1.1.0
  24318. * @category Array
  24319. * @param {Array} array The array to inspect.
  24320. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24321. * @param {number} [fromIndex=0] The index to search from.
  24322. * @returns {number} Returns the index of the found element, else `-1`.
  24323. * @example
  24324. *
  24325. * var users = [
  24326. * { 'user': 'barney', 'active': false },
  24327. * { 'user': 'fred', 'active': false },
  24328. * { 'user': 'pebbles', 'active': true }
  24329. * ];
  24330. *
  24331. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24332. * // => 0
  24333. *
  24334. * // The `_.matches` iteratee shorthand.
  24335. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24336. * // => 1
  24337. *
  24338. * // The `_.matchesProperty` iteratee shorthand.
  24339. * _.findIndex(users, ['active', false]);
  24340. * // => 0
  24341. *
  24342. * // The `_.property` iteratee shorthand.
  24343. * _.findIndex(users, 'active');
  24344. * // => 2
  24345. */
  24346. function findIndex(array, predicate, fromIndex) {
  24347. var length = array == null ? 0 : array.length;
  24348. if (!length) {
  24349. return -1;
  24350. }
  24351. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24352. if (index < 0) {
  24353. index = nativeMax(length + index, 0);
  24354. }
  24355. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24356. }
  24357. /**
  24358. * This method is like `_.findIndex` except that it iterates over elements
  24359. * of `collection` from right to left.
  24360. *
  24361. * @static
  24362. * @memberOf _
  24363. * @since 2.0.0
  24364. * @category Array
  24365. * @param {Array} array The array to inspect.
  24366. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24367. * @param {number} [fromIndex=array.length-1] The index to search from.
  24368. * @returns {number} Returns the index of the found element, else `-1`.
  24369. * @example
  24370. *
  24371. * var users = [
  24372. * { 'user': 'barney', 'active': true },
  24373. * { 'user': 'fred', 'active': false },
  24374. * { 'user': 'pebbles', 'active': false }
  24375. * ];
  24376. *
  24377. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24378. * // => 2
  24379. *
  24380. * // The `_.matches` iteratee shorthand.
  24381. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24382. * // => 0
  24383. *
  24384. * // The `_.matchesProperty` iteratee shorthand.
  24385. * _.findLastIndex(users, ['active', false]);
  24386. * // => 2
  24387. *
  24388. * // The `_.property` iteratee shorthand.
  24389. * _.findLastIndex(users, 'active');
  24390. * // => 0
  24391. */
  24392. function findLastIndex(array, predicate, fromIndex) {
  24393. var length = array == null ? 0 : array.length;
  24394. if (!length) {
  24395. return -1;
  24396. }
  24397. var index = length - 1;
  24398. if (fromIndex !== undefined) {
  24399. index = toInteger(fromIndex);
  24400. index = fromIndex < 0
  24401. ? nativeMax(length + index, 0)
  24402. : nativeMin(index, length - 1);
  24403. }
  24404. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24405. }
  24406. /**
  24407. * Flattens `array` a single level deep.
  24408. *
  24409. * @static
  24410. * @memberOf _
  24411. * @since 0.1.0
  24412. * @category Array
  24413. * @param {Array} array The array to flatten.
  24414. * @returns {Array} Returns the new flattened array.
  24415. * @example
  24416. *
  24417. * _.flatten([1, [2, [3, [4]], 5]]);
  24418. * // => [1, 2, [3, [4]], 5]
  24419. */
  24420. function flatten(array) {
  24421. var length = array == null ? 0 : array.length;
  24422. return length ? baseFlatten(array, 1) : [];
  24423. }
  24424. /**
  24425. * Recursively flattens `array`.
  24426. *
  24427. * @static
  24428. * @memberOf _
  24429. * @since 3.0.0
  24430. * @category Array
  24431. * @param {Array} array The array to flatten.
  24432. * @returns {Array} Returns the new flattened array.
  24433. * @example
  24434. *
  24435. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24436. * // => [1, 2, 3, 4, 5]
  24437. */
  24438. function flattenDeep(array) {
  24439. var length = array == null ? 0 : array.length;
  24440. return length ? baseFlatten(array, INFINITY) : [];
  24441. }
  24442. /**
  24443. * Recursively flatten `array` up to `depth` times.
  24444. *
  24445. * @static
  24446. * @memberOf _
  24447. * @since 4.4.0
  24448. * @category Array
  24449. * @param {Array} array The array to flatten.
  24450. * @param {number} [depth=1] The maximum recursion depth.
  24451. * @returns {Array} Returns the new flattened array.
  24452. * @example
  24453. *
  24454. * var array = [1, [2, [3, [4]], 5]];
  24455. *
  24456. * _.flattenDepth(array, 1);
  24457. * // => [1, 2, [3, [4]], 5]
  24458. *
  24459. * _.flattenDepth(array, 2);
  24460. * // => [1, 2, 3, [4], 5]
  24461. */
  24462. function flattenDepth(array, depth) {
  24463. var length = array == null ? 0 : array.length;
  24464. if (!length) {
  24465. return [];
  24466. }
  24467. depth = depth === undefined ? 1 : toInteger(depth);
  24468. return baseFlatten(array, depth);
  24469. }
  24470. /**
  24471. * The inverse of `_.toPairs`; this method returns an object composed
  24472. * from key-value `pairs`.
  24473. *
  24474. * @static
  24475. * @memberOf _
  24476. * @since 4.0.0
  24477. * @category Array
  24478. * @param {Array} pairs The key-value pairs.
  24479. * @returns {Object} Returns the new object.
  24480. * @example
  24481. *
  24482. * _.fromPairs([['a', 1], ['b', 2]]);
  24483. * // => { 'a': 1, 'b': 2 }
  24484. */
  24485. function fromPairs(pairs) {
  24486. var index = -1,
  24487. length = pairs == null ? 0 : pairs.length,
  24488. result = {};
  24489. while (++index < length) {
  24490. var pair = pairs[index];
  24491. result[pair[0]] = pair[1];
  24492. }
  24493. return result;
  24494. }
  24495. /**
  24496. * Gets the first element of `array`.
  24497. *
  24498. * @static
  24499. * @memberOf _
  24500. * @since 0.1.0
  24501. * @alias first
  24502. * @category Array
  24503. * @param {Array} array The array to query.
  24504. * @returns {*} Returns the first element of `array`.
  24505. * @example
  24506. *
  24507. * _.head([1, 2, 3]);
  24508. * // => 1
  24509. *
  24510. * _.head([]);
  24511. * // => undefined
  24512. */
  24513. function head(array) {
  24514. return (array && array.length) ? array[0] : undefined;
  24515. }
  24516. /**
  24517. * Gets the index at which the first occurrence of `value` is found in `array`
  24518. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24519. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24520. * offset from the end of `array`.
  24521. *
  24522. * @static
  24523. * @memberOf _
  24524. * @since 0.1.0
  24525. * @category Array
  24526. * @param {Array} array The array to inspect.
  24527. * @param {*} value The value to search for.
  24528. * @param {number} [fromIndex=0] The index to search from.
  24529. * @returns {number} Returns the index of the matched value, else `-1`.
  24530. * @example
  24531. *
  24532. * _.indexOf([1, 2, 1, 2], 2);
  24533. * // => 1
  24534. *
  24535. * // Search from the `fromIndex`.
  24536. * _.indexOf([1, 2, 1, 2], 2, 2);
  24537. * // => 3
  24538. */
  24539. function indexOf(array, value, fromIndex) {
  24540. var length = array == null ? 0 : array.length;
  24541. if (!length) {
  24542. return -1;
  24543. }
  24544. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24545. if (index < 0) {
  24546. index = nativeMax(length + index, 0);
  24547. }
  24548. return baseIndexOf(array, value, index);
  24549. }
  24550. /**
  24551. * Gets all but the last element of `array`.
  24552. *
  24553. * @static
  24554. * @memberOf _
  24555. * @since 0.1.0
  24556. * @category Array
  24557. * @param {Array} array The array to query.
  24558. * @returns {Array} Returns the slice of `array`.
  24559. * @example
  24560. *
  24561. * _.initial([1, 2, 3]);
  24562. * // => [1, 2]
  24563. */
  24564. function initial(array) {
  24565. var length = array == null ? 0 : array.length;
  24566. return length ? baseSlice(array, 0, -1) : [];
  24567. }
  24568. /**
  24569. * Creates an array of unique values that are included in all given arrays
  24570. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24571. * for equality comparisons. The order and references of result values are
  24572. * determined by the first array.
  24573. *
  24574. * @static
  24575. * @memberOf _
  24576. * @since 0.1.0
  24577. * @category Array
  24578. * @param {...Array} [arrays] The arrays to inspect.
  24579. * @returns {Array} Returns the new array of intersecting values.
  24580. * @example
  24581. *
  24582. * _.intersection([2, 1], [2, 3]);
  24583. * // => [2]
  24584. */
  24585. var intersection = baseRest(function(arrays) {
  24586. var mapped = arrayMap(arrays, castArrayLikeObject);
  24587. return (mapped.length && mapped[0] === arrays[0])
  24588. ? baseIntersection(mapped)
  24589. : [];
  24590. });
  24591. /**
  24592. * This method is like `_.intersection` except that it accepts `iteratee`
  24593. * which is invoked for each element of each `arrays` to generate the criterion
  24594. * by which they're compared. The order and references of result values are
  24595. * determined by the first array. The iteratee is invoked with one argument:
  24596. * (value).
  24597. *
  24598. * @static
  24599. * @memberOf _
  24600. * @since 4.0.0
  24601. * @category Array
  24602. * @param {...Array} [arrays] The arrays to inspect.
  24603. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24604. * @returns {Array} Returns the new array of intersecting values.
  24605. * @example
  24606. *
  24607. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24608. * // => [2.1]
  24609. *
  24610. * // The `_.property` iteratee shorthand.
  24611. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24612. * // => [{ 'x': 1 }]
  24613. */
  24614. var intersectionBy = baseRest(function(arrays) {
  24615. var iteratee = last(arrays),
  24616. mapped = arrayMap(arrays, castArrayLikeObject);
  24617. if (iteratee === last(mapped)) {
  24618. iteratee = undefined;
  24619. } else {
  24620. mapped.pop();
  24621. }
  24622. return (mapped.length && mapped[0] === arrays[0])
  24623. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24624. : [];
  24625. });
  24626. /**
  24627. * This method is like `_.intersection` except that it accepts `comparator`
  24628. * which is invoked to compare elements of `arrays`. The order and references
  24629. * of result values are determined by the first array. The comparator is
  24630. * invoked with two arguments: (arrVal, othVal).
  24631. *
  24632. * @static
  24633. * @memberOf _
  24634. * @since 4.0.0
  24635. * @category Array
  24636. * @param {...Array} [arrays] The arrays to inspect.
  24637. * @param {Function} [comparator] The comparator invoked per element.
  24638. * @returns {Array} Returns the new array of intersecting values.
  24639. * @example
  24640. *
  24641. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24642. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24643. *
  24644. * _.intersectionWith(objects, others, _.isEqual);
  24645. * // => [{ 'x': 1, 'y': 2 }]
  24646. */
  24647. var intersectionWith = baseRest(function(arrays) {
  24648. var comparator = last(arrays),
  24649. mapped = arrayMap(arrays, castArrayLikeObject);
  24650. comparator = typeof comparator == 'function' ? comparator : undefined;
  24651. if (comparator) {
  24652. mapped.pop();
  24653. }
  24654. return (mapped.length && mapped[0] === arrays[0])
  24655. ? baseIntersection(mapped, undefined, comparator)
  24656. : [];
  24657. });
  24658. /**
  24659. * Converts all elements in `array` into a string separated by `separator`.
  24660. *
  24661. * @static
  24662. * @memberOf _
  24663. * @since 4.0.0
  24664. * @category Array
  24665. * @param {Array} array The array to convert.
  24666. * @param {string} [separator=','] The element separator.
  24667. * @returns {string} Returns the joined string.
  24668. * @example
  24669. *
  24670. * _.join(['a', 'b', 'c'], '~');
  24671. * // => 'a~b~c'
  24672. */
  24673. function join(array, separator) {
  24674. return array == null ? '' : nativeJoin.call(array, separator);
  24675. }
  24676. /**
  24677. * Gets the last element of `array`.
  24678. *
  24679. * @static
  24680. * @memberOf _
  24681. * @since 0.1.0
  24682. * @category Array
  24683. * @param {Array} array The array to query.
  24684. * @returns {*} Returns the last element of `array`.
  24685. * @example
  24686. *
  24687. * _.last([1, 2, 3]);
  24688. * // => 3
  24689. */
  24690. function last(array) {
  24691. var length = array == null ? 0 : array.length;
  24692. return length ? array[length - 1] : undefined;
  24693. }
  24694. /**
  24695. * This method is like `_.indexOf` except that it iterates over elements of
  24696. * `array` from right to left.
  24697. *
  24698. * @static
  24699. * @memberOf _
  24700. * @since 0.1.0
  24701. * @category Array
  24702. * @param {Array} array The array to inspect.
  24703. * @param {*} value The value to search for.
  24704. * @param {number} [fromIndex=array.length-1] The index to search from.
  24705. * @returns {number} Returns the index of the matched value, else `-1`.
  24706. * @example
  24707. *
  24708. * _.lastIndexOf([1, 2, 1, 2], 2);
  24709. * // => 3
  24710. *
  24711. * // Search from the `fromIndex`.
  24712. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  24713. * // => 1
  24714. */
  24715. function lastIndexOf(array, value, fromIndex) {
  24716. var length = array == null ? 0 : array.length;
  24717. if (!length) {
  24718. return -1;
  24719. }
  24720. var index = length;
  24721. if (fromIndex !== undefined) {
  24722. index = toInteger(fromIndex);
  24723. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  24724. }
  24725. return value === value
  24726. ? strictLastIndexOf(array, value, index)
  24727. : baseFindIndex(array, baseIsNaN, index, true);
  24728. }
  24729. /**
  24730. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  24731. * element from the end is returned.
  24732. *
  24733. * @static
  24734. * @memberOf _
  24735. * @since 4.11.0
  24736. * @category Array
  24737. * @param {Array} array The array to query.
  24738. * @param {number} [n=0] The index of the element to return.
  24739. * @returns {*} Returns the nth element of `array`.
  24740. * @example
  24741. *
  24742. * var array = ['a', 'b', 'c', 'd'];
  24743. *
  24744. * _.nth(array, 1);
  24745. * // => 'b'
  24746. *
  24747. * _.nth(array, -2);
  24748. * // => 'c';
  24749. */
  24750. function nth(array, n) {
  24751. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  24752. }
  24753. /**
  24754. * Removes all given values from `array` using
  24755. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24756. * for equality comparisons.
  24757. *
  24758. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  24759. * to remove elements from an array by predicate.
  24760. *
  24761. * @static
  24762. * @memberOf _
  24763. * @since 2.0.0
  24764. * @category Array
  24765. * @param {Array} array The array to modify.
  24766. * @param {...*} [values] The values to remove.
  24767. * @returns {Array} Returns `array`.
  24768. * @example
  24769. *
  24770. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24771. *
  24772. * _.pull(array, 'a', 'c');
  24773. * console.log(array);
  24774. * // => ['b', 'b']
  24775. */
  24776. var pull = baseRest(pullAll);
  24777. /**
  24778. * This method is like `_.pull` except that it accepts an array of values to remove.
  24779. *
  24780. * **Note:** Unlike `_.difference`, this method mutates `array`.
  24781. *
  24782. * @static
  24783. * @memberOf _
  24784. * @since 4.0.0
  24785. * @category Array
  24786. * @param {Array} array The array to modify.
  24787. * @param {Array} values The values to remove.
  24788. * @returns {Array} Returns `array`.
  24789. * @example
  24790. *
  24791. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  24792. *
  24793. * _.pullAll(array, ['a', 'c']);
  24794. * console.log(array);
  24795. * // => ['b', 'b']
  24796. */
  24797. function pullAll(array, values) {
  24798. return (array && array.length && values && values.length)
  24799. ? basePullAll(array, values)
  24800. : array;
  24801. }
  24802. /**
  24803. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  24804. * invoked for each element of `array` and `values` to generate the criterion
  24805. * by which they're compared. The iteratee is invoked with one argument: (value).
  24806. *
  24807. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  24808. *
  24809. * @static
  24810. * @memberOf _
  24811. * @since 4.0.0
  24812. * @category Array
  24813. * @param {Array} array The array to modify.
  24814. * @param {Array} values The values to remove.
  24815. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24816. * @returns {Array} Returns `array`.
  24817. * @example
  24818. *
  24819. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  24820. *
  24821. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  24822. * console.log(array);
  24823. * // => [{ 'x': 2 }]
  24824. */
  24825. function pullAllBy(array, values, iteratee) {
  24826. return (array && array.length && values && values.length)
  24827. ? basePullAll(array, values, getIteratee(iteratee, 2))
  24828. : array;
  24829. }
  24830. /**
  24831. * This method is like `_.pullAll` except that it accepts `comparator` which
  24832. * is invoked to compare elements of `array` to `values`. The comparator is
  24833. * invoked with two arguments: (arrVal, othVal).
  24834. *
  24835. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  24836. *
  24837. * @static
  24838. * @memberOf _
  24839. * @since 4.6.0
  24840. * @category Array
  24841. * @param {Array} array The array to modify.
  24842. * @param {Array} values The values to remove.
  24843. * @param {Function} [comparator] The comparator invoked per element.
  24844. * @returns {Array} Returns `array`.
  24845. * @example
  24846. *
  24847. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  24848. *
  24849. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  24850. * console.log(array);
  24851. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  24852. */
  24853. function pullAllWith(array, values, comparator) {
  24854. return (array && array.length && values && values.length)
  24855. ? basePullAll(array, values, undefined, comparator)
  24856. : array;
  24857. }
  24858. /**
  24859. * Removes elements from `array` corresponding to `indexes` and returns an
  24860. * array of removed elements.
  24861. *
  24862. * **Note:** Unlike `_.at`, this method mutates `array`.
  24863. *
  24864. * @static
  24865. * @memberOf _
  24866. * @since 3.0.0
  24867. * @category Array
  24868. * @param {Array} array The array to modify.
  24869. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  24870. * @returns {Array} Returns the new array of removed elements.
  24871. * @example
  24872. *
  24873. * var array = ['a', 'b', 'c', 'd'];
  24874. * var pulled = _.pullAt(array, [1, 3]);
  24875. *
  24876. * console.log(array);
  24877. * // => ['a', 'c']
  24878. *
  24879. * console.log(pulled);
  24880. * // => ['b', 'd']
  24881. */
  24882. var pullAt = flatRest(function(array, indexes) {
  24883. var length = array == null ? 0 : array.length,
  24884. result = baseAt(array, indexes);
  24885. basePullAt(array, arrayMap(indexes, function(index) {
  24886. return isIndex(index, length) ? +index : index;
  24887. }).sort(compareAscending));
  24888. return result;
  24889. });
  24890. /**
  24891. * Removes all elements from `array` that `predicate` returns truthy for
  24892. * and returns an array of the removed elements. The predicate is invoked
  24893. * with three arguments: (value, index, array).
  24894. *
  24895. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  24896. * to pull elements from an array by value.
  24897. *
  24898. * @static
  24899. * @memberOf _
  24900. * @since 2.0.0
  24901. * @category Array
  24902. * @param {Array} array The array to modify.
  24903. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24904. * @returns {Array} Returns the new array of removed elements.
  24905. * @example
  24906. *
  24907. * var array = [1, 2, 3, 4];
  24908. * var evens = _.remove(array, function(n) {
  24909. * return n % 2 == 0;
  24910. * });
  24911. *
  24912. * console.log(array);
  24913. * // => [1, 3]
  24914. *
  24915. * console.log(evens);
  24916. * // => [2, 4]
  24917. */
  24918. function remove(array, predicate) {
  24919. var result = [];
  24920. if (!(array && array.length)) {
  24921. return result;
  24922. }
  24923. var index = -1,
  24924. indexes = [],
  24925. length = array.length;
  24926. predicate = getIteratee(predicate, 3);
  24927. while (++index < length) {
  24928. var value = array[index];
  24929. if (predicate(value, index, array)) {
  24930. result.push(value);
  24931. indexes.push(index);
  24932. }
  24933. }
  24934. basePullAt(array, indexes);
  24935. return result;
  24936. }
  24937. /**
  24938. * Reverses `array` so that the first element becomes the last, the second
  24939. * element becomes the second to last, and so on.
  24940. *
  24941. * **Note:** This method mutates `array` and is based on
  24942. * [`Array#reverse`](https://mdn.io/Array/reverse).
  24943. *
  24944. * @static
  24945. * @memberOf _
  24946. * @since 4.0.0
  24947. * @category Array
  24948. * @param {Array} array The array to modify.
  24949. * @returns {Array} Returns `array`.
  24950. * @example
  24951. *
  24952. * var array = [1, 2, 3];
  24953. *
  24954. * _.reverse(array);
  24955. * // => [3, 2, 1]
  24956. *
  24957. * console.log(array);
  24958. * // => [3, 2, 1]
  24959. */
  24960. function reverse(array) {
  24961. return array == null ? array : nativeReverse.call(array);
  24962. }
  24963. /**
  24964. * Creates a slice of `array` from `start` up to, but not including, `end`.
  24965. *
  24966. * **Note:** This method is used instead of
  24967. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  24968. * returned.
  24969. *
  24970. * @static
  24971. * @memberOf _
  24972. * @since 3.0.0
  24973. * @category Array
  24974. * @param {Array} array The array to slice.
  24975. * @param {number} [start=0] The start position.
  24976. * @param {number} [end=array.length] The end position.
  24977. * @returns {Array} Returns the slice of `array`.
  24978. */
  24979. function slice(array, start, end) {
  24980. var length = array == null ? 0 : array.length;
  24981. if (!length) {
  24982. return [];
  24983. }
  24984. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  24985. start = 0;
  24986. end = length;
  24987. }
  24988. else {
  24989. start = start == null ? 0 : toInteger(start);
  24990. end = end === undefined ? length : toInteger(end);
  24991. }
  24992. return baseSlice(array, start, end);
  24993. }
  24994. /**
  24995. * Uses a binary search to determine the lowest index at which `value`
  24996. * should be inserted into `array` in order to maintain its sort order.
  24997. *
  24998. * @static
  24999. * @memberOf _
  25000. * @since 0.1.0
  25001. * @category Array
  25002. * @param {Array} array The sorted array to inspect.
  25003. * @param {*} value The value to evaluate.
  25004. * @returns {number} Returns the index at which `value` should be inserted
  25005. * into `array`.
  25006. * @example
  25007. *
  25008. * _.sortedIndex([30, 50], 40);
  25009. * // => 1
  25010. */
  25011. function sortedIndex(array, value) {
  25012. return baseSortedIndex(array, value);
  25013. }
  25014. /**
  25015. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25016. * which is invoked for `value` and each element of `array` to compute their
  25017. * sort ranking. The iteratee is invoked with one argument: (value).
  25018. *
  25019. * @static
  25020. * @memberOf _
  25021. * @since 4.0.0
  25022. * @category Array
  25023. * @param {Array} array The sorted array to inspect.
  25024. * @param {*} value The value to evaluate.
  25025. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25026. * @returns {number} Returns the index at which `value` should be inserted
  25027. * into `array`.
  25028. * @example
  25029. *
  25030. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25031. *
  25032. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25033. * // => 0
  25034. *
  25035. * // The `_.property` iteratee shorthand.
  25036. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25037. * // => 0
  25038. */
  25039. function sortedIndexBy(array, value, iteratee) {
  25040. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25041. }
  25042. /**
  25043. * This method is like `_.indexOf` except that it performs a binary
  25044. * search on a sorted `array`.
  25045. *
  25046. * @static
  25047. * @memberOf _
  25048. * @since 4.0.0
  25049. * @category Array
  25050. * @param {Array} array The array to inspect.
  25051. * @param {*} value The value to search for.
  25052. * @returns {number} Returns the index of the matched value, else `-1`.
  25053. * @example
  25054. *
  25055. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25056. * // => 1
  25057. */
  25058. function sortedIndexOf(array, value) {
  25059. var length = array == null ? 0 : array.length;
  25060. if (length) {
  25061. var index = baseSortedIndex(array, value);
  25062. if (index < length && eq(array[index], value)) {
  25063. return index;
  25064. }
  25065. }
  25066. return -1;
  25067. }
  25068. /**
  25069. * This method is like `_.sortedIndex` except that it returns the highest
  25070. * index at which `value` should be inserted into `array` in order to
  25071. * maintain its sort order.
  25072. *
  25073. * @static
  25074. * @memberOf _
  25075. * @since 3.0.0
  25076. * @category Array
  25077. * @param {Array} array The sorted array to inspect.
  25078. * @param {*} value The value to evaluate.
  25079. * @returns {number} Returns the index at which `value` should be inserted
  25080. * into `array`.
  25081. * @example
  25082. *
  25083. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25084. * // => 4
  25085. */
  25086. function sortedLastIndex(array, value) {
  25087. return baseSortedIndex(array, value, true);
  25088. }
  25089. /**
  25090. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25091. * which is invoked for `value` and each element of `array` to compute their
  25092. * sort ranking. The iteratee is invoked with one argument: (value).
  25093. *
  25094. * @static
  25095. * @memberOf _
  25096. * @since 4.0.0
  25097. * @category Array
  25098. * @param {Array} array The sorted array to inspect.
  25099. * @param {*} value The value to evaluate.
  25100. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25101. * @returns {number} Returns the index at which `value` should be inserted
  25102. * into `array`.
  25103. * @example
  25104. *
  25105. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25106. *
  25107. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25108. * // => 1
  25109. *
  25110. * // The `_.property` iteratee shorthand.
  25111. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25112. * // => 1
  25113. */
  25114. function sortedLastIndexBy(array, value, iteratee) {
  25115. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25116. }
  25117. /**
  25118. * This method is like `_.lastIndexOf` except that it performs a binary
  25119. * search on a sorted `array`.
  25120. *
  25121. * @static
  25122. * @memberOf _
  25123. * @since 4.0.0
  25124. * @category Array
  25125. * @param {Array} array The array to inspect.
  25126. * @param {*} value The value to search for.
  25127. * @returns {number} Returns the index of the matched value, else `-1`.
  25128. * @example
  25129. *
  25130. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25131. * // => 3
  25132. */
  25133. function sortedLastIndexOf(array, value) {
  25134. var length = array == null ? 0 : array.length;
  25135. if (length) {
  25136. var index = baseSortedIndex(array, value, true) - 1;
  25137. if (eq(array[index], value)) {
  25138. return index;
  25139. }
  25140. }
  25141. return -1;
  25142. }
  25143. /**
  25144. * This method is like `_.uniq` except that it's designed and optimized
  25145. * for sorted arrays.
  25146. *
  25147. * @static
  25148. * @memberOf _
  25149. * @since 4.0.0
  25150. * @category Array
  25151. * @param {Array} array The array to inspect.
  25152. * @returns {Array} Returns the new duplicate free array.
  25153. * @example
  25154. *
  25155. * _.sortedUniq([1, 1, 2]);
  25156. * // => [1, 2]
  25157. */
  25158. function sortedUniq(array) {
  25159. return (array && array.length)
  25160. ? baseSortedUniq(array)
  25161. : [];
  25162. }
  25163. /**
  25164. * This method is like `_.uniqBy` except that it's designed and optimized
  25165. * for sorted arrays.
  25166. *
  25167. * @static
  25168. * @memberOf _
  25169. * @since 4.0.0
  25170. * @category Array
  25171. * @param {Array} array The array to inspect.
  25172. * @param {Function} [iteratee] The iteratee invoked per element.
  25173. * @returns {Array} Returns the new duplicate free array.
  25174. * @example
  25175. *
  25176. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25177. * // => [1.1, 2.3]
  25178. */
  25179. function sortedUniqBy(array, iteratee) {
  25180. return (array && array.length)
  25181. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25182. : [];
  25183. }
  25184. /**
  25185. * Gets all but the first element of `array`.
  25186. *
  25187. * @static
  25188. * @memberOf _
  25189. * @since 4.0.0
  25190. * @category Array
  25191. * @param {Array} array The array to query.
  25192. * @returns {Array} Returns the slice of `array`.
  25193. * @example
  25194. *
  25195. * _.tail([1, 2, 3]);
  25196. * // => [2, 3]
  25197. */
  25198. function tail(array) {
  25199. var length = array == null ? 0 : array.length;
  25200. return length ? baseSlice(array, 1, length) : [];
  25201. }
  25202. /**
  25203. * Creates a slice of `array` with `n` elements taken from the beginning.
  25204. *
  25205. * @static
  25206. * @memberOf _
  25207. * @since 0.1.0
  25208. * @category Array
  25209. * @param {Array} array The array to query.
  25210. * @param {number} [n=1] The number of elements to take.
  25211. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25212. * @returns {Array} Returns the slice of `array`.
  25213. * @example
  25214. *
  25215. * _.take([1, 2, 3]);
  25216. * // => [1]
  25217. *
  25218. * _.take([1, 2, 3], 2);
  25219. * // => [1, 2]
  25220. *
  25221. * _.take([1, 2, 3], 5);
  25222. * // => [1, 2, 3]
  25223. *
  25224. * _.take([1, 2, 3], 0);
  25225. * // => []
  25226. */
  25227. function take(array, n, guard) {
  25228. if (!(array && array.length)) {
  25229. return [];
  25230. }
  25231. n = (guard || n === undefined) ? 1 : toInteger(n);
  25232. return baseSlice(array, 0, n < 0 ? 0 : n);
  25233. }
  25234. /**
  25235. * Creates a slice of `array` with `n` elements taken from the end.
  25236. *
  25237. * @static
  25238. * @memberOf _
  25239. * @since 3.0.0
  25240. * @category Array
  25241. * @param {Array} array The array to query.
  25242. * @param {number} [n=1] The number of elements to take.
  25243. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25244. * @returns {Array} Returns the slice of `array`.
  25245. * @example
  25246. *
  25247. * _.takeRight([1, 2, 3]);
  25248. * // => [3]
  25249. *
  25250. * _.takeRight([1, 2, 3], 2);
  25251. * // => [2, 3]
  25252. *
  25253. * _.takeRight([1, 2, 3], 5);
  25254. * // => [1, 2, 3]
  25255. *
  25256. * _.takeRight([1, 2, 3], 0);
  25257. * // => []
  25258. */
  25259. function takeRight(array, n, guard) {
  25260. var length = array == null ? 0 : array.length;
  25261. if (!length) {
  25262. return [];
  25263. }
  25264. n = (guard || n === undefined) ? 1 : toInteger(n);
  25265. n = length - n;
  25266. return baseSlice(array, n < 0 ? 0 : n, length);
  25267. }
  25268. /**
  25269. * Creates a slice of `array` with elements taken from the end. Elements are
  25270. * taken until `predicate` returns falsey. The predicate is invoked with
  25271. * three arguments: (value, index, array).
  25272. *
  25273. * @static
  25274. * @memberOf _
  25275. * @since 3.0.0
  25276. * @category Array
  25277. * @param {Array} array The array to query.
  25278. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25279. * @returns {Array} Returns the slice of `array`.
  25280. * @example
  25281. *
  25282. * var users = [
  25283. * { 'user': 'barney', 'active': true },
  25284. * { 'user': 'fred', 'active': false },
  25285. * { 'user': 'pebbles', 'active': false }
  25286. * ];
  25287. *
  25288. * _.takeRightWhile(users, function(o) { return !o.active; });
  25289. * // => objects for ['fred', 'pebbles']
  25290. *
  25291. * // The `_.matches` iteratee shorthand.
  25292. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25293. * // => objects for ['pebbles']
  25294. *
  25295. * // The `_.matchesProperty` iteratee shorthand.
  25296. * _.takeRightWhile(users, ['active', false]);
  25297. * // => objects for ['fred', 'pebbles']
  25298. *
  25299. * // The `_.property` iteratee shorthand.
  25300. * _.takeRightWhile(users, 'active');
  25301. * // => []
  25302. */
  25303. function takeRightWhile(array, predicate) {
  25304. return (array && array.length)
  25305. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25306. : [];
  25307. }
  25308. /**
  25309. * Creates a slice of `array` with elements taken from the beginning. Elements
  25310. * are taken until `predicate` returns falsey. The predicate is invoked with
  25311. * three arguments: (value, index, array).
  25312. *
  25313. * @static
  25314. * @memberOf _
  25315. * @since 3.0.0
  25316. * @category Array
  25317. * @param {Array} array The array to query.
  25318. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25319. * @returns {Array} Returns the slice of `array`.
  25320. * @example
  25321. *
  25322. * var users = [
  25323. * { 'user': 'barney', 'active': false },
  25324. * { 'user': 'fred', 'active': false },
  25325. * { 'user': 'pebbles', 'active': true }
  25326. * ];
  25327. *
  25328. * _.takeWhile(users, function(o) { return !o.active; });
  25329. * // => objects for ['barney', 'fred']
  25330. *
  25331. * // The `_.matches` iteratee shorthand.
  25332. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25333. * // => objects for ['barney']
  25334. *
  25335. * // The `_.matchesProperty` iteratee shorthand.
  25336. * _.takeWhile(users, ['active', false]);
  25337. * // => objects for ['barney', 'fred']
  25338. *
  25339. * // The `_.property` iteratee shorthand.
  25340. * _.takeWhile(users, 'active');
  25341. * // => []
  25342. */
  25343. function takeWhile(array, predicate) {
  25344. return (array && array.length)
  25345. ? baseWhile(array, getIteratee(predicate, 3))
  25346. : [];
  25347. }
  25348. /**
  25349. * Creates an array of unique values, in order, from all given arrays using
  25350. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25351. * for equality comparisons.
  25352. *
  25353. * @static
  25354. * @memberOf _
  25355. * @since 0.1.0
  25356. * @category Array
  25357. * @param {...Array} [arrays] The arrays to inspect.
  25358. * @returns {Array} Returns the new array of combined values.
  25359. * @example
  25360. *
  25361. * _.union([2], [1, 2]);
  25362. * // => [2, 1]
  25363. */
  25364. var union = baseRest(function(arrays) {
  25365. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25366. });
  25367. /**
  25368. * This method is like `_.union` except that it accepts `iteratee` which is
  25369. * invoked for each element of each `arrays` to generate the criterion by
  25370. * which uniqueness is computed. Result values are chosen from the first
  25371. * array in which the value occurs. The iteratee is invoked with one argument:
  25372. * (value).
  25373. *
  25374. * @static
  25375. * @memberOf _
  25376. * @since 4.0.0
  25377. * @category Array
  25378. * @param {...Array} [arrays] The arrays to inspect.
  25379. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25380. * @returns {Array} Returns the new array of combined values.
  25381. * @example
  25382. *
  25383. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25384. * // => [2.1, 1.2]
  25385. *
  25386. * // The `_.property` iteratee shorthand.
  25387. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25388. * // => [{ 'x': 1 }, { 'x': 2 }]
  25389. */
  25390. var unionBy = baseRest(function(arrays) {
  25391. var iteratee = last(arrays);
  25392. if (isArrayLikeObject(iteratee)) {
  25393. iteratee = undefined;
  25394. }
  25395. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25396. });
  25397. /**
  25398. * This method is like `_.union` except that it accepts `comparator` which
  25399. * is invoked to compare elements of `arrays`. Result values are chosen from
  25400. * the first array in which the value occurs. The comparator is invoked
  25401. * with two arguments: (arrVal, othVal).
  25402. *
  25403. * @static
  25404. * @memberOf _
  25405. * @since 4.0.0
  25406. * @category Array
  25407. * @param {...Array} [arrays] The arrays to inspect.
  25408. * @param {Function} [comparator] The comparator invoked per element.
  25409. * @returns {Array} Returns the new array of combined values.
  25410. * @example
  25411. *
  25412. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25413. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25414. *
  25415. * _.unionWith(objects, others, _.isEqual);
  25416. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25417. */
  25418. var unionWith = baseRest(function(arrays) {
  25419. var comparator = last(arrays);
  25420. comparator = typeof comparator == 'function' ? comparator : undefined;
  25421. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25422. });
  25423. /**
  25424. * Creates a duplicate-free version of an array, using
  25425. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25426. * for equality comparisons, in which only the first occurrence of each element
  25427. * is kept. The order of result values is determined by the order they occur
  25428. * in the array.
  25429. *
  25430. * @static
  25431. * @memberOf _
  25432. * @since 0.1.0
  25433. * @category Array
  25434. * @param {Array} array The array to inspect.
  25435. * @returns {Array} Returns the new duplicate free array.
  25436. * @example
  25437. *
  25438. * _.uniq([2, 1, 2]);
  25439. * // => [2, 1]
  25440. */
  25441. function uniq(array) {
  25442. return (array && array.length) ? baseUniq(array) : [];
  25443. }
  25444. /**
  25445. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25446. * invoked for each element in `array` to generate the criterion by which
  25447. * uniqueness is computed. The order of result values is determined by the
  25448. * order they occur in the array. The iteratee is invoked with one argument:
  25449. * (value).
  25450. *
  25451. * @static
  25452. * @memberOf _
  25453. * @since 4.0.0
  25454. * @category Array
  25455. * @param {Array} array The array to inspect.
  25456. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25457. * @returns {Array} Returns the new duplicate free array.
  25458. * @example
  25459. *
  25460. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25461. * // => [2.1, 1.2]
  25462. *
  25463. * // The `_.property` iteratee shorthand.
  25464. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25465. * // => [{ 'x': 1 }, { 'x': 2 }]
  25466. */
  25467. function uniqBy(array, iteratee) {
  25468. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25469. }
  25470. /**
  25471. * This method is like `_.uniq` except that it accepts `comparator` which
  25472. * is invoked to compare elements of `array`. The order of result values is
  25473. * determined by the order they occur in the array.The comparator is invoked
  25474. * with two arguments: (arrVal, othVal).
  25475. *
  25476. * @static
  25477. * @memberOf _
  25478. * @since 4.0.0
  25479. * @category Array
  25480. * @param {Array} array The array to inspect.
  25481. * @param {Function} [comparator] The comparator invoked per element.
  25482. * @returns {Array} Returns the new duplicate free array.
  25483. * @example
  25484. *
  25485. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25486. *
  25487. * _.uniqWith(objects, _.isEqual);
  25488. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25489. */
  25490. function uniqWith(array, comparator) {
  25491. comparator = typeof comparator == 'function' ? comparator : undefined;
  25492. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25493. }
  25494. /**
  25495. * This method is like `_.zip` except that it accepts an array of grouped
  25496. * elements and creates an array regrouping the elements to their pre-zip
  25497. * configuration.
  25498. *
  25499. * @static
  25500. * @memberOf _
  25501. * @since 1.2.0
  25502. * @category Array
  25503. * @param {Array} array The array of grouped elements to process.
  25504. * @returns {Array} Returns the new array of regrouped elements.
  25505. * @example
  25506. *
  25507. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25508. * // => [['a', 1, true], ['b', 2, false]]
  25509. *
  25510. * _.unzip(zipped);
  25511. * // => [['a', 'b'], [1, 2], [true, false]]
  25512. */
  25513. function unzip(array) {
  25514. if (!(array && array.length)) {
  25515. return [];
  25516. }
  25517. var length = 0;
  25518. array = arrayFilter(array, function(group) {
  25519. if (isArrayLikeObject(group)) {
  25520. length = nativeMax(group.length, length);
  25521. return true;
  25522. }
  25523. });
  25524. return baseTimes(length, function(index) {
  25525. return arrayMap(array, baseProperty(index));
  25526. });
  25527. }
  25528. /**
  25529. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25530. * how regrouped values should be combined. The iteratee is invoked with the
  25531. * elements of each group: (...group).
  25532. *
  25533. * @static
  25534. * @memberOf _
  25535. * @since 3.8.0
  25536. * @category Array
  25537. * @param {Array} array The array of grouped elements to process.
  25538. * @param {Function} [iteratee=_.identity] The function to combine
  25539. * regrouped values.
  25540. * @returns {Array} Returns the new array of regrouped elements.
  25541. * @example
  25542. *
  25543. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25544. * // => [[1, 10, 100], [2, 20, 200]]
  25545. *
  25546. * _.unzipWith(zipped, _.add);
  25547. * // => [3, 30, 300]
  25548. */
  25549. function unzipWith(array, iteratee) {
  25550. if (!(array && array.length)) {
  25551. return [];
  25552. }
  25553. var result = unzip(array);
  25554. if (iteratee == null) {
  25555. return result;
  25556. }
  25557. return arrayMap(result, function(group) {
  25558. return apply(iteratee, undefined, group);
  25559. });
  25560. }
  25561. /**
  25562. * Creates an array excluding all given values using
  25563. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25564. * for equality comparisons.
  25565. *
  25566. * **Note:** Unlike `_.pull`, this method returns a new array.
  25567. *
  25568. * @static
  25569. * @memberOf _
  25570. * @since 0.1.0
  25571. * @category Array
  25572. * @param {Array} array The array to inspect.
  25573. * @param {...*} [values] The values to exclude.
  25574. * @returns {Array} Returns the new array of filtered values.
  25575. * @see _.difference, _.xor
  25576. * @example
  25577. *
  25578. * _.without([2, 1, 2, 3], 1, 2);
  25579. * // => [3]
  25580. */
  25581. var without = baseRest(function(array, values) {
  25582. return isArrayLikeObject(array)
  25583. ? baseDifference(array, values)
  25584. : [];
  25585. });
  25586. /**
  25587. * Creates an array of unique values that is the
  25588. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25589. * of the given arrays. The order of result values is determined by the order
  25590. * they occur in the arrays.
  25591. *
  25592. * @static
  25593. * @memberOf _
  25594. * @since 2.4.0
  25595. * @category Array
  25596. * @param {...Array} [arrays] The arrays to inspect.
  25597. * @returns {Array} Returns the new array of filtered values.
  25598. * @see _.difference, _.without
  25599. * @example
  25600. *
  25601. * _.xor([2, 1], [2, 3]);
  25602. * // => [1, 3]
  25603. */
  25604. var xor = baseRest(function(arrays) {
  25605. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25606. });
  25607. /**
  25608. * This method is like `_.xor` except that it accepts `iteratee` which is
  25609. * invoked for each element of each `arrays` to generate the criterion by
  25610. * which by which they're compared. The order of result values is determined
  25611. * by the order they occur in the arrays. The iteratee is invoked with one
  25612. * argument: (value).
  25613. *
  25614. * @static
  25615. * @memberOf _
  25616. * @since 4.0.0
  25617. * @category Array
  25618. * @param {...Array} [arrays] The arrays to inspect.
  25619. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25620. * @returns {Array} Returns the new array of filtered values.
  25621. * @example
  25622. *
  25623. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25624. * // => [1.2, 3.4]
  25625. *
  25626. * // The `_.property` iteratee shorthand.
  25627. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25628. * // => [{ 'x': 2 }]
  25629. */
  25630. var xorBy = baseRest(function(arrays) {
  25631. var iteratee = last(arrays);
  25632. if (isArrayLikeObject(iteratee)) {
  25633. iteratee = undefined;
  25634. }
  25635. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25636. });
  25637. /**
  25638. * This method is like `_.xor` except that it accepts `comparator` which is
  25639. * invoked to compare elements of `arrays`. The order of result values is
  25640. * determined by the order they occur in the arrays. The comparator is invoked
  25641. * with two arguments: (arrVal, othVal).
  25642. *
  25643. * @static
  25644. * @memberOf _
  25645. * @since 4.0.0
  25646. * @category Array
  25647. * @param {...Array} [arrays] The arrays to inspect.
  25648. * @param {Function} [comparator] The comparator invoked per element.
  25649. * @returns {Array} Returns the new array of filtered values.
  25650. * @example
  25651. *
  25652. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25653. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25654. *
  25655. * _.xorWith(objects, others, _.isEqual);
  25656. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25657. */
  25658. var xorWith = baseRest(function(arrays) {
  25659. var comparator = last(arrays);
  25660. comparator = typeof comparator == 'function' ? comparator : undefined;
  25661. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25662. });
  25663. /**
  25664. * Creates an array of grouped elements, the first of which contains the
  25665. * first elements of the given arrays, the second of which contains the
  25666. * second elements of the given arrays, and so on.
  25667. *
  25668. * @static
  25669. * @memberOf _
  25670. * @since 0.1.0
  25671. * @category Array
  25672. * @param {...Array} [arrays] The arrays to process.
  25673. * @returns {Array} Returns the new array of grouped elements.
  25674. * @example
  25675. *
  25676. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25677. * // => [['a', 1, true], ['b', 2, false]]
  25678. */
  25679. var zip = baseRest(unzip);
  25680. /**
  25681. * This method is like `_.fromPairs` except that it accepts two arrays,
  25682. * one of property identifiers and one of corresponding values.
  25683. *
  25684. * @static
  25685. * @memberOf _
  25686. * @since 0.4.0
  25687. * @category Array
  25688. * @param {Array} [props=[]] The property identifiers.
  25689. * @param {Array} [values=[]] The property values.
  25690. * @returns {Object} Returns the new object.
  25691. * @example
  25692. *
  25693. * _.zipObject(['a', 'b'], [1, 2]);
  25694. * // => { 'a': 1, 'b': 2 }
  25695. */
  25696. function zipObject(props, values) {
  25697. return baseZipObject(props || [], values || [], assignValue);
  25698. }
  25699. /**
  25700. * This method is like `_.zipObject` except that it supports property paths.
  25701. *
  25702. * @static
  25703. * @memberOf _
  25704. * @since 4.1.0
  25705. * @category Array
  25706. * @param {Array} [props=[]] The property identifiers.
  25707. * @param {Array} [values=[]] The property values.
  25708. * @returns {Object} Returns the new object.
  25709. * @example
  25710. *
  25711. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  25712. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  25713. */
  25714. function zipObjectDeep(props, values) {
  25715. return baseZipObject(props || [], values || [], baseSet);
  25716. }
  25717. /**
  25718. * This method is like `_.zip` except that it accepts `iteratee` to specify
  25719. * how grouped values should be combined. The iteratee is invoked with the
  25720. * elements of each group: (...group).
  25721. *
  25722. * @static
  25723. * @memberOf _
  25724. * @since 3.8.0
  25725. * @category Array
  25726. * @param {...Array} [arrays] The arrays to process.
  25727. * @param {Function} [iteratee=_.identity] The function to combine
  25728. * grouped values.
  25729. * @returns {Array} Returns the new array of grouped elements.
  25730. * @example
  25731. *
  25732. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  25733. * return a + b + c;
  25734. * });
  25735. * // => [111, 222]
  25736. */
  25737. var zipWith = baseRest(function(arrays) {
  25738. var length = arrays.length,
  25739. iteratee = length > 1 ? arrays[length - 1] : undefined;
  25740. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  25741. return unzipWith(arrays, iteratee);
  25742. });
  25743. /*------------------------------------------------------------------------*/
  25744. /**
  25745. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  25746. * chain sequences enabled. The result of such sequences must be unwrapped
  25747. * with `_#value`.
  25748. *
  25749. * @static
  25750. * @memberOf _
  25751. * @since 1.3.0
  25752. * @category Seq
  25753. * @param {*} value The value to wrap.
  25754. * @returns {Object} Returns the new `lodash` wrapper instance.
  25755. * @example
  25756. *
  25757. * var users = [
  25758. * { 'user': 'barney', 'age': 36 },
  25759. * { 'user': 'fred', 'age': 40 },
  25760. * { 'user': 'pebbles', 'age': 1 }
  25761. * ];
  25762. *
  25763. * var youngest = _
  25764. * .chain(users)
  25765. * .sortBy('age')
  25766. * .map(function(o) {
  25767. * return o.user + ' is ' + o.age;
  25768. * })
  25769. * .head()
  25770. * .value();
  25771. * // => 'pebbles is 1'
  25772. */
  25773. function chain(value) {
  25774. var result = lodash(value);
  25775. result.__chain__ = true;
  25776. return result;
  25777. }
  25778. /**
  25779. * This method invokes `interceptor` and returns `value`. The interceptor
  25780. * is invoked with one argument; (value). The purpose of this method is to
  25781. * "tap into" a method chain sequence in order to modify intermediate results.
  25782. *
  25783. * @static
  25784. * @memberOf _
  25785. * @since 0.1.0
  25786. * @category Seq
  25787. * @param {*} value The value to provide to `interceptor`.
  25788. * @param {Function} interceptor The function to invoke.
  25789. * @returns {*} Returns `value`.
  25790. * @example
  25791. *
  25792. * _([1, 2, 3])
  25793. * .tap(function(array) {
  25794. * // Mutate input array.
  25795. * array.pop();
  25796. * })
  25797. * .reverse()
  25798. * .value();
  25799. * // => [2, 1]
  25800. */
  25801. function tap(value, interceptor) {
  25802. interceptor(value);
  25803. return value;
  25804. }
  25805. /**
  25806. * This method is like `_.tap` except that it returns the result of `interceptor`.
  25807. * The purpose of this method is to "pass thru" values replacing intermediate
  25808. * results in a method chain sequence.
  25809. *
  25810. * @static
  25811. * @memberOf _
  25812. * @since 3.0.0
  25813. * @category Seq
  25814. * @param {*} value The value to provide to `interceptor`.
  25815. * @param {Function} interceptor The function to invoke.
  25816. * @returns {*} Returns the result of `interceptor`.
  25817. * @example
  25818. *
  25819. * _(' abc ')
  25820. * .chain()
  25821. * .trim()
  25822. * .thru(function(value) {
  25823. * return [value];
  25824. * })
  25825. * .value();
  25826. * // => ['abc']
  25827. */
  25828. function thru(value, interceptor) {
  25829. return interceptor(value);
  25830. }
  25831. /**
  25832. * This method is the wrapper version of `_.at`.
  25833. *
  25834. * @name at
  25835. * @memberOf _
  25836. * @since 1.0.0
  25837. * @category Seq
  25838. * @param {...(string|string[])} [paths] The property paths to pick.
  25839. * @returns {Object} Returns the new `lodash` wrapper instance.
  25840. * @example
  25841. *
  25842. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  25843. *
  25844. * _(object).at(['a[0].b.c', 'a[1]']).value();
  25845. * // => [3, 4]
  25846. */
  25847. var wrapperAt = flatRest(function(paths) {
  25848. var length = paths.length,
  25849. start = length ? paths[0] : 0,
  25850. value = this.__wrapped__,
  25851. interceptor = function(object) { return baseAt(object, paths); };
  25852. if (length > 1 || this.__actions__.length ||
  25853. !(value instanceof LazyWrapper) || !isIndex(start)) {
  25854. return this.thru(interceptor);
  25855. }
  25856. value = value.slice(start, +start + (length ? 1 : 0));
  25857. value.__actions__.push({
  25858. 'func': thru,
  25859. 'args': [interceptor],
  25860. 'thisArg': undefined
  25861. });
  25862. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  25863. if (length && !array.length) {
  25864. array.push(undefined);
  25865. }
  25866. return array;
  25867. });
  25868. });
  25869. /**
  25870. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  25871. *
  25872. * @name chain
  25873. * @memberOf _
  25874. * @since 0.1.0
  25875. * @category Seq
  25876. * @returns {Object} Returns the new `lodash` wrapper instance.
  25877. * @example
  25878. *
  25879. * var users = [
  25880. * { 'user': 'barney', 'age': 36 },
  25881. * { 'user': 'fred', 'age': 40 }
  25882. * ];
  25883. *
  25884. * // A sequence without explicit chaining.
  25885. * _(users).head();
  25886. * // => { 'user': 'barney', 'age': 36 }
  25887. *
  25888. * // A sequence with explicit chaining.
  25889. * _(users)
  25890. * .chain()
  25891. * .head()
  25892. * .pick('user')
  25893. * .value();
  25894. * // => { 'user': 'barney' }
  25895. */
  25896. function wrapperChain() {
  25897. return chain(this);
  25898. }
  25899. /**
  25900. * Executes the chain sequence and returns the wrapped result.
  25901. *
  25902. * @name commit
  25903. * @memberOf _
  25904. * @since 3.2.0
  25905. * @category Seq
  25906. * @returns {Object} Returns the new `lodash` wrapper instance.
  25907. * @example
  25908. *
  25909. * var array = [1, 2];
  25910. * var wrapped = _(array).push(3);
  25911. *
  25912. * console.log(array);
  25913. * // => [1, 2]
  25914. *
  25915. * wrapped = wrapped.commit();
  25916. * console.log(array);
  25917. * // => [1, 2, 3]
  25918. *
  25919. * wrapped.last();
  25920. * // => 3
  25921. *
  25922. * console.log(array);
  25923. * // => [1, 2, 3]
  25924. */
  25925. function wrapperCommit() {
  25926. return new LodashWrapper(this.value(), this.__chain__);
  25927. }
  25928. /**
  25929. * Gets the next value on a wrapped object following the
  25930. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  25931. *
  25932. * @name next
  25933. * @memberOf _
  25934. * @since 4.0.0
  25935. * @category Seq
  25936. * @returns {Object} Returns the next iterator value.
  25937. * @example
  25938. *
  25939. * var wrapped = _([1, 2]);
  25940. *
  25941. * wrapped.next();
  25942. * // => { 'done': false, 'value': 1 }
  25943. *
  25944. * wrapped.next();
  25945. * // => { 'done': false, 'value': 2 }
  25946. *
  25947. * wrapped.next();
  25948. * // => { 'done': true, 'value': undefined }
  25949. */
  25950. function wrapperNext() {
  25951. if (this.__values__ === undefined) {
  25952. this.__values__ = toArray(this.value());
  25953. }
  25954. var done = this.__index__ >= this.__values__.length,
  25955. value = done ? undefined : this.__values__[this.__index__++];
  25956. return { 'done': done, 'value': value };
  25957. }
  25958. /**
  25959. * Enables the wrapper to be iterable.
  25960. *
  25961. * @name Symbol.iterator
  25962. * @memberOf _
  25963. * @since 4.0.0
  25964. * @category Seq
  25965. * @returns {Object} Returns the wrapper object.
  25966. * @example
  25967. *
  25968. * var wrapped = _([1, 2]);
  25969. *
  25970. * wrapped[Symbol.iterator]() === wrapped;
  25971. * // => true
  25972. *
  25973. * Array.from(wrapped);
  25974. * // => [1, 2]
  25975. */
  25976. function wrapperToIterator() {
  25977. return this;
  25978. }
  25979. /**
  25980. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  25981. *
  25982. * @name plant
  25983. * @memberOf _
  25984. * @since 3.2.0
  25985. * @category Seq
  25986. * @param {*} value The value to plant.
  25987. * @returns {Object} Returns the new `lodash` wrapper instance.
  25988. * @example
  25989. *
  25990. * function square(n) {
  25991. * return n * n;
  25992. * }
  25993. *
  25994. * var wrapped = _([1, 2]).map(square);
  25995. * var other = wrapped.plant([3, 4]);
  25996. *
  25997. * other.value();
  25998. * // => [9, 16]
  25999. *
  26000. * wrapped.value();
  26001. * // => [1, 4]
  26002. */
  26003. function wrapperPlant(value) {
  26004. var result,
  26005. parent = this;
  26006. while (parent instanceof baseLodash) {
  26007. var clone = wrapperClone(parent);
  26008. clone.__index__ = 0;
  26009. clone.__values__ = undefined;
  26010. if (result) {
  26011. previous.__wrapped__ = clone;
  26012. } else {
  26013. result = clone;
  26014. }
  26015. var previous = clone;
  26016. parent = parent.__wrapped__;
  26017. }
  26018. previous.__wrapped__ = value;
  26019. return result;
  26020. }
  26021. /**
  26022. * This method is the wrapper version of `_.reverse`.
  26023. *
  26024. * **Note:** This method mutates the wrapped array.
  26025. *
  26026. * @name reverse
  26027. * @memberOf _
  26028. * @since 0.1.0
  26029. * @category Seq
  26030. * @returns {Object} Returns the new `lodash` wrapper instance.
  26031. * @example
  26032. *
  26033. * var array = [1, 2, 3];
  26034. *
  26035. * _(array).reverse().value()
  26036. * // => [3, 2, 1]
  26037. *
  26038. * console.log(array);
  26039. * // => [3, 2, 1]
  26040. */
  26041. function wrapperReverse() {
  26042. var value = this.__wrapped__;
  26043. if (value instanceof LazyWrapper) {
  26044. var wrapped = value;
  26045. if (this.__actions__.length) {
  26046. wrapped = new LazyWrapper(this);
  26047. }
  26048. wrapped = wrapped.reverse();
  26049. wrapped.__actions__.push({
  26050. 'func': thru,
  26051. 'args': [reverse],
  26052. 'thisArg': undefined
  26053. });
  26054. return new LodashWrapper(wrapped, this.__chain__);
  26055. }
  26056. return this.thru(reverse);
  26057. }
  26058. /**
  26059. * Executes the chain sequence to resolve the unwrapped value.
  26060. *
  26061. * @name value
  26062. * @memberOf _
  26063. * @since 0.1.0
  26064. * @alias toJSON, valueOf
  26065. * @category Seq
  26066. * @returns {*} Returns the resolved unwrapped value.
  26067. * @example
  26068. *
  26069. * _([1, 2, 3]).value();
  26070. * // => [1, 2, 3]
  26071. */
  26072. function wrapperValue() {
  26073. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26074. }
  26075. /*------------------------------------------------------------------------*/
  26076. /**
  26077. * Creates an object composed of keys generated from the results of running
  26078. * each element of `collection` thru `iteratee`. The corresponding value of
  26079. * each key is the number of times the key was returned by `iteratee`. The
  26080. * iteratee is invoked with one argument: (value).
  26081. *
  26082. * @static
  26083. * @memberOf _
  26084. * @since 0.5.0
  26085. * @category Collection
  26086. * @param {Array|Object} collection The collection to iterate over.
  26087. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26088. * @returns {Object} Returns the composed aggregate object.
  26089. * @example
  26090. *
  26091. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26092. * // => { '4': 1, '6': 2 }
  26093. *
  26094. * // The `_.property` iteratee shorthand.
  26095. * _.countBy(['one', 'two', 'three'], 'length');
  26096. * // => { '3': 2, '5': 1 }
  26097. */
  26098. var countBy = createAggregator(function(result, value, key) {
  26099. if (hasOwnProperty.call(result, key)) {
  26100. ++result[key];
  26101. } else {
  26102. baseAssignValue(result, key, 1);
  26103. }
  26104. });
  26105. /**
  26106. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26107. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26108. * invoked with three arguments: (value, index|key, collection).
  26109. *
  26110. * **Note:** This method returns `true` for
  26111. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26112. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26113. * elements of empty collections.
  26114. *
  26115. * @static
  26116. * @memberOf _
  26117. * @since 0.1.0
  26118. * @category Collection
  26119. * @param {Array|Object} collection The collection to iterate over.
  26120. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26121. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26122. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26123. * else `false`.
  26124. * @example
  26125. *
  26126. * _.every([true, 1, null, 'yes'], Boolean);
  26127. * // => false
  26128. *
  26129. * var users = [
  26130. * { 'user': 'barney', 'age': 36, 'active': false },
  26131. * { 'user': 'fred', 'age': 40, 'active': false }
  26132. * ];
  26133. *
  26134. * // The `_.matches` iteratee shorthand.
  26135. * _.every(users, { 'user': 'barney', 'active': false });
  26136. * // => false
  26137. *
  26138. * // The `_.matchesProperty` iteratee shorthand.
  26139. * _.every(users, ['active', false]);
  26140. * // => true
  26141. *
  26142. * // The `_.property` iteratee shorthand.
  26143. * _.every(users, 'active');
  26144. * // => false
  26145. */
  26146. function every(collection, predicate, guard) {
  26147. var func = isArray(collection) ? arrayEvery : baseEvery;
  26148. if (guard && isIterateeCall(collection, predicate, guard)) {
  26149. predicate = undefined;
  26150. }
  26151. return func(collection, getIteratee(predicate, 3));
  26152. }
  26153. /**
  26154. * Iterates over elements of `collection`, returning an array of all elements
  26155. * `predicate` returns truthy for. The predicate is invoked with three
  26156. * arguments: (value, index|key, collection).
  26157. *
  26158. * **Note:** Unlike `_.remove`, this method returns a new array.
  26159. *
  26160. * @static
  26161. * @memberOf _
  26162. * @since 0.1.0
  26163. * @category Collection
  26164. * @param {Array|Object} collection The collection to iterate over.
  26165. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26166. * @returns {Array} Returns the new filtered array.
  26167. * @see _.reject
  26168. * @example
  26169. *
  26170. * var users = [
  26171. * { 'user': 'barney', 'age': 36, 'active': true },
  26172. * { 'user': 'fred', 'age': 40, 'active': false }
  26173. * ];
  26174. *
  26175. * _.filter(users, function(o) { return !o.active; });
  26176. * // => objects for ['fred']
  26177. *
  26178. * // The `_.matches` iteratee shorthand.
  26179. * _.filter(users, { 'age': 36, 'active': true });
  26180. * // => objects for ['barney']
  26181. *
  26182. * // The `_.matchesProperty` iteratee shorthand.
  26183. * _.filter(users, ['active', false]);
  26184. * // => objects for ['fred']
  26185. *
  26186. * // The `_.property` iteratee shorthand.
  26187. * _.filter(users, 'active');
  26188. * // => objects for ['barney']
  26189. */
  26190. function filter(collection, predicate) {
  26191. var func = isArray(collection) ? arrayFilter : baseFilter;
  26192. return func(collection, getIteratee(predicate, 3));
  26193. }
  26194. /**
  26195. * Iterates over elements of `collection`, returning the first element
  26196. * `predicate` returns truthy for. The predicate is invoked with three
  26197. * arguments: (value, index|key, collection).
  26198. *
  26199. * @static
  26200. * @memberOf _
  26201. * @since 0.1.0
  26202. * @category Collection
  26203. * @param {Array|Object} collection The collection to inspect.
  26204. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26205. * @param {number} [fromIndex=0] The index to search from.
  26206. * @returns {*} Returns the matched element, else `undefined`.
  26207. * @example
  26208. *
  26209. * var users = [
  26210. * { 'user': 'barney', 'age': 36, 'active': true },
  26211. * { 'user': 'fred', 'age': 40, 'active': false },
  26212. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26213. * ];
  26214. *
  26215. * _.find(users, function(o) { return o.age < 40; });
  26216. * // => object for 'barney'
  26217. *
  26218. * // The `_.matches` iteratee shorthand.
  26219. * _.find(users, { 'age': 1, 'active': true });
  26220. * // => object for 'pebbles'
  26221. *
  26222. * // The `_.matchesProperty` iteratee shorthand.
  26223. * _.find(users, ['active', false]);
  26224. * // => object for 'fred'
  26225. *
  26226. * // The `_.property` iteratee shorthand.
  26227. * _.find(users, 'active');
  26228. * // => object for 'barney'
  26229. */
  26230. var find = createFind(findIndex);
  26231. /**
  26232. * This method is like `_.find` except that it iterates over elements of
  26233. * `collection` from right to left.
  26234. *
  26235. * @static
  26236. * @memberOf _
  26237. * @since 2.0.0
  26238. * @category Collection
  26239. * @param {Array|Object} collection The collection to inspect.
  26240. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26241. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26242. * @returns {*} Returns the matched element, else `undefined`.
  26243. * @example
  26244. *
  26245. * _.findLast([1, 2, 3, 4], function(n) {
  26246. * return n % 2 == 1;
  26247. * });
  26248. * // => 3
  26249. */
  26250. var findLast = createFind(findLastIndex);
  26251. /**
  26252. * Creates a flattened array of values by running each element in `collection`
  26253. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26254. * with three arguments: (value, index|key, collection).
  26255. *
  26256. * @static
  26257. * @memberOf _
  26258. * @since 4.0.0
  26259. * @category Collection
  26260. * @param {Array|Object} collection The collection to iterate over.
  26261. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26262. * @returns {Array} Returns the new flattened array.
  26263. * @example
  26264. *
  26265. * function duplicate(n) {
  26266. * return [n, n];
  26267. * }
  26268. *
  26269. * _.flatMap([1, 2], duplicate);
  26270. * // => [1, 1, 2, 2]
  26271. */
  26272. function flatMap(collection, iteratee) {
  26273. return baseFlatten(map(collection, iteratee), 1);
  26274. }
  26275. /**
  26276. * This method is like `_.flatMap` except that it recursively flattens the
  26277. * mapped results.
  26278. *
  26279. * @static
  26280. * @memberOf _
  26281. * @since 4.7.0
  26282. * @category Collection
  26283. * @param {Array|Object} collection The collection to iterate over.
  26284. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26285. * @returns {Array} Returns the new flattened array.
  26286. * @example
  26287. *
  26288. * function duplicate(n) {
  26289. * return [[[n, n]]];
  26290. * }
  26291. *
  26292. * _.flatMapDeep([1, 2], duplicate);
  26293. * // => [1, 1, 2, 2]
  26294. */
  26295. function flatMapDeep(collection, iteratee) {
  26296. return baseFlatten(map(collection, iteratee), INFINITY);
  26297. }
  26298. /**
  26299. * This method is like `_.flatMap` except that it recursively flattens the
  26300. * mapped results up to `depth` times.
  26301. *
  26302. * @static
  26303. * @memberOf _
  26304. * @since 4.7.0
  26305. * @category Collection
  26306. * @param {Array|Object} collection The collection to iterate over.
  26307. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26308. * @param {number} [depth=1] The maximum recursion depth.
  26309. * @returns {Array} Returns the new flattened array.
  26310. * @example
  26311. *
  26312. * function duplicate(n) {
  26313. * return [[[n, n]]];
  26314. * }
  26315. *
  26316. * _.flatMapDepth([1, 2], duplicate, 2);
  26317. * // => [[1, 1], [2, 2]]
  26318. */
  26319. function flatMapDepth(collection, iteratee, depth) {
  26320. depth = depth === undefined ? 1 : toInteger(depth);
  26321. return baseFlatten(map(collection, iteratee), depth);
  26322. }
  26323. /**
  26324. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26325. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26326. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26327. *
  26328. * **Note:** As with other "Collections" methods, objects with a "length"
  26329. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26330. * or `_.forOwn` for object iteration.
  26331. *
  26332. * @static
  26333. * @memberOf _
  26334. * @since 0.1.0
  26335. * @alias each
  26336. * @category Collection
  26337. * @param {Array|Object} collection The collection to iterate over.
  26338. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26339. * @returns {Array|Object} Returns `collection`.
  26340. * @see _.forEachRight
  26341. * @example
  26342. *
  26343. * _.forEach([1, 2], function(value) {
  26344. * console.log(value);
  26345. * });
  26346. * // => Logs `1` then `2`.
  26347. *
  26348. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26349. * console.log(key);
  26350. * });
  26351. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26352. */
  26353. function forEach(collection, iteratee) {
  26354. var func = isArray(collection) ? arrayEach : baseEach;
  26355. return func(collection, getIteratee(iteratee, 3));
  26356. }
  26357. /**
  26358. * This method is like `_.forEach` except that it iterates over elements of
  26359. * `collection` from right to left.
  26360. *
  26361. * @static
  26362. * @memberOf _
  26363. * @since 2.0.0
  26364. * @alias eachRight
  26365. * @category Collection
  26366. * @param {Array|Object} collection The collection to iterate over.
  26367. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26368. * @returns {Array|Object} Returns `collection`.
  26369. * @see _.forEach
  26370. * @example
  26371. *
  26372. * _.forEachRight([1, 2], function(value) {
  26373. * console.log(value);
  26374. * });
  26375. * // => Logs `2` then `1`.
  26376. */
  26377. function forEachRight(collection, iteratee) {
  26378. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26379. return func(collection, getIteratee(iteratee, 3));
  26380. }
  26381. /**
  26382. * Creates an object composed of keys generated from the results of running
  26383. * each element of `collection` thru `iteratee`. The order of grouped values
  26384. * is determined by the order they occur in `collection`. The corresponding
  26385. * value of each key is an array of elements responsible for generating the
  26386. * key. The iteratee is invoked with one argument: (value).
  26387. *
  26388. * @static
  26389. * @memberOf _
  26390. * @since 0.1.0
  26391. * @category Collection
  26392. * @param {Array|Object} collection The collection to iterate over.
  26393. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26394. * @returns {Object} Returns the composed aggregate object.
  26395. * @example
  26396. *
  26397. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26398. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26399. *
  26400. * // The `_.property` iteratee shorthand.
  26401. * _.groupBy(['one', 'two', 'three'], 'length');
  26402. * // => { '3': ['one', 'two'], '5': ['three'] }
  26403. */
  26404. var groupBy = createAggregator(function(result, value, key) {
  26405. if (hasOwnProperty.call(result, key)) {
  26406. result[key].push(value);
  26407. } else {
  26408. baseAssignValue(result, key, [value]);
  26409. }
  26410. });
  26411. /**
  26412. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26413. * checked for a substring of `value`, otherwise
  26414. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26415. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26416. * the offset from the end of `collection`.
  26417. *
  26418. * @static
  26419. * @memberOf _
  26420. * @since 0.1.0
  26421. * @category Collection
  26422. * @param {Array|Object|string} collection The collection to inspect.
  26423. * @param {*} value The value to search for.
  26424. * @param {number} [fromIndex=0] The index to search from.
  26425. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26426. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26427. * @example
  26428. *
  26429. * _.includes([1, 2, 3], 1);
  26430. * // => true
  26431. *
  26432. * _.includes([1, 2, 3], 1, 2);
  26433. * // => false
  26434. *
  26435. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26436. * // => true
  26437. *
  26438. * _.includes('abcd', 'bc');
  26439. * // => true
  26440. */
  26441. function includes(collection, value, fromIndex, guard) {
  26442. collection = isArrayLike(collection) ? collection : values(collection);
  26443. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26444. var length = collection.length;
  26445. if (fromIndex < 0) {
  26446. fromIndex = nativeMax(length + fromIndex, 0);
  26447. }
  26448. return isString(collection)
  26449. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26450. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26451. }
  26452. /**
  26453. * Invokes the method at `path` of each element in `collection`, returning
  26454. * an array of the results of each invoked method. Any additional arguments
  26455. * are provided to each invoked method. If `path` is a function, it's invoked
  26456. * for, and `this` bound to, each element in `collection`.
  26457. *
  26458. * @static
  26459. * @memberOf _
  26460. * @since 4.0.0
  26461. * @category Collection
  26462. * @param {Array|Object} collection The collection to iterate over.
  26463. * @param {Array|Function|string} path The path of the method to invoke or
  26464. * the function invoked per iteration.
  26465. * @param {...*} [args] The arguments to invoke each method with.
  26466. * @returns {Array} Returns the array of results.
  26467. * @example
  26468. *
  26469. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26470. * // => [[1, 5, 7], [1, 2, 3]]
  26471. *
  26472. * _.invokeMap([123, 456], String.prototype.split, '');
  26473. * // => [['1', '2', '3'], ['4', '5', '6']]
  26474. */
  26475. var invokeMap = baseRest(function(collection, path, args) {
  26476. var index = -1,
  26477. isFunc = typeof path == 'function',
  26478. result = isArrayLike(collection) ? Array(collection.length) : [];
  26479. baseEach(collection, function(value) {
  26480. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26481. });
  26482. return result;
  26483. });
  26484. /**
  26485. * Creates an object composed of keys generated from the results of running
  26486. * each element of `collection` thru `iteratee`. The corresponding value of
  26487. * each key is the last element responsible for generating the key. The
  26488. * iteratee is invoked with one argument: (value).
  26489. *
  26490. * @static
  26491. * @memberOf _
  26492. * @since 4.0.0
  26493. * @category Collection
  26494. * @param {Array|Object} collection The collection to iterate over.
  26495. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26496. * @returns {Object} Returns the composed aggregate object.
  26497. * @example
  26498. *
  26499. * var array = [
  26500. * { 'dir': 'left', 'code': 97 },
  26501. * { 'dir': 'right', 'code': 100 }
  26502. * ];
  26503. *
  26504. * _.keyBy(array, function(o) {
  26505. * return String.fromCharCode(o.code);
  26506. * });
  26507. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26508. *
  26509. * _.keyBy(array, 'dir');
  26510. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26511. */
  26512. var keyBy = createAggregator(function(result, value, key) {
  26513. baseAssignValue(result, key, value);
  26514. });
  26515. /**
  26516. * Creates an array of values by running each element in `collection` thru
  26517. * `iteratee`. The iteratee is invoked with three arguments:
  26518. * (value, index|key, collection).
  26519. *
  26520. * Many lodash methods are guarded to work as iteratees for methods like
  26521. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26522. *
  26523. * The guarded methods are:
  26524. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26525. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26526. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26527. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26528. *
  26529. * @static
  26530. * @memberOf _
  26531. * @since 0.1.0
  26532. * @category Collection
  26533. * @param {Array|Object} collection The collection to iterate over.
  26534. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26535. * @returns {Array} Returns the new mapped array.
  26536. * @example
  26537. *
  26538. * function square(n) {
  26539. * return n * n;
  26540. * }
  26541. *
  26542. * _.map([4, 8], square);
  26543. * // => [16, 64]
  26544. *
  26545. * _.map({ 'a': 4, 'b': 8 }, square);
  26546. * // => [16, 64] (iteration order is not guaranteed)
  26547. *
  26548. * var users = [
  26549. * { 'user': 'barney' },
  26550. * { 'user': 'fred' }
  26551. * ];
  26552. *
  26553. * // The `_.property` iteratee shorthand.
  26554. * _.map(users, 'user');
  26555. * // => ['barney', 'fred']
  26556. */
  26557. function map(collection, iteratee) {
  26558. var func = isArray(collection) ? arrayMap : baseMap;
  26559. return func(collection, getIteratee(iteratee, 3));
  26560. }
  26561. /**
  26562. * This method is like `_.sortBy` except that it allows specifying the sort
  26563. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26564. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26565. * descending or "asc" for ascending sort order of corresponding values.
  26566. *
  26567. * @static
  26568. * @memberOf _
  26569. * @since 4.0.0
  26570. * @category Collection
  26571. * @param {Array|Object} collection The collection to iterate over.
  26572. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26573. * The iteratees to sort by.
  26574. * @param {string[]} [orders] The sort orders of `iteratees`.
  26575. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26576. * @returns {Array} Returns the new sorted array.
  26577. * @example
  26578. *
  26579. * var users = [
  26580. * { 'user': 'fred', 'age': 48 },
  26581. * { 'user': 'barney', 'age': 34 },
  26582. * { 'user': 'fred', 'age': 40 },
  26583. * { 'user': 'barney', 'age': 36 }
  26584. * ];
  26585. *
  26586. * // Sort by `user` in ascending order and by `age` in descending order.
  26587. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26588. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26589. */
  26590. function orderBy(collection, iteratees, orders, guard) {
  26591. if (collection == null) {
  26592. return [];
  26593. }
  26594. if (!isArray(iteratees)) {
  26595. iteratees = iteratees == null ? [] : [iteratees];
  26596. }
  26597. orders = guard ? undefined : orders;
  26598. if (!isArray(orders)) {
  26599. orders = orders == null ? [] : [orders];
  26600. }
  26601. return baseOrderBy(collection, iteratees, orders);
  26602. }
  26603. /**
  26604. * Creates an array of elements split into two groups, the first of which
  26605. * contains elements `predicate` returns truthy for, the second of which
  26606. * contains elements `predicate` returns falsey for. The predicate is
  26607. * invoked with one argument: (value).
  26608. *
  26609. * @static
  26610. * @memberOf _
  26611. * @since 3.0.0
  26612. * @category Collection
  26613. * @param {Array|Object} collection The collection to iterate over.
  26614. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26615. * @returns {Array} Returns the array of grouped elements.
  26616. * @example
  26617. *
  26618. * var users = [
  26619. * { 'user': 'barney', 'age': 36, 'active': false },
  26620. * { 'user': 'fred', 'age': 40, 'active': true },
  26621. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26622. * ];
  26623. *
  26624. * _.partition(users, function(o) { return o.active; });
  26625. * // => objects for [['fred'], ['barney', 'pebbles']]
  26626. *
  26627. * // The `_.matches` iteratee shorthand.
  26628. * _.partition(users, { 'age': 1, 'active': false });
  26629. * // => objects for [['pebbles'], ['barney', 'fred']]
  26630. *
  26631. * // The `_.matchesProperty` iteratee shorthand.
  26632. * _.partition(users, ['active', false]);
  26633. * // => objects for [['barney', 'pebbles'], ['fred']]
  26634. *
  26635. * // The `_.property` iteratee shorthand.
  26636. * _.partition(users, 'active');
  26637. * // => objects for [['fred'], ['barney', 'pebbles']]
  26638. */
  26639. var partition = createAggregator(function(result, value, key) {
  26640. result[key ? 0 : 1].push(value);
  26641. }, function() { return [[], []]; });
  26642. /**
  26643. * Reduces `collection` to a value which is the accumulated result of running
  26644. * each element in `collection` thru `iteratee`, where each successive
  26645. * invocation is supplied the return value of the previous. If `accumulator`
  26646. * is not given, the first element of `collection` is used as the initial
  26647. * value. The iteratee is invoked with four arguments:
  26648. * (accumulator, value, index|key, collection).
  26649. *
  26650. * Many lodash methods are guarded to work as iteratees for methods like
  26651. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26652. *
  26653. * The guarded methods are:
  26654. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26655. * and `sortBy`
  26656. *
  26657. * @static
  26658. * @memberOf _
  26659. * @since 0.1.0
  26660. * @category Collection
  26661. * @param {Array|Object} collection The collection to iterate over.
  26662. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26663. * @param {*} [accumulator] The initial value.
  26664. * @returns {*} Returns the accumulated value.
  26665. * @see _.reduceRight
  26666. * @example
  26667. *
  26668. * _.reduce([1, 2], function(sum, n) {
  26669. * return sum + n;
  26670. * }, 0);
  26671. * // => 3
  26672. *
  26673. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26674. * (result[value] || (result[value] = [])).push(key);
  26675. * return result;
  26676. * }, {});
  26677. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26678. */
  26679. function reduce(collection, iteratee, accumulator) {
  26680. var func = isArray(collection) ? arrayReduce : baseReduce,
  26681. initAccum = arguments.length < 3;
  26682. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26683. }
  26684. /**
  26685. * This method is like `_.reduce` except that it iterates over elements of
  26686. * `collection` from right to left.
  26687. *
  26688. * @static
  26689. * @memberOf _
  26690. * @since 0.1.0
  26691. * @category Collection
  26692. * @param {Array|Object} collection The collection to iterate over.
  26693. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26694. * @param {*} [accumulator] The initial value.
  26695. * @returns {*} Returns the accumulated value.
  26696. * @see _.reduce
  26697. * @example
  26698. *
  26699. * var array = [[0, 1], [2, 3], [4, 5]];
  26700. *
  26701. * _.reduceRight(array, function(flattened, other) {
  26702. * return flattened.concat(other);
  26703. * }, []);
  26704. * // => [4, 5, 2, 3, 0, 1]
  26705. */
  26706. function reduceRight(collection, iteratee, accumulator) {
  26707. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  26708. initAccum = arguments.length < 3;
  26709. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  26710. }
  26711. /**
  26712. * The opposite of `_.filter`; this method returns the elements of `collection`
  26713. * that `predicate` does **not** return truthy for.
  26714. *
  26715. * @static
  26716. * @memberOf _
  26717. * @since 0.1.0
  26718. * @category Collection
  26719. * @param {Array|Object} collection The collection to iterate over.
  26720. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26721. * @returns {Array} Returns the new filtered array.
  26722. * @see _.filter
  26723. * @example
  26724. *
  26725. * var users = [
  26726. * { 'user': 'barney', 'age': 36, 'active': false },
  26727. * { 'user': 'fred', 'age': 40, 'active': true }
  26728. * ];
  26729. *
  26730. * _.reject(users, function(o) { return !o.active; });
  26731. * // => objects for ['fred']
  26732. *
  26733. * // The `_.matches` iteratee shorthand.
  26734. * _.reject(users, { 'age': 40, 'active': true });
  26735. * // => objects for ['barney']
  26736. *
  26737. * // The `_.matchesProperty` iteratee shorthand.
  26738. * _.reject(users, ['active', false]);
  26739. * // => objects for ['fred']
  26740. *
  26741. * // The `_.property` iteratee shorthand.
  26742. * _.reject(users, 'active');
  26743. * // => objects for ['barney']
  26744. */
  26745. function reject(collection, predicate) {
  26746. var func = isArray(collection) ? arrayFilter : baseFilter;
  26747. return func(collection, negate(getIteratee(predicate, 3)));
  26748. }
  26749. /**
  26750. * Gets a random element from `collection`.
  26751. *
  26752. * @static
  26753. * @memberOf _
  26754. * @since 2.0.0
  26755. * @category Collection
  26756. * @param {Array|Object} collection The collection to sample.
  26757. * @returns {*} Returns the random element.
  26758. * @example
  26759. *
  26760. * _.sample([1, 2, 3, 4]);
  26761. * // => 2
  26762. */
  26763. function sample(collection) {
  26764. var func = isArray(collection) ? arraySample : baseSample;
  26765. return func(collection);
  26766. }
  26767. /**
  26768. * Gets `n` random elements at unique keys from `collection` up to the
  26769. * size of `collection`.
  26770. *
  26771. * @static
  26772. * @memberOf _
  26773. * @since 4.0.0
  26774. * @category Collection
  26775. * @param {Array|Object} collection The collection to sample.
  26776. * @param {number} [n=1] The number of elements to sample.
  26777. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26778. * @returns {Array} Returns the random elements.
  26779. * @example
  26780. *
  26781. * _.sampleSize([1, 2, 3], 2);
  26782. * // => [3, 1]
  26783. *
  26784. * _.sampleSize([1, 2, 3], 4);
  26785. * // => [2, 3, 1]
  26786. */
  26787. function sampleSize(collection, n, guard) {
  26788. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  26789. n = 1;
  26790. } else {
  26791. n = toInteger(n);
  26792. }
  26793. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  26794. return func(collection, n);
  26795. }
  26796. /**
  26797. * Creates an array of shuffled values, using a version of the
  26798. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  26799. *
  26800. * @static
  26801. * @memberOf _
  26802. * @since 0.1.0
  26803. * @category Collection
  26804. * @param {Array|Object} collection The collection to shuffle.
  26805. * @returns {Array} Returns the new shuffled array.
  26806. * @example
  26807. *
  26808. * _.shuffle([1, 2, 3, 4]);
  26809. * // => [4, 1, 3, 2]
  26810. */
  26811. function shuffle(collection) {
  26812. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  26813. return func(collection);
  26814. }
  26815. /**
  26816. * Gets the size of `collection` by returning its length for array-like
  26817. * values or the number of own enumerable string keyed properties for objects.
  26818. *
  26819. * @static
  26820. * @memberOf _
  26821. * @since 0.1.0
  26822. * @category Collection
  26823. * @param {Array|Object|string} collection The collection to inspect.
  26824. * @returns {number} Returns the collection size.
  26825. * @example
  26826. *
  26827. * _.size([1, 2, 3]);
  26828. * // => 3
  26829. *
  26830. * _.size({ 'a': 1, 'b': 2 });
  26831. * // => 2
  26832. *
  26833. * _.size('pebbles');
  26834. * // => 7
  26835. */
  26836. function size(collection) {
  26837. if (collection == null) {
  26838. return 0;
  26839. }
  26840. if (isArrayLike(collection)) {
  26841. return isString(collection) ? stringSize(collection) : collection.length;
  26842. }
  26843. var tag = getTag(collection);
  26844. if (tag == mapTag || tag == setTag) {
  26845. return collection.size;
  26846. }
  26847. return baseKeys(collection).length;
  26848. }
  26849. /**
  26850. * Checks if `predicate` returns truthy for **any** element of `collection`.
  26851. * Iteration is stopped once `predicate` returns truthy. The predicate is
  26852. * invoked with three arguments: (value, index|key, collection).
  26853. *
  26854. * @static
  26855. * @memberOf _
  26856. * @since 0.1.0
  26857. * @category Collection
  26858. * @param {Array|Object} collection The collection to iterate over.
  26859. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26860. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26861. * @returns {boolean} Returns `true` if any element passes the predicate check,
  26862. * else `false`.
  26863. * @example
  26864. *
  26865. * _.some([null, 0, 'yes', false], Boolean);
  26866. * // => true
  26867. *
  26868. * var users = [
  26869. * { 'user': 'barney', 'active': true },
  26870. * { 'user': 'fred', 'active': false }
  26871. * ];
  26872. *
  26873. * // The `_.matches` iteratee shorthand.
  26874. * _.some(users, { 'user': 'barney', 'active': false });
  26875. * // => false
  26876. *
  26877. * // The `_.matchesProperty` iteratee shorthand.
  26878. * _.some(users, ['active', false]);
  26879. * // => true
  26880. *
  26881. * // The `_.property` iteratee shorthand.
  26882. * _.some(users, 'active');
  26883. * // => true
  26884. */
  26885. function some(collection, predicate, guard) {
  26886. var func = isArray(collection) ? arraySome : baseSome;
  26887. if (guard && isIterateeCall(collection, predicate, guard)) {
  26888. predicate = undefined;
  26889. }
  26890. return func(collection, getIteratee(predicate, 3));
  26891. }
  26892. /**
  26893. * Creates an array of elements, sorted in ascending order by the results of
  26894. * running each element in a collection thru each iteratee. This method
  26895. * performs a stable sort, that is, it preserves the original sort order of
  26896. * equal elements. The iteratees are invoked with one argument: (value).
  26897. *
  26898. * @static
  26899. * @memberOf _
  26900. * @since 0.1.0
  26901. * @category Collection
  26902. * @param {Array|Object} collection The collection to iterate over.
  26903. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  26904. * The iteratees to sort by.
  26905. * @returns {Array} Returns the new sorted array.
  26906. * @example
  26907. *
  26908. * var users = [
  26909. * { 'user': 'fred', 'age': 48 },
  26910. * { 'user': 'barney', 'age': 36 },
  26911. * { 'user': 'fred', 'age': 40 },
  26912. * { 'user': 'barney', 'age': 34 }
  26913. * ];
  26914. *
  26915. * _.sortBy(users, [function(o) { return o.user; }]);
  26916. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26917. *
  26918. * _.sortBy(users, ['user', 'age']);
  26919. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  26920. */
  26921. var sortBy = baseRest(function(collection, iteratees) {
  26922. if (collection == null) {
  26923. return [];
  26924. }
  26925. var length = iteratees.length;
  26926. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  26927. iteratees = [];
  26928. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  26929. iteratees = [iteratees[0]];
  26930. }
  26931. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  26932. });
  26933. /*------------------------------------------------------------------------*/
  26934. /**
  26935. * Gets the timestamp of the number of milliseconds that have elapsed since
  26936. * the Unix epoch (1 January 1970 00:00:00 UTC).
  26937. *
  26938. * @static
  26939. * @memberOf _
  26940. * @since 2.4.0
  26941. * @category Date
  26942. * @returns {number} Returns the timestamp.
  26943. * @example
  26944. *
  26945. * _.defer(function(stamp) {
  26946. * console.log(_.now() - stamp);
  26947. * }, _.now());
  26948. * // => Logs the number of milliseconds it took for the deferred invocation.
  26949. */
  26950. var now = ctxNow || function() {
  26951. return root.Date.now();
  26952. };
  26953. /*------------------------------------------------------------------------*/
  26954. /**
  26955. * The opposite of `_.before`; this method creates a function that invokes
  26956. * `func` once it's called `n` or more times.
  26957. *
  26958. * @static
  26959. * @memberOf _
  26960. * @since 0.1.0
  26961. * @category Function
  26962. * @param {number} n The number of calls before `func` is invoked.
  26963. * @param {Function} func The function to restrict.
  26964. * @returns {Function} Returns the new restricted function.
  26965. * @example
  26966. *
  26967. * var saves = ['profile', 'settings'];
  26968. *
  26969. * var done = _.after(saves.length, function() {
  26970. * console.log('done saving!');
  26971. * });
  26972. *
  26973. * _.forEach(saves, function(type) {
  26974. * asyncSave({ 'type': type, 'complete': done });
  26975. * });
  26976. * // => Logs 'done saving!' after the two async saves have completed.
  26977. */
  26978. function after(n, func) {
  26979. if (typeof func != 'function') {
  26980. throw new TypeError(FUNC_ERROR_TEXT);
  26981. }
  26982. n = toInteger(n);
  26983. return function() {
  26984. if (--n < 1) {
  26985. return func.apply(this, arguments);
  26986. }
  26987. };
  26988. }
  26989. /**
  26990. * Creates a function that invokes `func`, with up to `n` arguments,
  26991. * ignoring any additional arguments.
  26992. *
  26993. * @static
  26994. * @memberOf _
  26995. * @since 3.0.0
  26996. * @category Function
  26997. * @param {Function} func The function to cap arguments for.
  26998. * @param {number} [n=func.length] The arity cap.
  26999. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27000. * @returns {Function} Returns the new capped function.
  27001. * @example
  27002. *
  27003. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27004. * // => [6, 8, 10]
  27005. */
  27006. function ary(func, n, guard) {
  27007. n = guard ? undefined : n;
  27008. n = (func && n == null) ? func.length : n;
  27009. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27010. }
  27011. /**
  27012. * Creates a function that invokes `func`, with the `this` binding and arguments
  27013. * of the created function, while it's called less than `n` times. Subsequent
  27014. * calls to the created function return the result of the last `func` invocation.
  27015. *
  27016. * @static
  27017. * @memberOf _
  27018. * @since 3.0.0
  27019. * @category Function
  27020. * @param {number} n The number of calls at which `func` is no longer invoked.
  27021. * @param {Function} func The function to restrict.
  27022. * @returns {Function} Returns the new restricted function.
  27023. * @example
  27024. *
  27025. * jQuery(element).on('click', _.before(5, addContactToList));
  27026. * // => Allows adding up to 4 contacts to the list.
  27027. */
  27028. function before(n, func) {
  27029. var result;
  27030. if (typeof func != 'function') {
  27031. throw new TypeError(FUNC_ERROR_TEXT);
  27032. }
  27033. n = toInteger(n);
  27034. return function() {
  27035. if (--n > 0) {
  27036. result = func.apply(this, arguments);
  27037. }
  27038. if (n <= 1) {
  27039. func = undefined;
  27040. }
  27041. return result;
  27042. };
  27043. }
  27044. /**
  27045. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27046. * and `partials` prepended to the arguments it receives.
  27047. *
  27048. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27049. * may be used as a placeholder for partially applied arguments.
  27050. *
  27051. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27052. * property of bound functions.
  27053. *
  27054. * @static
  27055. * @memberOf _
  27056. * @since 0.1.0
  27057. * @category Function
  27058. * @param {Function} func The function to bind.
  27059. * @param {*} thisArg The `this` binding of `func`.
  27060. * @param {...*} [partials] The arguments to be partially applied.
  27061. * @returns {Function} Returns the new bound function.
  27062. * @example
  27063. *
  27064. * function greet(greeting, punctuation) {
  27065. * return greeting + ' ' + this.user + punctuation;
  27066. * }
  27067. *
  27068. * var object = { 'user': 'fred' };
  27069. *
  27070. * var bound = _.bind(greet, object, 'hi');
  27071. * bound('!');
  27072. * // => 'hi fred!'
  27073. *
  27074. * // Bound with placeholders.
  27075. * var bound = _.bind(greet, object, _, '!');
  27076. * bound('hi');
  27077. * // => 'hi fred!'
  27078. */
  27079. var bind = baseRest(function(func, thisArg, partials) {
  27080. var bitmask = WRAP_BIND_FLAG;
  27081. if (partials.length) {
  27082. var holders = replaceHolders(partials, getHolder(bind));
  27083. bitmask |= WRAP_PARTIAL_FLAG;
  27084. }
  27085. return createWrap(func, bitmask, thisArg, partials, holders);
  27086. });
  27087. /**
  27088. * Creates a function that invokes the method at `object[key]` with `partials`
  27089. * prepended to the arguments it receives.
  27090. *
  27091. * This method differs from `_.bind` by allowing bound functions to reference
  27092. * methods that may be redefined or don't yet exist. See
  27093. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27094. * for more details.
  27095. *
  27096. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27097. * builds, may be used as a placeholder for partially applied arguments.
  27098. *
  27099. * @static
  27100. * @memberOf _
  27101. * @since 0.10.0
  27102. * @category Function
  27103. * @param {Object} object The object to invoke the method on.
  27104. * @param {string} key The key of the method.
  27105. * @param {...*} [partials] The arguments to be partially applied.
  27106. * @returns {Function} Returns the new bound function.
  27107. * @example
  27108. *
  27109. * var object = {
  27110. * 'user': 'fred',
  27111. * 'greet': function(greeting, punctuation) {
  27112. * return greeting + ' ' + this.user + punctuation;
  27113. * }
  27114. * };
  27115. *
  27116. * var bound = _.bindKey(object, 'greet', 'hi');
  27117. * bound('!');
  27118. * // => 'hi fred!'
  27119. *
  27120. * object.greet = function(greeting, punctuation) {
  27121. * return greeting + 'ya ' + this.user + punctuation;
  27122. * };
  27123. *
  27124. * bound('!');
  27125. * // => 'hiya fred!'
  27126. *
  27127. * // Bound with placeholders.
  27128. * var bound = _.bindKey(object, 'greet', _, '!');
  27129. * bound('hi');
  27130. * // => 'hiya fred!'
  27131. */
  27132. var bindKey = baseRest(function(object, key, partials) {
  27133. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27134. if (partials.length) {
  27135. var holders = replaceHolders(partials, getHolder(bindKey));
  27136. bitmask |= WRAP_PARTIAL_FLAG;
  27137. }
  27138. return createWrap(key, bitmask, object, partials, holders);
  27139. });
  27140. /**
  27141. * Creates a function that accepts arguments of `func` and either invokes
  27142. * `func` returning its result, if at least `arity` number of arguments have
  27143. * been provided, or returns a function that accepts the remaining `func`
  27144. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27145. * is not sufficient.
  27146. *
  27147. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27148. * may be used as a placeholder for provided arguments.
  27149. *
  27150. * **Note:** This method doesn't set the "length" property of curried functions.
  27151. *
  27152. * @static
  27153. * @memberOf _
  27154. * @since 2.0.0
  27155. * @category Function
  27156. * @param {Function} func The function to curry.
  27157. * @param {number} [arity=func.length] The arity of `func`.
  27158. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27159. * @returns {Function} Returns the new curried function.
  27160. * @example
  27161. *
  27162. * var abc = function(a, b, c) {
  27163. * return [a, b, c];
  27164. * };
  27165. *
  27166. * var curried = _.curry(abc);
  27167. *
  27168. * curried(1)(2)(3);
  27169. * // => [1, 2, 3]
  27170. *
  27171. * curried(1, 2)(3);
  27172. * // => [1, 2, 3]
  27173. *
  27174. * curried(1, 2, 3);
  27175. * // => [1, 2, 3]
  27176. *
  27177. * // Curried with placeholders.
  27178. * curried(1)(_, 3)(2);
  27179. * // => [1, 2, 3]
  27180. */
  27181. function curry(func, arity, guard) {
  27182. arity = guard ? undefined : arity;
  27183. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27184. result.placeholder = curry.placeholder;
  27185. return result;
  27186. }
  27187. /**
  27188. * This method is like `_.curry` except that arguments are applied to `func`
  27189. * in the manner of `_.partialRight` instead of `_.partial`.
  27190. *
  27191. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27192. * builds, may be used as a placeholder for provided arguments.
  27193. *
  27194. * **Note:** This method doesn't set the "length" property of curried functions.
  27195. *
  27196. * @static
  27197. * @memberOf _
  27198. * @since 3.0.0
  27199. * @category Function
  27200. * @param {Function} func The function to curry.
  27201. * @param {number} [arity=func.length] The arity of `func`.
  27202. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27203. * @returns {Function} Returns the new curried function.
  27204. * @example
  27205. *
  27206. * var abc = function(a, b, c) {
  27207. * return [a, b, c];
  27208. * };
  27209. *
  27210. * var curried = _.curryRight(abc);
  27211. *
  27212. * curried(3)(2)(1);
  27213. * // => [1, 2, 3]
  27214. *
  27215. * curried(2, 3)(1);
  27216. * // => [1, 2, 3]
  27217. *
  27218. * curried(1, 2, 3);
  27219. * // => [1, 2, 3]
  27220. *
  27221. * // Curried with placeholders.
  27222. * curried(3)(1, _)(2);
  27223. * // => [1, 2, 3]
  27224. */
  27225. function curryRight(func, arity, guard) {
  27226. arity = guard ? undefined : arity;
  27227. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27228. result.placeholder = curryRight.placeholder;
  27229. return result;
  27230. }
  27231. /**
  27232. * Creates a debounced function that delays invoking `func` until after `wait`
  27233. * milliseconds have elapsed since the last time the debounced function was
  27234. * invoked. The debounced function comes with a `cancel` method to cancel
  27235. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27236. * Provide `options` to indicate whether `func` should be invoked on the
  27237. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27238. * with the last arguments provided to the debounced function. Subsequent
  27239. * calls to the debounced function return the result of the last `func`
  27240. * invocation.
  27241. *
  27242. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27243. * invoked on the trailing edge of the timeout only if the debounced function
  27244. * is invoked more than once during the `wait` timeout.
  27245. *
  27246. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27247. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27248. *
  27249. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27250. * for details over the differences between `_.debounce` and `_.throttle`.
  27251. *
  27252. * @static
  27253. * @memberOf _
  27254. * @since 0.1.0
  27255. * @category Function
  27256. * @param {Function} func The function to debounce.
  27257. * @param {number} [wait=0] The number of milliseconds to delay.
  27258. * @param {Object} [options={}] The options object.
  27259. * @param {boolean} [options.leading=false]
  27260. * Specify invoking on the leading edge of the timeout.
  27261. * @param {number} [options.maxWait]
  27262. * The maximum time `func` is allowed to be delayed before it's invoked.
  27263. * @param {boolean} [options.trailing=true]
  27264. * Specify invoking on the trailing edge of the timeout.
  27265. * @returns {Function} Returns the new debounced function.
  27266. * @example
  27267. *
  27268. * // Avoid costly calculations while the window size is in flux.
  27269. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27270. *
  27271. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27272. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27273. * 'leading': true,
  27274. * 'trailing': false
  27275. * }));
  27276. *
  27277. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27278. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27279. * var source = new EventSource('/stream');
  27280. * jQuery(source).on('message', debounced);
  27281. *
  27282. * // Cancel the trailing debounced invocation.
  27283. * jQuery(window).on('popstate', debounced.cancel);
  27284. */
  27285. function debounce(func, wait, options) {
  27286. var lastArgs,
  27287. lastThis,
  27288. maxWait,
  27289. result,
  27290. timerId,
  27291. lastCallTime,
  27292. lastInvokeTime = 0,
  27293. leading = false,
  27294. maxing = false,
  27295. trailing = true;
  27296. if (typeof func != 'function') {
  27297. throw new TypeError(FUNC_ERROR_TEXT);
  27298. }
  27299. wait = toNumber(wait) || 0;
  27300. if (isObject(options)) {
  27301. leading = !!options.leading;
  27302. maxing = 'maxWait' in options;
  27303. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27304. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27305. }
  27306. function invokeFunc(time) {
  27307. var args = lastArgs,
  27308. thisArg = lastThis;
  27309. lastArgs = lastThis = undefined;
  27310. lastInvokeTime = time;
  27311. result = func.apply(thisArg, args);
  27312. return result;
  27313. }
  27314. function leadingEdge(time) {
  27315. // Reset any `maxWait` timer.
  27316. lastInvokeTime = time;
  27317. // Start the timer for the trailing edge.
  27318. timerId = setTimeout(timerExpired, wait);
  27319. // Invoke the leading edge.
  27320. return leading ? invokeFunc(time) : result;
  27321. }
  27322. function remainingWait(time) {
  27323. var timeSinceLastCall = time - lastCallTime,
  27324. timeSinceLastInvoke = time - lastInvokeTime,
  27325. timeWaiting = wait - timeSinceLastCall;
  27326. return maxing
  27327. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27328. : timeWaiting;
  27329. }
  27330. function shouldInvoke(time) {
  27331. var timeSinceLastCall = time - lastCallTime,
  27332. timeSinceLastInvoke = time - lastInvokeTime;
  27333. // Either this is the first call, activity has stopped and we're at the
  27334. // trailing edge, the system time has gone backwards and we're treating
  27335. // it as the trailing edge, or we've hit the `maxWait` limit.
  27336. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27337. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27338. }
  27339. function timerExpired() {
  27340. var time = now();
  27341. if (shouldInvoke(time)) {
  27342. return trailingEdge(time);
  27343. }
  27344. // Restart the timer.
  27345. timerId = setTimeout(timerExpired, remainingWait(time));
  27346. }
  27347. function trailingEdge(time) {
  27348. timerId = undefined;
  27349. // Only invoke if we have `lastArgs` which means `func` has been
  27350. // debounced at least once.
  27351. if (trailing && lastArgs) {
  27352. return invokeFunc(time);
  27353. }
  27354. lastArgs = lastThis = undefined;
  27355. return result;
  27356. }
  27357. function cancel() {
  27358. if (timerId !== undefined) {
  27359. clearTimeout(timerId);
  27360. }
  27361. lastInvokeTime = 0;
  27362. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27363. }
  27364. function flush() {
  27365. return timerId === undefined ? result : trailingEdge(now());
  27366. }
  27367. function debounced() {
  27368. var time = now(),
  27369. isInvoking = shouldInvoke(time);
  27370. lastArgs = arguments;
  27371. lastThis = this;
  27372. lastCallTime = time;
  27373. if (isInvoking) {
  27374. if (timerId === undefined) {
  27375. return leadingEdge(lastCallTime);
  27376. }
  27377. if (maxing) {
  27378. // Handle invocations in a tight loop.
  27379. clearTimeout(timerId);
  27380. timerId = setTimeout(timerExpired, wait);
  27381. return invokeFunc(lastCallTime);
  27382. }
  27383. }
  27384. if (timerId === undefined) {
  27385. timerId = setTimeout(timerExpired, wait);
  27386. }
  27387. return result;
  27388. }
  27389. debounced.cancel = cancel;
  27390. debounced.flush = flush;
  27391. return debounced;
  27392. }
  27393. /**
  27394. * Defers invoking the `func` until the current call stack has cleared. Any
  27395. * additional arguments are provided to `func` when it's invoked.
  27396. *
  27397. * @static
  27398. * @memberOf _
  27399. * @since 0.1.0
  27400. * @category Function
  27401. * @param {Function} func The function to defer.
  27402. * @param {...*} [args] The arguments to invoke `func` with.
  27403. * @returns {number} Returns the timer id.
  27404. * @example
  27405. *
  27406. * _.defer(function(text) {
  27407. * console.log(text);
  27408. * }, 'deferred');
  27409. * // => Logs 'deferred' after one millisecond.
  27410. */
  27411. var defer = baseRest(function(func, args) {
  27412. return baseDelay(func, 1, args);
  27413. });
  27414. /**
  27415. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27416. * provided to `func` when it's invoked.
  27417. *
  27418. * @static
  27419. * @memberOf _
  27420. * @since 0.1.0
  27421. * @category Function
  27422. * @param {Function} func The function to delay.
  27423. * @param {number} wait The number of milliseconds to delay invocation.
  27424. * @param {...*} [args] The arguments to invoke `func` with.
  27425. * @returns {number} Returns the timer id.
  27426. * @example
  27427. *
  27428. * _.delay(function(text) {
  27429. * console.log(text);
  27430. * }, 1000, 'later');
  27431. * // => Logs 'later' after one second.
  27432. */
  27433. var delay = baseRest(function(func, wait, args) {
  27434. return baseDelay(func, toNumber(wait) || 0, args);
  27435. });
  27436. /**
  27437. * Creates a function that invokes `func` with arguments reversed.
  27438. *
  27439. * @static
  27440. * @memberOf _
  27441. * @since 4.0.0
  27442. * @category Function
  27443. * @param {Function} func The function to flip arguments for.
  27444. * @returns {Function} Returns the new flipped function.
  27445. * @example
  27446. *
  27447. * var flipped = _.flip(function() {
  27448. * return _.toArray(arguments);
  27449. * });
  27450. *
  27451. * flipped('a', 'b', 'c', 'd');
  27452. * // => ['d', 'c', 'b', 'a']
  27453. */
  27454. function flip(func) {
  27455. return createWrap(func, WRAP_FLIP_FLAG);
  27456. }
  27457. /**
  27458. * Creates a function that memoizes the result of `func`. If `resolver` is
  27459. * provided, it determines the cache key for storing the result based on the
  27460. * arguments provided to the memoized function. By default, the first argument
  27461. * provided to the memoized function is used as the map cache key. The `func`
  27462. * is invoked with the `this` binding of the memoized function.
  27463. *
  27464. * **Note:** The cache is exposed as the `cache` property on the memoized
  27465. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27466. * constructor with one whose instances implement the
  27467. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27468. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27469. *
  27470. * @static
  27471. * @memberOf _
  27472. * @since 0.1.0
  27473. * @category Function
  27474. * @param {Function} func The function to have its output memoized.
  27475. * @param {Function} [resolver] The function to resolve the cache key.
  27476. * @returns {Function} Returns the new memoized function.
  27477. * @example
  27478. *
  27479. * var object = { 'a': 1, 'b': 2 };
  27480. * var other = { 'c': 3, 'd': 4 };
  27481. *
  27482. * var values = _.memoize(_.values);
  27483. * values(object);
  27484. * // => [1, 2]
  27485. *
  27486. * values(other);
  27487. * // => [3, 4]
  27488. *
  27489. * object.a = 2;
  27490. * values(object);
  27491. * // => [1, 2]
  27492. *
  27493. * // Modify the result cache.
  27494. * values.cache.set(object, ['a', 'b']);
  27495. * values(object);
  27496. * // => ['a', 'b']
  27497. *
  27498. * // Replace `_.memoize.Cache`.
  27499. * _.memoize.Cache = WeakMap;
  27500. */
  27501. function memoize(func, resolver) {
  27502. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27503. throw new TypeError(FUNC_ERROR_TEXT);
  27504. }
  27505. var memoized = function() {
  27506. var args = arguments,
  27507. key = resolver ? resolver.apply(this, args) : args[0],
  27508. cache = memoized.cache;
  27509. if (cache.has(key)) {
  27510. return cache.get(key);
  27511. }
  27512. var result = func.apply(this, args);
  27513. memoized.cache = cache.set(key, result) || cache;
  27514. return result;
  27515. };
  27516. memoized.cache = new (memoize.Cache || MapCache);
  27517. return memoized;
  27518. }
  27519. // Expose `MapCache`.
  27520. memoize.Cache = MapCache;
  27521. /**
  27522. * Creates a function that negates the result of the predicate `func`. The
  27523. * `func` predicate is invoked with the `this` binding and arguments of the
  27524. * created function.
  27525. *
  27526. * @static
  27527. * @memberOf _
  27528. * @since 3.0.0
  27529. * @category Function
  27530. * @param {Function} predicate The predicate to negate.
  27531. * @returns {Function} Returns the new negated function.
  27532. * @example
  27533. *
  27534. * function isEven(n) {
  27535. * return n % 2 == 0;
  27536. * }
  27537. *
  27538. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27539. * // => [1, 3, 5]
  27540. */
  27541. function negate(predicate) {
  27542. if (typeof predicate != 'function') {
  27543. throw new TypeError(FUNC_ERROR_TEXT);
  27544. }
  27545. return function() {
  27546. var args = arguments;
  27547. switch (args.length) {
  27548. case 0: return !predicate.call(this);
  27549. case 1: return !predicate.call(this, args[0]);
  27550. case 2: return !predicate.call(this, args[0], args[1]);
  27551. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27552. }
  27553. return !predicate.apply(this, args);
  27554. };
  27555. }
  27556. /**
  27557. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27558. * to the function return the value of the first invocation. The `func` is
  27559. * invoked with the `this` binding and arguments of the created function.
  27560. *
  27561. * @static
  27562. * @memberOf _
  27563. * @since 0.1.0
  27564. * @category Function
  27565. * @param {Function} func The function to restrict.
  27566. * @returns {Function} Returns the new restricted function.
  27567. * @example
  27568. *
  27569. * var initialize = _.once(createApplication);
  27570. * initialize();
  27571. * initialize();
  27572. * // => `createApplication` is invoked once
  27573. */
  27574. function once(func) {
  27575. return before(2, func);
  27576. }
  27577. /**
  27578. * Creates a function that invokes `func` with its arguments transformed.
  27579. *
  27580. * @static
  27581. * @since 4.0.0
  27582. * @memberOf _
  27583. * @category Function
  27584. * @param {Function} func The function to wrap.
  27585. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27586. * The argument transforms.
  27587. * @returns {Function} Returns the new function.
  27588. * @example
  27589. *
  27590. * function doubled(n) {
  27591. * return n * 2;
  27592. * }
  27593. *
  27594. * function square(n) {
  27595. * return n * n;
  27596. * }
  27597. *
  27598. * var func = _.overArgs(function(x, y) {
  27599. * return [x, y];
  27600. * }, [square, doubled]);
  27601. *
  27602. * func(9, 3);
  27603. * // => [81, 6]
  27604. *
  27605. * func(10, 5);
  27606. * // => [100, 10]
  27607. */
  27608. var overArgs = castRest(function(func, transforms) {
  27609. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27610. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27611. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27612. var funcsLength = transforms.length;
  27613. return baseRest(function(args) {
  27614. var index = -1,
  27615. length = nativeMin(args.length, funcsLength);
  27616. while (++index < length) {
  27617. args[index] = transforms[index].call(this, args[index]);
  27618. }
  27619. return apply(func, this, args);
  27620. });
  27621. });
  27622. /**
  27623. * Creates a function that invokes `func` with `partials` prepended to the
  27624. * arguments it receives. This method is like `_.bind` except it does **not**
  27625. * alter the `this` binding.
  27626. *
  27627. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27628. * builds, may be used as a placeholder for partially applied arguments.
  27629. *
  27630. * **Note:** This method doesn't set the "length" property of partially
  27631. * applied functions.
  27632. *
  27633. * @static
  27634. * @memberOf _
  27635. * @since 0.2.0
  27636. * @category Function
  27637. * @param {Function} func The function to partially apply arguments to.
  27638. * @param {...*} [partials] The arguments to be partially applied.
  27639. * @returns {Function} Returns the new partially applied function.
  27640. * @example
  27641. *
  27642. * function greet(greeting, name) {
  27643. * return greeting + ' ' + name;
  27644. * }
  27645. *
  27646. * var sayHelloTo = _.partial(greet, 'hello');
  27647. * sayHelloTo('fred');
  27648. * // => 'hello fred'
  27649. *
  27650. * // Partially applied with placeholders.
  27651. * var greetFred = _.partial(greet, _, 'fred');
  27652. * greetFred('hi');
  27653. * // => 'hi fred'
  27654. */
  27655. var partial = baseRest(function(func, partials) {
  27656. var holders = replaceHolders(partials, getHolder(partial));
  27657. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27658. });
  27659. /**
  27660. * This method is like `_.partial` except that partially applied arguments
  27661. * are appended to the arguments it receives.
  27662. *
  27663. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27664. * builds, may be used as a placeholder for partially applied arguments.
  27665. *
  27666. * **Note:** This method doesn't set the "length" property of partially
  27667. * applied functions.
  27668. *
  27669. * @static
  27670. * @memberOf _
  27671. * @since 1.0.0
  27672. * @category Function
  27673. * @param {Function} func The function to partially apply arguments to.
  27674. * @param {...*} [partials] The arguments to be partially applied.
  27675. * @returns {Function} Returns the new partially applied function.
  27676. * @example
  27677. *
  27678. * function greet(greeting, name) {
  27679. * return greeting + ' ' + name;
  27680. * }
  27681. *
  27682. * var greetFred = _.partialRight(greet, 'fred');
  27683. * greetFred('hi');
  27684. * // => 'hi fred'
  27685. *
  27686. * // Partially applied with placeholders.
  27687. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27688. * sayHelloTo('fred');
  27689. * // => 'hello fred'
  27690. */
  27691. var partialRight = baseRest(function(func, partials) {
  27692. var holders = replaceHolders(partials, getHolder(partialRight));
  27693. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27694. });
  27695. /**
  27696. * Creates a function that invokes `func` with arguments arranged according
  27697. * to the specified `indexes` where the argument value at the first index is
  27698. * provided as the first argument, the argument value at the second index is
  27699. * provided as the second argument, and so on.
  27700. *
  27701. * @static
  27702. * @memberOf _
  27703. * @since 3.0.0
  27704. * @category Function
  27705. * @param {Function} func The function to rearrange arguments for.
  27706. * @param {...(number|number[])} indexes The arranged argument indexes.
  27707. * @returns {Function} Returns the new function.
  27708. * @example
  27709. *
  27710. * var rearged = _.rearg(function(a, b, c) {
  27711. * return [a, b, c];
  27712. * }, [2, 0, 1]);
  27713. *
  27714. * rearged('b', 'c', 'a')
  27715. * // => ['a', 'b', 'c']
  27716. */
  27717. var rearg = flatRest(function(func, indexes) {
  27718. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  27719. });
  27720. /**
  27721. * Creates a function that invokes `func` with the `this` binding of the
  27722. * created function and arguments from `start` and beyond provided as
  27723. * an array.
  27724. *
  27725. * **Note:** This method is based on the
  27726. * [rest parameter](https://mdn.io/rest_parameters).
  27727. *
  27728. * @static
  27729. * @memberOf _
  27730. * @since 4.0.0
  27731. * @category Function
  27732. * @param {Function} func The function to apply a rest parameter to.
  27733. * @param {number} [start=func.length-1] The start position of the rest parameter.
  27734. * @returns {Function} Returns the new function.
  27735. * @example
  27736. *
  27737. * var say = _.rest(function(what, names) {
  27738. * return what + ' ' + _.initial(names).join(', ') +
  27739. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  27740. * });
  27741. *
  27742. * say('hello', 'fred', 'barney', 'pebbles');
  27743. * // => 'hello fred, barney, & pebbles'
  27744. */
  27745. function rest(func, start) {
  27746. if (typeof func != 'function') {
  27747. throw new TypeError(FUNC_ERROR_TEXT);
  27748. }
  27749. start = start === undefined ? start : toInteger(start);
  27750. return baseRest(func, start);
  27751. }
  27752. /**
  27753. * Creates a function that invokes `func` with the `this` binding of the
  27754. * create function and an array of arguments much like
  27755. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  27756. *
  27757. * **Note:** This method is based on the
  27758. * [spread operator](https://mdn.io/spread_operator).
  27759. *
  27760. * @static
  27761. * @memberOf _
  27762. * @since 3.2.0
  27763. * @category Function
  27764. * @param {Function} func The function to spread arguments over.
  27765. * @param {number} [start=0] The start position of the spread.
  27766. * @returns {Function} Returns the new function.
  27767. * @example
  27768. *
  27769. * var say = _.spread(function(who, what) {
  27770. * return who + ' says ' + what;
  27771. * });
  27772. *
  27773. * say(['fred', 'hello']);
  27774. * // => 'fred says hello'
  27775. *
  27776. * var numbers = Promise.all([
  27777. * Promise.resolve(40),
  27778. * Promise.resolve(36)
  27779. * ]);
  27780. *
  27781. * numbers.then(_.spread(function(x, y) {
  27782. * return x + y;
  27783. * }));
  27784. * // => a Promise of 76
  27785. */
  27786. function spread(func, start) {
  27787. if (typeof func != 'function') {
  27788. throw new TypeError(FUNC_ERROR_TEXT);
  27789. }
  27790. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  27791. return baseRest(function(args) {
  27792. var array = args[start],
  27793. otherArgs = castSlice(args, 0, start);
  27794. if (array) {
  27795. arrayPush(otherArgs, array);
  27796. }
  27797. return apply(func, this, otherArgs);
  27798. });
  27799. }
  27800. /**
  27801. * Creates a throttled function that only invokes `func` at most once per
  27802. * every `wait` milliseconds. The throttled function comes with a `cancel`
  27803. * method to cancel delayed `func` invocations and a `flush` method to
  27804. * immediately invoke them. Provide `options` to indicate whether `func`
  27805. * should be invoked on the leading and/or trailing edge of the `wait`
  27806. * timeout. The `func` is invoked with the last arguments provided to the
  27807. * throttled function. Subsequent calls to the throttled function return the
  27808. * result of the last `func` invocation.
  27809. *
  27810. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27811. * invoked on the trailing edge of the timeout only if the throttled function
  27812. * is invoked more than once during the `wait` timeout.
  27813. *
  27814. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27815. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27816. *
  27817. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27818. * for details over the differences between `_.throttle` and `_.debounce`.
  27819. *
  27820. * @static
  27821. * @memberOf _
  27822. * @since 0.1.0
  27823. * @category Function
  27824. * @param {Function} func The function to throttle.
  27825. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  27826. * @param {Object} [options={}] The options object.
  27827. * @param {boolean} [options.leading=true]
  27828. * Specify invoking on the leading edge of the timeout.
  27829. * @param {boolean} [options.trailing=true]
  27830. * Specify invoking on the trailing edge of the timeout.
  27831. * @returns {Function} Returns the new throttled function.
  27832. * @example
  27833. *
  27834. * // Avoid excessively updating the position while scrolling.
  27835. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  27836. *
  27837. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  27838. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  27839. * jQuery(element).on('click', throttled);
  27840. *
  27841. * // Cancel the trailing throttled invocation.
  27842. * jQuery(window).on('popstate', throttled.cancel);
  27843. */
  27844. function throttle(func, wait, options) {
  27845. var leading = true,
  27846. trailing = true;
  27847. if (typeof func != 'function') {
  27848. throw new TypeError(FUNC_ERROR_TEXT);
  27849. }
  27850. if (isObject(options)) {
  27851. leading = 'leading' in options ? !!options.leading : leading;
  27852. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27853. }
  27854. return debounce(func, wait, {
  27855. 'leading': leading,
  27856. 'maxWait': wait,
  27857. 'trailing': trailing
  27858. });
  27859. }
  27860. /**
  27861. * Creates a function that accepts up to one argument, ignoring any
  27862. * additional arguments.
  27863. *
  27864. * @static
  27865. * @memberOf _
  27866. * @since 4.0.0
  27867. * @category Function
  27868. * @param {Function} func The function to cap arguments for.
  27869. * @returns {Function} Returns the new capped function.
  27870. * @example
  27871. *
  27872. * _.map(['6', '8', '10'], _.unary(parseInt));
  27873. * // => [6, 8, 10]
  27874. */
  27875. function unary(func) {
  27876. return ary(func, 1);
  27877. }
  27878. /**
  27879. * Creates a function that provides `value` to `wrapper` as its first
  27880. * argument. Any additional arguments provided to the function are appended
  27881. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  27882. * binding of the created function.
  27883. *
  27884. * @static
  27885. * @memberOf _
  27886. * @since 0.1.0
  27887. * @category Function
  27888. * @param {*} value The value to wrap.
  27889. * @param {Function} [wrapper=identity] The wrapper function.
  27890. * @returns {Function} Returns the new function.
  27891. * @example
  27892. *
  27893. * var p = _.wrap(_.escape, function(func, text) {
  27894. * return '<p>' + func(text) + '</p>';
  27895. * });
  27896. *
  27897. * p('fred, barney, & pebbles');
  27898. * // => '<p>fred, barney, &amp; pebbles</p>'
  27899. */
  27900. function wrap(value, wrapper) {
  27901. return partial(castFunction(wrapper), value);
  27902. }
  27903. /*------------------------------------------------------------------------*/
  27904. /**
  27905. * Casts `value` as an array if it's not one.
  27906. *
  27907. * @static
  27908. * @memberOf _
  27909. * @since 4.4.0
  27910. * @category Lang
  27911. * @param {*} value The value to inspect.
  27912. * @returns {Array} Returns the cast array.
  27913. * @example
  27914. *
  27915. * _.castArray(1);
  27916. * // => [1]
  27917. *
  27918. * _.castArray({ 'a': 1 });
  27919. * // => [{ 'a': 1 }]
  27920. *
  27921. * _.castArray('abc');
  27922. * // => ['abc']
  27923. *
  27924. * _.castArray(null);
  27925. * // => [null]
  27926. *
  27927. * _.castArray(undefined);
  27928. * // => [undefined]
  27929. *
  27930. * _.castArray();
  27931. * // => []
  27932. *
  27933. * var array = [1, 2, 3];
  27934. * console.log(_.castArray(array) === array);
  27935. * // => true
  27936. */
  27937. function castArray() {
  27938. if (!arguments.length) {
  27939. return [];
  27940. }
  27941. var value = arguments[0];
  27942. return isArray(value) ? value : [value];
  27943. }
  27944. /**
  27945. * Creates a shallow clone of `value`.
  27946. *
  27947. * **Note:** This method is loosely based on the
  27948. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  27949. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  27950. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  27951. * arrays. The own enumerable properties of `arguments` objects are cloned
  27952. * as plain objects. An empty object is returned for uncloneable values such
  27953. * as error objects, functions, DOM nodes, and WeakMaps.
  27954. *
  27955. * @static
  27956. * @memberOf _
  27957. * @since 0.1.0
  27958. * @category Lang
  27959. * @param {*} value The value to clone.
  27960. * @returns {*} Returns the cloned value.
  27961. * @see _.cloneDeep
  27962. * @example
  27963. *
  27964. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  27965. *
  27966. * var shallow = _.clone(objects);
  27967. * console.log(shallow[0] === objects[0]);
  27968. * // => true
  27969. */
  27970. function clone(value) {
  27971. return baseClone(value, CLONE_SYMBOLS_FLAG);
  27972. }
  27973. /**
  27974. * This method is like `_.clone` except that it accepts `customizer` which
  27975. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  27976. * cloning is handled by the method instead. The `customizer` is invoked with
  27977. * up to four arguments; (value [, index|key, object, stack]).
  27978. *
  27979. * @static
  27980. * @memberOf _
  27981. * @since 4.0.0
  27982. * @category Lang
  27983. * @param {*} value The value to clone.
  27984. * @param {Function} [customizer] The function to customize cloning.
  27985. * @returns {*} Returns the cloned value.
  27986. * @see _.cloneDeepWith
  27987. * @example
  27988. *
  27989. * function customizer(value) {
  27990. * if (_.isElement(value)) {
  27991. * return value.cloneNode(false);
  27992. * }
  27993. * }
  27994. *
  27995. * var el = _.cloneWith(document.body, customizer);
  27996. *
  27997. * console.log(el === document.body);
  27998. * // => false
  27999. * console.log(el.nodeName);
  28000. * // => 'BODY'
  28001. * console.log(el.childNodes.length);
  28002. * // => 0
  28003. */
  28004. function cloneWith(value, customizer) {
  28005. customizer = typeof customizer == 'function' ? customizer : undefined;
  28006. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28007. }
  28008. /**
  28009. * This method is like `_.clone` except that it recursively clones `value`.
  28010. *
  28011. * @static
  28012. * @memberOf _
  28013. * @since 1.0.0
  28014. * @category Lang
  28015. * @param {*} value The value to recursively clone.
  28016. * @returns {*} Returns the deep cloned value.
  28017. * @see _.clone
  28018. * @example
  28019. *
  28020. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28021. *
  28022. * var deep = _.cloneDeep(objects);
  28023. * console.log(deep[0] === objects[0]);
  28024. * // => false
  28025. */
  28026. function cloneDeep(value) {
  28027. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28028. }
  28029. /**
  28030. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28031. *
  28032. * @static
  28033. * @memberOf _
  28034. * @since 4.0.0
  28035. * @category Lang
  28036. * @param {*} value The value to recursively clone.
  28037. * @param {Function} [customizer] The function to customize cloning.
  28038. * @returns {*} Returns the deep cloned value.
  28039. * @see _.cloneWith
  28040. * @example
  28041. *
  28042. * function customizer(value) {
  28043. * if (_.isElement(value)) {
  28044. * return value.cloneNode(true);
  28045. * }
  28046. * }
  28047. *
  28048. * var el = _.cloneDeepWith(document.body, customizer);
  28049. *
  28050. * console.log(el === document.body);
  28051. * // => false
  28052. * console.log(el.nodeName);
  28053. * // => 'BODY'
  28054. * console.log(el.childNodes.length);
  28055. * // => 20
  28056. */
  28057. function cloneDeepWith(value, customizer) {
  28058. customizer = typeof customizer == 'function' ? customizer : undefined;
  28059. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28060. }
  28061. /**
  28062. * Checks if `object` conforms to `source` by invoking the predicate
  28063. * properties of `source` with the corresponding property values of `object`.
  28064. *
  28065. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28066. * partially applied.
  28067. *
  28068. * @static
  28069. * @memberOf _
  28070. * @since 4.14.0
  28071. * @category Lang
  28072. * @param {Object} object The object to inspect.
  28073. * @param {Object} source The object of property predicates to conform to.
  28074. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28075. * @example
  28076. *
  28077. * var object = { 'a': 1, 'b': 2 };
  28078. *
  28079. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28080. * // => true
  28081. *
  28082. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28083. * // => false
  28084. */
  28085. function conformsTo(object, source) {
  28086. return source == null || baseConformsTo(object, source, keys(source));
  28087. }
  28088. /**
  28089. * Performs a
  28090. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28091. * comparison between two values to determine if they are equivalent.
  28092. *
  28093. * @static
  28094. * @memberOf _
  28095. * @since 4.0.0
  28096. * @category Lang
  28097. * @param {*} value The value to compare.
  28098. * @param {*} other The other value to compare.
  28099. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28100. * @example
  28101. *
  28102. * var object = { 'a': 1 };
  28103. * var other = { 'a': 1 };
  28104. *
  28105. * _.eq(object, object);
  28106. * // => true
  28107. *
  28108. * _.eq(object, other);
  28109. * // => false
  28110. *
  28111. * _.eq('a', 'a');
  28112. * // => true
  28113. *
  28114. * _.eq('a', Object('a'));
  28115. * // => false
  28116. *
  28117. * _.eq(NaN, NaN);
  28118. * // => true
  28119. */
  28120. function eq(value, other) {
  28121. return value === other || (value !== value && other !== other);
  28122. }
  28123. /**
  28124. * Checks if `value` is greater than `other`.
  28125. *
  28126. * @static
  28127. * @memberOf _
  28128. * @since 3.9.0
  28129. * @category Lang
  28130. * @param {*} value The value to compare.
  28131. * @param {*} other The other value to compare.
  28132. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28133. * else `false`.
  28134. * @see _.lt
  28135. * @example
  28136. *
  28137. * _.gt(3, 1);
  28138. * // => true
  28139. *
  28140. * _.gt(3, 3);
  28141. * // => false
  28142. *
  28143. * _.gt(1, 3);
  28144. * // => false
  28145. */
  28146. var gt = createRelationalOperation(baseGt);
  28147. /**
  28148. * Checks if `value` is greater than or equal to `other`.
  28149. *
  28150. * @static
  28151. * @memberOf _
  28152. * @since 3.9.0
  28153. * @category Lang
  28154. * @param {*} value The value to compare.
  28155. * @param {*} other The other value to compare.
  28156. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28157. * `other`, else `false`.
  28158. * @see _.lte
  28159. * @example
  28160. *
  28161. * _.gte(3, 1);
  28162. * // => true
  28163. *
  28164. * _.gte(3, 3);
  28165. * // => true
  28166. *
  28167. * _.gte(1, 3);
  28168. * // => false
  28169. */
  28170. var gte = createRelationalOperation(function(value, other) {
  28171. return value >= other;
  28172. });
  28173. /**
  28174. * Checks if `value` is likely an `arguments` object.
  28175. *
  28176. * @static
  28177. * @memberOf _
  28178. * @since 0.1.0
  28179. * @category Lang
  28180. * @param {*} value The value to check.
  28181. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28182. * else `false`.
  28183. * @example
  28184. *
  28185. * _.isArguments(function() { return arguments; }());
  28186. * // => true
  28187. *
  28188. * _.isArguments([1, 2, 3]);
  28189. * // => false
  28190. */
  28191. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28192. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28193. !propertyIsEnumerable.call(value, 'callee');
  28194. };
  28195. /**
  28196. * Checks if `value` is classified as an `Array` object.
  28197. *
  28198. * @static
  28199. * @memberOf _
  28200. * @since 0.1.0
  28201. * @category Lang
  28202. * @param {*} value The value to check.
  28203. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28204. * @example
  28205. *
  28206. * _.isArray([1, 2, 3]);
  28207. * // => true
  28208. *
  28209. * _.isArray(document.body.children);
  28210. * // => false
  28211. *
  28212. * _.isArray('abc');
  28213. * // => false
  28214. *
  28215. * _.isArray(_.noop);
  28216. * // => false
  28217. */
  28218. var isArray = Array.isArray;
  28219. /**
  28220. * Checks if `value` is classified as an `ArrayBuffer` object.
  28221. *
  28222. * @static
  28223. * @memberOf _
  28224. * @since 4.3.0
  28225. * @category Lang
  28226. * @param {*} value The value to check.
  28227. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28228. * @example
  28229. *
  28230. * _.isArrayBuffer(new ArrayBuffer(2));
  28231. * // => true
  28232. *
  28233. * _.isArrayBuffer(new Array(2));
  28234. * // => false
  28235. */
  28236. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28237. /**
  28238. * Checks if `value` is array-like. A value is considered array-like if it's
  28239. * not a function and has a `value.length` that's an integer greater than or
  28240. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28241. *
  28242. * @static
  28243. * @memberOf _
  28244. * @since 4.0.0
  28245. * @category Lang
  28246. * @param {*} value The value to check.
  28247. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28248. * @example
  28249. *
  28250. * _.isArrayLike([1, 2, 3]);
  28251. * // => true
  28252. *
  28253. * _.isArrayLike(document.body.children);
  28254. * // => true
  28255. *
  28256. * _.isArrayLike('abc');
  28257. * // => true
  28258. *
  28259. * _.isArrayLike(_.noop);
  28260. * // => false
  28261. */
  28262. function isArrayLike(value) {
  28263. return value != null && isLength(value.length) && !isFunction(value);
  28264. }
  28265. /**
  28266. * This method is like `_.isArrayLike` except that it also checks if `value`
  28267. * is an object.
  28268. *
  28269. * @static
  28270. * @memberOf _
  28271. * @since 4.0.0
  28272. * @category Lang
  28273. * @param {*} value The value to check.
  28274. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28275. * else `false`.
  28276. * @example
  28277. *
  28278. * _.isArrayLikeObject([1, 2, 3]);
  28279. * // => true
  28280. *
  28281. * _.isArrayLikeObject(document.body.children);
  28282. * // => true
  28283. *
  28284. * _.isArrayLikeObject('abc');
  28285. * // => false
  28286. *
  28287. * _.isArrayLikeObject(_.noop);
  28288. * // => false
  28289. */
  28290. function isArrayLikeObject(value) {
  28291. return isObjectLike(value) && isArrayLike(value);
  28292. }
  28293. /**
  28294. * Checks if `value` is classified as a boolean primitive or object.
  28295. *
  28296. * @static
  28297. * @memberOf _
  28298. * @since 0.1.0
  28299. * @category Lang
  28300. * @param {*} value The value to check.
  28301. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28302. * @example
  28303. *
  28304. * _.isBoolean(false);
  28305. * // => true
  28306. *
  28307. * _.isBoolean(null);
  28308. * // => false
  28309. */
  28310. function isBoolean(value) {
  28311. return value === true || value === false ||
  28312. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28313. }
  28314. /**
  28315. * Checks if `value` is a buffer.
  28316. *
  28317. * @static
  28318. * @memberOf _
  28319. * @since 4.3.0
  28320. * @category Lang
  28321. * @param {*} value The value to check.
  28322. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28323. * @example
  28324. *
  28325. * _.isBuffer(new Buffer(2));
  28326. * // => true
  28327. *
  28328. * _.isBuffer(new Uint8Array(2));
  28329. * // => false
  28330. */
  28331. var isBuffer = nativeIsBuffer || stubFalse;
  28332. /**
  28333. * Checks if `value` is classified as a `Date` object.
  28334. *
  28335. * @static
  28336. * @memberOf _
  28337. * @since 0.1.0
  28338. * @category Lang
  28339. * @param {*} value The value to check.
  28340. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28341. * @example
  28342. *
  28343. * _.isDate(new Date);
  28344. * // => true
  28345. *
  28346. * _.isDate('Mon April 23 2012');
  28347. * // => false
  28348. */
  28349. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28350. /**
  28351. * Checks if `value` is likely a DOM element.
  28352. *
  28353. * @static
  28354. * @memberOf _
  28355. * @since 0.1.0
  28356. * @category Lang
  28357. * @param {*} value The value to check.
  28358. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28359. * @example
  28360. *
  28361. * _.isElement(document.body);
  28362. * // => true
  28363. *
  28364. * _.isElement('<body>');
  28365. * // => false
  28366. */
  28367. function isElement(value) {
  28368. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28369. }
  28370. /**
  28371. * Checks if `value` is an empty object, collection, map, or set.
  28372. *
  28373. * Objects are considered empty if they have no own enumerable string keyed
  28374. * properties.
  28375. *
  28376. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28377. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28378. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28379. *
  28380. * @static
  28381. * @memberOf _
  28382. * @since 0.1.0
  28383. * @category Lang
  28384. * @param {*} value The value to check.
  28385. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28386. * @example
  28387. *
  28388. * _.isEmpty(null);
  28389. * // => true
  28390. *
  28391. * _.isEmpty(true);
  28392. * // => true
  28393. *
  28394. * _.isEmpty(1);
  28395. * // => true
  28396. *
  28397. * _.isEmpty([1, 2, 3]);
  28398. * // => false
  28399. *
  28400. * _.isEmpty({ 'a': 1 });
  28401. * // => false
  28402. */
  28403. function isEmpty(value) {
  28404. if (value == null) {
  28405. return true;
  28406. }
  28407. if (isArrayLike(value) &&
  28408. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28409. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28410. return !value.length;
  28411. }
  28412. var tag = getTag(value);
  28413. if (tag == mapTag || tag == setTag) {
  28414. return !value.size;
  28415. }
  28416. if (isPrototype(value)) {
  28417. return !baseKeys(value).length;
  28418. }
  28419. for (var key in value) {
  28420. if (hasOwnProperty.call(value, key)) {
  28421. return false;
  28422. }
  28423. }
  28424. return true;
  28425. }
  28426. /**
  28427. * Performs a deep comparison between two values to determine if they are
  28428. * equivalent.
  28429. *
  28430. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28431. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28432. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28433. * by their own, not inherited, enumerable properties. Functions and DOM
  28434. * nodes are compared by strict equality, i.e. `===`.
  28435. *
  28436. * @static
  28437. * @memberOf _
  28438. * @since 0.1.0
  28439. * @category Lang
  28440. * @param {*} value The value to compare.
  28441. * @param {*} other The other value to compare.
  28442. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28443. * @example
  28444. *
  28445. * var object = { 'a': 1 };
  28446. * var other = { 'a': 1 };
  28447. *
  28448. * _.isEqual(object, other);
  28449. * // => true
  28450. *
  28451. * object === other;
  28452. * // => false
  28453. */
  28454. function isEqual(value, other) {
  28455. return baseIsEqual(value, other);
  28456. }
  28457. /**
  28458. * This method is like `_.isEqual` except that it accepts `customizer` which
  28459. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28460. * are handled by the method instead. The `customizer` is invoked with up to
  28461. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28462. *
  28463. * @static
  28464. * @memberOf _
  28465. * @since 4.0.0
  28466. * @category Lang
  28467. * @param {*} value The value to compare.
  28468. * @param {*} other The other value to compare.
  28469. * @param {Function} [customizer] The function to customize comparisons.
  28470. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28471. * @example
  28472. *
  28473. * function isGreeting(value) {
  28474. * return /^h(?:i|ello)$/.test(value);
  28475. * }
  28476. *
  28477. * function customizer(objValue, othValue) {
  28478. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28479. * return true;
  28480. * }
  28481. * }
  28482. *
  28483. * var array = ['hello', 'goodbye'];
  28484. * var other = ['hi', 'goodbye'];
  28485. *
  28486. * _.isEqualWith(array, other, customizer);
  28487. * // => true
  28488. */
  28489. function isEqualWith(value, other, customizer) {
  28490. customizer = typeof customizer == 'function' ? customizer : undefined;
  28491. var result = customizer ? customizer(value, other) : undefined;
  28492. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28493. }
  28494. /**
  28495. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28496. * `SyntaxError`, `TypeError`, or `URIError` object.
  28497. *
  28498. * @static
  28499. * @memberOf _
  28500. * @since 3.0.0
  28501. * @category Lang
  28502. * @param {*} value The value to check.
  28503. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28504. * @example
  28505. *
  28506. * _.isError(new Error);
  28507. * // => true
  28508. *
  28509. * _.isError(Error);
  28510. * // => false
  28511. */
  28512. function isError(value) {
  28513. if (!isObjectLike(value)) {
  28514. return false;
  28515. }
  28516. var tag = baseGetTag(value);
  28517. return tag == errorTag || tag == domExcTag ||
  28518. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28519. }
  28520. /**
  28521. * Checks if `value` is a finite primitive number.
  28522. *
  28523. * **Note:** This method is based on
  28524. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28525. *
  28526. * @static
  28527. * @memberOf _
  28528. * @since 0.1.0
  28529. * @category Lang
  28530. * @param {*} value The value to check.
  28531. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28532. * @example
  28533. *
  28534. * _.isFinite(3);
  28535. * // => true
  28536. *
  28537. * _.isFinite(Number.MIN_VALUE);
  28538. * // => true
  28539. *
  28540. * _.isFinite(Infinity);
  28541. * // => false
  28542. *
  28543. * _.isFinite('3');
  28544. * // => false
  28545. */
  28546. function isFinite(value) {
  28547. return typeof value == 'number' && nativeIsFinite(value);
  28548. }
  28549. /**
  28550. * Checks if `value` is classified as a `Function` object.
  28551. *
  28552. * @static
  28553. * @memberOf _
  28554. * @since 0.1.0
  28555. * @category Lang
  28556. * @param {*} value The value to check.
  28557. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28558. * @example
  28559. *
  28560. * _.isFunction(_);
  28561. * // => true
  28562. *
  28563. * _.isFunction(/abc/);
  28564. * // => false
  28565. */
  28566. function isFunction(value) {
  28567. if (!isObject(value)) {
  28568. return false;
  28569. }
  28570. // The use of `Object#toString` avoids issues with the `typeof` operator
  28571. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28572. var tag = baseGetTag(value);
  28573. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28574. }
  28575. /**
  28576. * Checks if `value` is an integer.
  28577. *
  28578. * **Note:** This method is based on
  28579. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28580. *
  28581. * @static
  28582. * @memberOf _
  28583. * @since 4.0.0
  28584. * @category Lang
  28585. * @param {*} value The value to check.
  28586. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28587. * @example
  28588. *
  28589. * _.isInteger(3);
  28590. * // => true
  28591. *
  28592. * _.isInteger(Number.MIN_VALUE);
  28593. * // => false
  28594. *
  28595. * _.isInteger(Infinity);
  28596. * // => false
  28597. *
  28598. * _.isInteger('3');
  28599. * // => false
  28600. */
  28601. function isInteger(value) {
  28602. return typeof value == 'number' && value == toInteger(value);
  28603. }
  28604. /**
  28605. * Checks if `value` is a valid array-like length.
  28606. *
  28607. * **Note:** This method is loosely based on
  28608. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28609. *
  28610. * @static
  28611. * @memberOf _
  28612. * @since 4.0.0
  28613. * @category Lang
  28614. * @param {*} value The value to check.
  28615. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28616. * @example
  28617. *
  28618. * _.isLength(3);
  28619. * // => true
  28620. *
  28621. * _.isLength(Number.MIN_VALUE);
  28622. * // => false
  28623. *
  28624. * _.isLength(Infinity);
  28625. * // => false
  28626. *
  28627. * _.isLength('3');
  28628. * // => false
  28629. */
  28630. function isLength(value) {
  28631. return typeof value == 'number' &&
  28632. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28633. }
  28634. /**
  28635. * Checks if `value` is the
  28636. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28637. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28638. *
  28639. * @static
  28640. * @memberOf _
  28641. * @since 0.1.0
  28642. * @category Lang
  28643. * @param {*} value The value to check.
  28644. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28645. * @example
  28646. *
  28647. * _.isObject({});
  28648. * // => true
  28649. *
  28650. * _.isObject([1, 2, 3]);
  28651. * // => true
  28652. *
  28653. * _.isObject(_.noop);
  28654. * // => true
  28655. *
  28656. * _.isObject(null);
  28657. * // => false
  28658. */
  28659. function isObject(value) {
  28660. var type = typeof value;
  28661. return value != null && (type == 'object' || type == 'function');
  28662. }
  28663. /**
  28664. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28665. * and has a `typeof` result of "object".
  28666. *
  28667. * @static
  28668. * @memberOf _
  28669. * @since 4.0.0
  28670. * @category Lang
  28671. * @param {*} value The value to check.
  28672. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28673. * @example
  28674. *
  28675. * _.isObjectLike({});
  28676. * // => true
  28677. *
  28678. * _.isObjectLike([1, 2, 3]);
  28679. * // => true
  28680. *
  28681. * _.isObjectLike(_.noop);
  28682. * // => false
  28683. *
  28684. * _.isObjectLike(null);
  28685. * // => false
  28686. */
  28687. function isObjectLike(value) {
  28688. return value != null && typeof value == 'object';
  28689. }
  28690. /**
  28691. * Checks if `value` is classified as a `Map` object.
  28692. *
  28693. * @static
  28694. * @memberOf _
  28695. * @since 4.3.0
  28696. * @category Lang
  28697. * @param {*} value The value to check.
  28698. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28699. * @example
  28700. *
  28701. * _.isMap(new Map);
  28702. * // => true
  28703. *
  28704. * _.isMap(new WeakMap);
  28705. * // => false
  28706. */
  28707. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  28708. /**
  28709. * Performs a partial deep comparison between `object` and `source` to
  28710. * determine if `object` contains equivalent property values.
  28711. *
  28712. * **Note:** This method is equivalent to `_.matches` when `source` is
  28713. * partially applied.
  28714. *
  28715. * Partial comparisons will match empty array and empty object `source`
  28716. * values against any array or object value, respectively. See `_.isEqual`
  28717. * for a list of supported value comparisons.
  28718. *
  28719. * @static
  28720. * @memberOf _
  28721. * @since 3.0.0
  28722. * @category Lang
  28723. * @param {Object} object The object to inspect.
  28724. * @param {Object} source The object of property values to match.
  28725. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28726. * @example
  28727. *
  28728. * var object = { 'a': 1, 'b': 2 };
  28729. *
  28730. * _.isMatch(object, { 'b': 2 });
  28731. * // => true
  28732. *
  28733. * _.isMatch(object, { 'b': 1 });
  28734. * // => false
  28735. */
  28736. function isMatch(object, source) {
  28737. return object === source || baseIsMatch(object, source, getMatchData(source));
  28738. }
  28739. /**
  28740. * This method is like `_.isMatch` except that it accepts `customizer` which
  28741. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28742. * are handled by the method instead. The `customizer` is invoked with five
  28743. * arguments: (objValue, srcValue, index|key, object, source).
  28744. *
  28745. * @static
  28746. * @memberOf _
  28747. * @since 4.0.0
  28748. * @category Lang
  28749. * @param {Object} object The object to inspect.
  28750. * @param {Object} source The object of property values to match.
  28751. * @param {Function} [customizer] The function to customize comparisons.
  28752. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28753. * @example
  28754. *
  28755. * function isGreeting(value) {
  28756. * return /^h(?:i|ello)$/.test(value);
  28757. * }
  28758. *
  28759. * function customizer(objValue, srcValue) {
  28760. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  28761. * return true;
  28762. * }
  28763. * }
  28764. *
  28765. * var object = { 'greeting': 'hello' };
  28766. * var source = { 'greeting': 'hi' };
  28767. *
  28768. * _.isMatchWith(object, source, customizer);
  28769. * // => true
  28770. */
  28771. function isMatchWith(object, source, customizer) {
  28772. customizer = typeof customizer == 'function' ? customizer : undefined;
  28773. return baseIsMatch(object, source, getMatchData(source), customizer);
  28774. }
  28775. /**
  28776. * Checks if `value` is `NaN`.
  28777. *
  28778. * **Note:** This method is based on
  28779. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  28780. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  28781. * `undefined` and other non-number values.
  28782. *
  28783. * @static
  28784. * @memberOf _
  28785. * @since 0.1.0
  28786. * @category Lang
  28787. * @param {*} value The value to check.
  28788. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  28789. * @example
  28790. *
  28791. * _.isNaN(NaN);
  28792. * // => true
  28793. *
  28794. * _.isNaN(new Number(NaN));
  28795. * // => true
  28796. *
  28797. * isNaN(undefined);
  28798. * // => true
  28799. *
  28800. * _.isNaN(undefined);
  28801. * // => false
  28802. */
  28803. function isNaN(value) {
  28804. // An `NaN` primitive is the only value that is not equal to itself.
  28805. // Perform the `toStringTag` check first to avoid errors with some
  28806. // ActiveX objects in IE.
  28807. return isNumber(value) && value != +value;
  28808. }
  28809. /**
  28810. * Checks if `value` is a pristine native function.
  28811. *
  28812. * **Note:** This method can't reliably detect native functions in the presence
  28813. * of the core-js package because core-js circumvents this kind of detection.
  28814. * Despite multiple requests, the core-js maintainer has made it clear: any
  28815. * attempt to fix the detection will be obstructed. As a result, we're left
  28816. * with little choice but to throw an error. Unfortunately, this also affects
  28817. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  28818. * which rely on core-js.
  28819. *
  28820. * @static
  28821. * @memberOf _
  28822. * @since 3.0.0
  28823. * @category Lang
  28824. * @param {*} value The value to check.
  28825. * @returns {boolean} Returns `true` if `value` is a native function,
  28826. * else `false`.
  28827. * @example
  28828. *
  28829. * _.isNative(Array.prototype.push);
  28830. * // => true
  28831. *
  28832. * _.isNative(_);
  28833. * // => false
  28834. */
  28835. function isNative(value) {
  28836. if (isMaskable(value)) {
  28837. throw new Error(CORE_ERROR_TEXT);
  28838. }
  28839. return baseIsNative(value);
  28840. }
  28841. /**
  28842. * Checks if `value` is `null`.
  28843. *
  28844. * @static
  28845. * @memberOf _
  28846. * @since 0.1.0
  28847. * @category Lang
  28848. * @param {*} value The value to check.
  28849. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  28850. * @example
  28851. *
  28852. * _.isNull(null);
  28853. * // => true
  28854. *
  28855. * _.isNull(void 0);
  28856. * // => false
  28857. */
  28858. function isNull(value) {
  28859. return value === null;
  28860. }
  28861. /**
  28862. * Checks if `value` is `null` or `undefined`.
  28863. *
  28864. * @static
  28865. * @memberOf _
  28866. * @since 4.0.0
  28867. * @category Lang
  28868. * @param {*} value The value to check.
  28869. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  28870. * @example
  28871. *
  28872. * _.isNil(null);
  28873. * // => true
  28874. *
  28875. * _.isNil(void 0);
  28876. * // => true
  28877. *
  28878. * _.isNil(NaN);
  28879. * // => false
  28880. */
  28881. function isNil(value) {
  28882. return value == null;
  28883. }
  28884. /**
  28885. * Checks if `value` is classified as a `Number` primitive or object.
  28886. *
  28887. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  28888. * classified as numbers, use the `_.isFinite` method.
  28889. *
  28890. * @static
  28891. * @memberOf _
  28892. * @since 0.1.0
  28893. * @category Lang
  28894. * @param {*} value The value to check.
  28895. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  28896. * @example
  28897. *
  28898. * _.isNumber(3);
  28899. * // => true
  28900. *
  28901. * _.isNumber(Number.MIN_VALUE);
  28902. * // => true
  28903. *
  28904. * _.isNumber(Infinity);
  28905. * // => true
  28906. *
  28907. * _.isNumber('3');
  28908. * // => false
  28909. */
  28910. function isNumber(value) {
  28911. return typeof value == 'number' ||
  28912. (isObjectLike(value) && baseGetTag(value) == numberTag);
  28913. }
  28914. /**
  28915. * Checks if `value` is a plain object, that is, an object created by the
  28916. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  28917. *
  28918. * @static
  28919. * @memberOf _
  28920. * @since 0.8.0
  28921. * @category Lang
  28922. * @param {*} value The value to check.
  28923. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  28924. * @example
  28925. *
  28926. * function Foo() {
  28927. * this.a = 1;
  28928. * }
  28929. *
  28930. * _.isPlainObject(new Foo);
  28931. * // => false
  28932. *
  28933. * _.isPlainObject([1, 2, 3]);
  28934. * // => false
  28935. *
  28936. * _.isPlainObject({ 'x': 0, 'y': 0 });
  28937. * // => true
  28938. *
  28939. * _.isPlainObject(Object.create(null));
  28940. * // => true
  28941. */
  28942. function isPlainObject(value) {
  28943. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  28944. return false;
  28945. }
  28946. var proto = getPrototype(value);
  28947. if (proto === null) {
  28948. return true;
  28949. }
  28950. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  28951. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  28952. funcToString.call(Ctor) == objectCtorString;
  28953. }
  28954. /**
  28955. * Checks if `value` is classified as a `RegExp` object.
  28956. *
  28957. * @static
  28958. * @memberOf _
  28959. * @since 0.1.0
  28960. * @category Lang
  28961. * @param {*} value The value to check.
  28962. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  28963. * @example
  28964. *
  28965. * _.isRegExp(/abc/);
  28966. * // => true
  28967. *
  28968. * _.isRegExp('/abc/');
  28969. * // => false
  28970. */
  28971. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  28972. /**
  28973. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  28974. * double precision number which isn't the result of a rounded unsafe integer.
  28975. *
  28976. * **Note:** This method is based on
  28977. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  28978. *
  28979. * @static
  28980. * @memberOf _
  28981. * @since 4.0.0
  28982. * @category Lang
  28983. * @param {*} value The value to check.
  28984. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  28985. * @example
  28986. *
  28987. * _.isSafeInteger(3);
  28988. * // => true
  28989. *
  28990. * _.isSafeInteger(Number.MIN_VALUE);
  28991. * // => false
  28992. *
  28993. * _.isSafeInteger(Infinity);
  28994. * // => false
  28995. *
  28996. * _.isSafeInteger('3');
  28997. * // => false
  28998. */
  28999. function isSafeInteger(value) {
  29000. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29001. }
  29002. /**
  29003. * Checks if `value` is classified as a `Set` object.
  29004. *
  29005. * @static
  29006. * @memberOf _
  29007. * @since 4.3.0
  29008. * @category Lang
  29009. * @param {*} value The value to check.
  29010. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29011. * @example
  29012. *
  29013. * _.isSet(new Set);
  29014. * // => true
  29015. *
  29016. * _.isSet(new WeakSet);
  29017. * // => false
  29018. */
  29019. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29020. /**
  29021. * Checks if `value` is classified as a `String` primitive or object.
  29022. *
  29023. * @static
  29024. * @since 0.1.0
  29025. * @memberOf _
  29026. * @category Lang
  29027. * @param {*} value The value to check.
  29028. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29029. * @example
  29030. *
  29031. * _.isString('abc');
  29032. * // => true
  29033. *
  29034. * _.isString(1);
  29035. * // => false
  29036. */
  29037. function isString(value) {
  29038. return typeof value == 'string' ||
  29039. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29040. }
  29041. /**
  29042. * Checks if `value` is classified as a `Symbol` primitive or object.
  29043. *
  29044. * @static
  29045. * @memberOf _
  29046. * @since 4.0.0
  29047. * @category Lang
  29048. * @param {*} value The value to check.
  29049. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29050. * @example
  29051. *
  29052. * _.isSymbol(Symbol.iterator);
  29053. * // => true
  29054. *
  29055. * _.isSymbol('abc');
  29056. * // => false
  29057. */
  29058. function isSymbol(value) {
  29059. return typeof value == 'symbol' ||
  29060. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29061. }
  29062. /**
  29063. * Checks if `value` is classified as a typed array.
  29064. *
  29065. * @static
  29066. * @memberOf _
  29067. * @since 3.0.0
  29068. * @category Lang
  29069. * @param {*} value The value to check.
  29070. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29071. * @example
  29072. *
  29073. * _.isTypedArray(new Uint8Array);
  29074. * // => true
  29075. *
  29076. * _.isTypedArray([]);
  29077. * // => false
  29078. */
  29079. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29080. /**
  29081. * Checks if `value` is `undefined`.
  29082. *
  29083. * @static
  29084. * @since 0.1.0
  29085. * @memberOf _
  29086. * @category Lang
  29087. * @param {*} value The value to check.
  29088. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29089. * @example
  29090. *
  29091. * _.isUndefined(void 0);
  29092. * // => true
  29093. *
  29094. * _.isUndefined(null);
  29095. * // => false
  29096. */
  29097. function isUndefined(value) {
  29098. return value === undefined;
  29099. }
  29100. /**
  29101. * Checks if `value` is classified as a `WeakMap` object.
  29102. *
  29103. * @static
  29104. * @memberOf _
  29105. * @since 4.3.0
  29106. * @category Lang
  29107. * @param {*} value The value to check.
  29108. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29109. * @example
  29110. *
  29111. * _.isWeakMap(new WeakMap);
  29112. * // => true
  29113. *
  29114. * _.isWeakMap(new Map);
  29115. * // => false
  29116. */
  29117. function isWeakMap(value) {
  29118. return isObjectLike(value) && getTag(value) == weakMapTag;
  29119. }
  29120. /**
  29121. * Checks if `value` is classified as a `WeakSet` object.
  29122. *
  29123. * @static
  29124. * @memberOf _
  29125. * @since 4.3.0
  29126. * @category Lang
  29127. * @param {*} value The value to check.
  29128. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29129. * @example
  29130. *
  29131. * _.isWeakSet(new WeakSet);
  29132. * // => true
  29133. *
  29134. * _.isWeakSet(new Set);
  29135. * // => false
  29136. */
  29137. function isWeakSet(value) {
  29138. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29139. }
  29140. /**
  29141. * Checks if `value` is less than `other`.
  29142. *
  29143. * @static
  29144. * @memberOf _
  29145. * @since 3.9.0
  29146. * @category Lang
  29147. * @param {*} value The value to compare.
  29148. * @param {*} other The other value to compare.
  29149. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29150. * else `false`.
  29151. * @see _.gt
  29152. * @example
  29153. *
  29154. * _.lt(1, 3);
  29155. * // => true
  29156. *
  29157. * _.lt(3, 3);
  29158. * // => false
  29159. *
  29160. * _.lt(3, 1);
  29161. * // => false
  29162. */
  29163. var lt = createRelationalOperation(baseLt);
  29164. /**
  29165. * Checks if `value` is less than or equal to `other`.
  29166. *
  29167. * @static
  29168. * @memberOf _
  29169. * @since 3.9.0
  29170. * @category Lang
  29171. * @param {*} value The value to compare.
  29172. * @param {*} other The other value to compare.
  29173. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29174. * `other`, else `false`.
  29175. * @see _.gte
  29176. * @example
  29177. *
  29178. * _.lte(1, 3);
  29179. * // => true
  29180. *
  29181. * _.lte(3, 3);
  29182. * // => true
  29183. *
  29184. * _.lte(3, 1);
  29185. * // => false
  29186. */
  29187. var lte = createRelationalOperation(function(value, other) {
  29188. return value <= other;
  29189. });
  29190. /**
  29191. * Converts `value` to an array.
  29192. *
  29193. * @static
  29194. * @since 0.1.0
  29195. * @memberOf _
  29196. * @category Lang
  29197. * @param {*} value The value to convert.
  29198. * @returns {Array} Returns the converted array.
  29199. * @example
  29200. *
  29201. * _.toArray({ 'a': 1, 'b': 2 });
  29202. * // => [1, 2]
  29203. *
  29204. * _.toArray('abc');
  29205. * // => ['a', 'b', 'c']
  29206. *
  29207. * _.toArray(1);
  29208. * // => []
  29209. *
  29210. * _.toArray(null);
  29211. * // => []
  29212. */
  29213. function toArray(value) {
  29214. if (!value) {
  29215. return [];
  29216. }
  29217. if (isArrayLike(value)) {
  29218. return isString(value) ? stringToArray(value) : copyArray(value);
  29219. }
  29220. if (symIterator && value[symIterator]) {
  29221. return iteratorToArray(value[symIterator]());
  29222. }
  29223. var tag = getTag(value),
  29224. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29225. return func(value);
  29226. }
  29227. /**
  29228. * Converts `value` to a finite number.
  29229. *
  29230. * @static
  29231. * @memberOf _
  29232. * @since 4.12.0
  29233. * @category Lang
  29234. * @param {*} value The value to convert.
  29235. * @returns {number} Returns the converted number.
  29236. * @example
  29237. *
  29238. * _.toFinite(3.2);
  29239. * // => 3.2
  29240. *
  29241. * _.toFinite(Number.MIN_VALUE);
  29242. * // => 5e-324
  29243. *
  29244. * _.toFinite(Infinity);
  29245. * // => 1.7976931348623157e+308
  29246. *
  29247. * _.toFinite('3.2');
  29248. * // => 3.2
  29249. */
  29250. function toFinite(value) {
  29251. if (!value) {
  29252. return value === 0 ? value : 0;
  29253. }
  29254. value = toNumber(value);
  29255. if (value === INFINITY || value === -INFINITY) {
  29256. var sign = (value < 0 ? -1 : 1);
  29257. return sign * MAX_INTEGER;
  29258. }
  29259. return value === value ? value : 0;
  29260. }
  29261. /**
  29262. * Converts `value` to an integer.
  29263. *
  29264. * **Note:** This method is loosely based on
  29265. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29266. *
  29267. * @static
  29268. * @memberOf _
  29269. * @since 4.0.0
  29270. * @category Lang
  29271. * @param {*} value The value to convert.
  29272. * @returns {number} Returns the converted integer.
  29273. * @example
  29274. *
  29275. * _.toInteger(3.2);
  29276. * // => 3
  29277. *
  29278. * _.toInteger(Number.MIN_VALUE);
  29279. * // => 0
  29280. *
  29281. * _.toInteger(Infinity);
  29282. * // => 1.7976931348623157e+308
  29283. *
  29284. * _.toInteger('3.2');
  29285. * // => 3
  29286. */
  29287. function toInteger(value) {
  29288. var result = toFinite(value),
  29289. remainder = result % 1;
  29290. return result === result ? (remainder ? result - remainder : result) : 0;
  29291. }
  29292. /**
  29293. * Converts `value` to an integer suitable for use as the length of an
  29294. * array-like object.
  29295. *
  29296. * **Note:** This method is based on
  29297. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29298. *
  29299. * @static
  29300. * @memberOf _
  29301. * @since 4.0.0
  29302. * @category Lang
  29303. * @param {*} value The value to convert.
  29304. * @returns {number} Returns the converted integer.
  29305. * @example
  29306. *
  29307. * _.toLength(3.2);
  29308. * // => 3
  29309. *
  29310. * _.toLength(Number.MIN_VALUE);
  29311. * // => 0
  29312. *
  29313. * _.toLength(Infinity);
  29314. * // => 4294967295
  29315. *
  29316. * _.toLength('3.2');
  29317. * // => 3
  29318. */
  29319. function toLength(value) {
  29320. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29321. }
  29322. /**
  29323. * Converts `value` to a number.
  29324. *
  29325. * @static
  29326. * @memberOf _
  29327. * @since 4.0.0
  29328. * @category Lang
  29329. * @param {*} value The value to process.
  29330. * @returns {number} Returns the number.
  29331. * @example
  29332. *
  29333. * _.toNumber(3.2);
  29334. * // => 3.2
  29335. *
  29336. * _.toNumber(Number.MIN_VALUE);
  29337. * // => 5e-324
  29338. *
  29339. * _.toNumber(Infinity);
  29340. * // => Infinity
  29341. *
  29342. * _.toNumber('3.2');
  29343. * // => 3.2
  29344. */
  29345. function toNumber(value) {
  29346. if (typeof value == 'number') {
  29347. return value;
  29348. }
  29349. if (isSymbol(value)) {
  29350. return NAN;
  29351. }
  29352. if (isObject(value)) {
  29353. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29354. value = isObject(other) ? (other + '') : other;
  29355. }
  29356. if (typeof value != 'string') {
  29357. return value === 0 ? value : +value;
  29358. }
  29359. value = value.replace(reTrim, '');
  29360. var isBinary = reIsBinary.test(value);
  29361. return (isBinary || reIsOctal.test(value))
  29362. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29363. : (reIsBadHex.test(value) ? NAN : +value);
  29364. }
  29365. /**
  29366. * Converts `value` to a plain object flattening inherited enumerable string
  29367. * keyed properties of `value` to own properties of the plain object.
  29368. *
  29369. * @static
  29370. * @memberOf _
  29371. * @since 3.0.0
  29372. * @category Lang
  29373. * @param {*} value The value to convert.
  29374. * @returns {Object} Returns the converted plain object.
  29375. * @example
  29376. *
  29377. * function Foo() {
  29378. * this.b = 2;
  29379. * }
  29380. *
  29381. * Foo.prototype.c = 3;
  29382. *
  29383. * _.assign({ 'a': 1 }, new Foo);
  29384. * // => { 'a': 1, 'b': 2 }
  29385. *
  29386. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29387. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29388. */
  29389. function toPlainObject(value) {
  29390. return copyObject(value, keysIn(value));
  29391. }
  29392. /**
  29393. * Converts `value` to a safe integer. A safe integer can be compared and
  29394. * represented correctly.
  29395. *
  29396. * @static
  29397. * @memberOf _
  29398. * @since 4.0.0
  29399. * @category Lang
  29400. * @param {*} value The value to convert.
  29401. * @returns {number} Returns the converted integer.
  29402. * @example
  29403. *
  29404. * _.toSafeInteger(3.2);
  29405. * // => 3
  29406. *
  29407. * _.toSafeInteger(Number.MIN_VALUE);
  29408. * // => 0
  29409. *
  29410. * _.toSafeInteger(Infinity);
  29411. * // => 9007199254740991
  29412. *
  29413. * _.toSafeInteger('3.2');
  29414. * // => 3
  29415. */
  29416. function toSafeInteger(value) {
  29417. return value
  29418. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29419. : (value === 0 ? value : 0);
  29420. }
  29421. /**
  29422. * Converts `value` to a string. An empty string is returned for `null`
  29423. * and `undefined` values. The sign of `-0` is preserved.
  29424. *
  29425. * @static
  29426. * @memberOf _
  29427. * @since 4.0.0
  29428. * @category Lang
  29429. * @param {*} value The value to convert.
  29430. * @returns {string} Returns the converted string.
  29431. * @example
  29432. *
  29433. * _.toString(null);
  29434. * // => ''
  29435. *
  29436. * _.toString(-0);
  29437. * // => '-0'
  29438. *
  29439. * _.toString([1, 2, 3]);
  29440. * // => '1,2,3'
  29441. */
  29442. function toString(value) {
  29443. return value == null ? '' : baseToString(value);
  29444. }
  29445. /*------------------------------------------------------------------------*/
  29446. /**
  29447. * Assigns own enumerable string keyed properties of source objects to the
  29448. * destination object. Source objects are applied from left to right.
  29449. * Subsequent sources overwrite property assignments of previous sources.
  29450. *
  29451. * **Note:** This method mutates `object` and is loosely based on
  29452. * [`Object.assign`](https://mdn.io/Object/assign).
  29453. *
  29454. * @static
  29455. * @memberOf _
  29456. * @since 0.10.0
  29457. * @category Object
  29458. * @param {Object} object The destination object.
  29459. * @param {...Object} [sources] The source objects.
  29460. * @returns {Object} Returns `object`.
  29461. * @see _.assignIn
  29462. * @example
  29463. *
  29464. * function Foo() {
  29465. * this.a = 1;
  29466. * }
  29467. *
  29468. * function Bar() {
  29469. * this.c = 3;
  29470. * }
  29471. *
  29472. * Foo.prototype.b = 2;
  29473. * Bar.prototype.d = 4;
  29474. *
  29475. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29476. * // => { 'a': 1, 'c': 3 }
  29477. */
  29478. var assign = createAssigner(function(object, source) {
  29479. if (isPrototype(source) || isArrayLike(source)) {
  29480. copyObject(source, keys(source), object);
  29481. return;
  29482. }
  29483. for (var key in source) {
  29484. if (hasOwnProperty.call(source, key)) {
  29485. assignValue(object, key, source[key]);
  29486. }
  29487. }
  29488. });
  29489. /**
  29490. * This method is like `_.assign` except that it iterates over own and
  29491. * inherited source properties.
  29492. *
  29493. * **Note:** This method mutates `object`.
  29494. *
  29495. * @static
  29496. * @memberOf _
  29497. * @since 4.0.0
  29498. * @alias extend
  29499. * @category Object
  29500. * @param {Object} object The destination object.
  29501. * @param {...Object} [sources] The source objects.
  29502. * @returns {Object} Returns `object`.
  29503. * @see _.assign
  29504. * @example
  29505. *
  29506. * function Foo() {
  29507. * this.a = 1;
  29508. * }
  29509. *
  29510. * function Bar() {
  29511. * this.c = 3;
  29512. * }
  29513. *
  29514. * Foo.prototype.b = 2;
  29515. * Bar.prototype.d = 4;
  29516. *
  29517. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29518. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29519. */
  29520. var assignIn = createAssigner(function(object, source) {
  29521. copyObject(source, keysIn(source), object);
  29522. });
  29523. /**
  29524. * This method is like `_.assignIn` except that it accepts `customizer`
  29525. * which is invoked to produce the assigned values. If `customizer` returns
  29526. * `undefined`, assignment is handled by the method instead. The `customizer`
  29527. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29528. *
  29529. * **Note:** This method mutates `object`.
  29530. *
  29531. * @static
  29532. * @memberOf _
  29533. * @since 4.0.0
  29534. * @alias extendWith
  29535. * @category Object
  29536. * @param {Object} object The destination object.
  29537. * @param {...Object} sources The source objects.
  29538. * @param {Function} [customizer] The function to customize assigned values.
  29539. * @returns {Object} Returns `object`.
  29540. * @see _.assignWith
  29541. * @example
  29542. *
  29543. * function customizer(objValue, srcValue) {
  29544. * return _.isUndefined(objValue) ? srcValue : objValue;
  29545. * }
  29546. *
  29547. * var defaults = _.partialRight(_.assignInWith, customizer);
  29548. *
  29549. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29550. * // => { 'a': 1, 'b': 2 }
  29551. */
  29552. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29553. copyObject(source, keysIn(source), object, customizer);
  29554. });
  29555. /**
  29556. * This method is like `_.assign` except that it accepts `customizer`
  29557. * which is invoked to produce the assigned values. If `customizer` returns
  29558. * `undefined`, assignment is handled by the method instead. The `customizer`
  29559. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29560. *
  29561. * **Note:** This method mutates `object`.
  29562. *
  29563. * @static
  29564. * @memberOf _
  29565. * @since 4.0.0
  29566. * @category Object
  29567. * @param {Object} object The destination object.
  29568. * @param {...Object} sources The source objects.
  29569. * @param {Function} [customizer] The function to customize assigned values.
  29570. * @returns {Object} Returns `object`.
  29571. * @see _.assignInWith
  29572. * @example
  29573. *
  29574. * function customizer(objValue, srcValue) {
  29575. * return _.isUndefined(objValue) ? srcValue : objValue;
  29576. * }
  29577. *
  29578. * var defaults = _.partialRight(_.assignWith, customizer);
  29579. *
  29580. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29581. * // => { 'a': 1, 'b': 2 }
  29582. */
  29583. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29584. copyObject(source, keys(source), object, customizer);
  29585. });
  29586. /**
  29587. * Creates an array of values corresponding to `paths` of `object`.
  29588. *
  29589. * @static
  29590. * @memberOf _
  29591. * @since 1.0.0
  29592. * @category Object
  29593. * @param {Object} object The object to iterate over.
  29594. * @param {...(string|string[])} [paths] The property paths to pick.
  29595. * @returns {Array} Returns the picked values.
  29596. * @example
  29597. *
  29598. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29599. *
  29600. * _.at(object, ['a[0].b.c', 'a[1]']);
  29601. * // => [3, 4]
  29602. */
  29603. var at = flatRest(baseAt);
  29604. /**
  29605. * Creates an object that inherits from the `prototype` object. If a
  29606. * `properties` object is given, its own enumerable string keyed properties
  29607. * are assigned to the created object.
  29608. *
  29609. * @static
  29610. * @memberOf _
  29611. * @since 2.3.0
  29612. * @category Object
  29613. * @param {Object} prototype The object to inherit from.
  29614. * @param {Object} [properties] The properties to assign to the object.
  29615. * @returns {Object} Returns the new object.
  29616. * @example
  29617. *
  29618. * function Shape() {
  29619. * this.x = 0;
  29620. * this.y = 0;
  29621. * }
  29622. *
  29623. * function Circle() {
  29624. * Shape.call(this);
  29625. * }
  29626. *
  29627. * Circle.prototype = _.create(Shape.prototype, {
  29628. * 'constructor': Circle
  29629. * });
  29630. *
  29631. * var circle = new Circle;
  29632. * circle instanceof Circle;
  29633. * // => true
  29634. *
  29635. * circle instanceof Shape;
  29636. * // => true
  29637. */
  29638. function create(prototype, properties) {
  29639. var result = baseCreate(prototype);
  29640. return properties == null ? result : baseAssign(result, properties);
  29641. }
  29642. /**
  29643. * Assigns own and inherited enumerable string keyed properties of source
  29644. * objects to the destination object for all destination properties that
  29645. * resolve to `undefined`. Source objects are applied from left to right.
  29646. * Once a property is set, additional values of the same property are ignored.
  29647. *
  29648. * **Note:** This method mutates `object`.
  29649. *
  29650. * @static
  29651. * @since 0.1.0
  29652. * @memberOf _
  29653. * @category Object
  29654. * @param {Object} object The destination object.
  29655. * @param {...Object} [sources] The source objects.
  29656. * @returns {Object} Returns `object`.
  29657. * @see _.defaultsDeep
  29658. * @example
  29659. *
  29660. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29661. * // => { 'a': 1, 'b': 2 }
  29662. */
  29663. var defaults = baseRest(function(object, sources) {
  29664. object = Object(object);
  29665. var index = -1;
  29666. var length = sources.length;
  29667. var guard = length > 2 ? sources[2] : undefined;
  29668. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29669. length = 1;
  29670. }
  29671. while (++index < length) {
  29672. var source = sources[index];
  29673. var props = keysIn(source);
  29674. var propsIndex = -1;
  29675. var propsLength = props.length;
  29676. while (++propsIndex < propsLength) {
  29677. var key = props[propsIndex];
  29678. var value = object[key];
  29679. if (value === undefined ||
  29680. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29681. object[key] = source[key];
  29682. }
  29683. }
  29684. }
  29685. return object;
  29686. });
  29687. /**
  29688. * This method is like `_.defaults` except that it recursively assigns
  29689. * default properties.
  29690. *
  29691. * **Note:** This method mutates `object`.
  29692. *
  29693. * @static
  29694. * @memberOf _
  29695. * @since 3.10.0
  29696. * @category Object
  29697. * @param {Object} object The destination object.
  29698. * @param {...Object} [sources] The source objects.
  29699. * @returns {Object} Returns `object`.
  29700. * @see _.defaults
  29701. * @example
  29702. *
  29703. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29704. * // => { 'a': { 'b': 2, 'c': 3 } }
  29705. */
  29706. var defaultsDeep = baseRest(function(args) {
  29707. args.push(undefined, customDefaultsMerge);
  29708. return apply(mergeWith, undefined, args);
  29709. });
  29710. /**
  29711. * This method is like `_.find` except that it returns the key of the first
  29712. * element `predicate` returns truthy for instead of the element itself.
  29713. *
  29714. * @static
  29715. * @memberOf _
  29716. * @since 1.1.0
  29717. * @category Object
  29718. * @param {Object} object The object to inspect.
  29719. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29720. * @returns {string|undefined} Returns the key of the matched element,
  29721. * else `undefined`.
  29722. * @example
  29723. *
  29724. * var users = {
  29725. * 'barney': { 'age': 36, 'active': true },
  29726. * 'fred': { 'age': 40, 'active': false },
  29727. * 'pebbles': { 'age': 1, 'active': true }
  29728. * };
  29729. *
  29730. * _.findKey(users, function(o) { return o.age < 40; });
  29731. * // => 'barney' (iteration order is not guaranteed)
  29732. *
  29733. * // The `_.matches` iteratee shorthand.
  29734. * _.findKey(users, { 'age': 1, 'active': true });
  29735. * // => 'pebbles'
  29736. *
  29737. * // The `_.matchesProperty` iteratee shorthand.
  29738. * _.findKey(users, ['active', false]);
  29739. * // => 'fred'
  29740. *
  29741. * // The `_.property` iteratee shorthand.
  29742. * _.findKey(users, 'active');
  29743. * // => 'barney'
  29744. */
  29745. function findKey(object, predicate) {
  29746. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  29747. }
  29748. /**
  29749. * This method is like `_.findKey` except that it iterates over elements of
  29750. * a collection in the opposite order.
  29751. *
  29752. * @static
  29753. * @memberOf _
  29754. * @since 2.0.0
  29755. * @category Object
  29756. * @param {Object} object The object to inspect.
  29757. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29758. * @returns {string|undefined} Returns the key of the matched element,
  29759. * else `undefined`.
  29760. * @example
  29761. *
  29762. * var users = {
  29763. * 'barney': { 'age': 36, 'active': true },
  29764. * 'fred': { 'age': 40, 'active': false },
  29765. * 'pebbles': { 'age': 1, 'active': true }
  29766. * };
  29767. *
  29768. * _.findLastKey(users, function(o) { return o.age < 40; });
  29769. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  29770. *
  29771. * // The `_.matches` iteratee shorthand.
  29772. * _.findLastKey(users, { 'age': 36, 'active': true });
  29773. * // => 'barney'
  29774. *
  29775. * // The `_.matchesProperty` iteratee shorthand.
  29776. * _.findLastKey(users, ['active', false]);
  29777. * // => 'fred'
  29778. *
  29779. * // The `_.property` iteratee shorthand.
  29780. * _.findLastKey(users, 'active');
  29781. * // => 'pebbles'
  29782. */
  29783. function findLastKey(object, predicate) {
  29784. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  29785. }
  29786. /**
  29787. * Iterates over own and inherited enumerable string keyed properties of an
  29788. * object and invokes `iteratee` for each property. The iteratee is invoked
  29789. * with three arguments: (value, key, object). Iteratee functions may exit
  29790. * iteration early by explicitly returning `false`.
  29791. *
  29792. * @static
  29793. * @memberOf _
  29794. * @since 0.3.0
  29795. * @category Object
  29796. * @param {Object} object The object to iterate over.
  29797. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29798. * @returns {Object} Returns `object`.
  29799. * @see _.forInRight
  29800. * @example
  29801. *
  29802. * function Foo() {
  29803. * this.a = 1;
  29804. * this.b = 2;
  29805. * }
  29806. *
  29807. * Foo.prototype.c = 3;
  29808. *
  29809. * _.forIn(new Foo, function(value, key) {
  29810. * console.log(key);
  29811. * });
  29812. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  29813. */
  29814. function forIn(object, iteratee) {
  29815. return object == null
  29816. ? object
  29817. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  29818. }
  29819. /**
  29820. * This method is like `_.forIn` except that it iterates over properties of
  29821. * `object` in the opposite order.
  29822. *
  29823. * @static
  29824. * @memberOf _
  29825. * @since 2.0.0
  29826. * @category Object
  29827. * @param {Object} object The object to iterate over.
  29828. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29829. * @returns {Object} Returns `object`.
  29830. * @see _.forIn
  29831. * @example
  29832. *
  29833. * function Foo() {
  29834. * this.a = 1;
  29835. * this.b = 2;
  29836. * }
  29837. *
  29838. * Foo.prototype.c = 3;
  29839. *
  29840. * _.forInRight(new Foo, function(value, key) {
  29841. * console.log(key);
  29842. * });
  29843. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  29844. */
  29845. function forInRight(object, iteratee) {
  29846. return object == null
  29847. ? object
  29848. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  29849. }
  29850. /**
  29851. * Iterates over own enumerable string keyed properties of an object and
  29852. * invokes `iteratee` for each property. The iteratee is invoked with three
  29853. * arguments: (value, key, object). Iteratee functions may exit iteration
  29854. * early by explicitly returning `false`.
  29855. *
  29856. * @static
  29857. * @memberOf _
  29858. * @since 0.3.0
  29859. * @category Object
  29860. * @param {Object} object The object to iterate over.
  29861. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29862. * @returns {Object} Returns `object`.
  29863. * @see _.forOwnRight
  29864. * @example
  29865. *
  29866. * function Foo() {
  29867. * this.a = 1;
  29868. * this.b = 2;
  29869. * }
  29870. *
  29871. * Foo.prototype.c = 3;
  29872. *
  29873. * _.forOwn(new Foo, function(value, key) {
  29874. * console.log(key);
  29875. * });
  29876. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  29877. */
  29878. function forOwn(object, iteratee) {
  29879. return object && baseForOwn(object, getIteratee(iteratee, 3));
  29880. }
  29881. /**
  29882. * This method is like `_.forOwn` except that it iterates over properties of
  29883. * `object` in the opposite order.
  29884. *
  29885. * @static
  29886. * @memberOf _
  29887. * @since 2.0.0
  29888. * @category Object
  29889. * @param {Object} object The object to iterate over.
  29890. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  29891. * @returns {Object} Returns `object`.
  29892. * @see _.forOwn
  29893. * @example
  29894. *
  29895. * function Foo() {
  29896. * this.a = 1;
  29897. * this.b = 2;
  29898. * }
  29899. *
  29900. * Foo.prototype.c = 3;
  29901. *
  29902. * _.forOwnRight(new Foo, function(value, key) {
  29903. * console.log(key);
  29904. * });
  29905. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  29906. */
  29907. function forOwnRight(object, iteratee) {
  29908. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  29909. }
  29910. /**
  29911. * Creates an array of function property names from own enumerable properties
  29912. * of `object`.
  29913. *
  29914. * @static
  29915. * @since 0.1.0
  29916. * @memberOf _
  29917. * @category Object
  29918. * @param {Object} object The object to inspect.
  29919. * @returns {Array} Returns the function names.
  29920. * @see _.functionsIn
  29921. * @example
  29922. *
  29923. * function Foo() {
  29924. * this.a = _.constant('a');
  29925. * this.b = _.constant('b');
  29926. * }
  29927. *
  29928. * Foo.prototype.c = _.constant('c');
  29929. *
  29930. * _.functions(new Foo);
  29931. * // => ['a', 'b']
  29932. */
  29933. function functions(object) {
  29934. return object == null ? [] : baseFunctions(object, keys(object));
  29935. }
  29936. /**
  29937. * Creates an array of function property names from own and inherited
  29938. * enumerable properties of `object`.
  29939. *
  29940. * @static
  29941. * @memberOf _
  29942. * @since 4.0.0
  29943. * @category Object
  29944. * @param {Object} object The object to inspect.
  29945. * @returns {Array} Returns the function names.
  29946. * @see _.functions
  29947. * @example
  29948. *
  29949. * function Foo() {
  29950. * this.a = _.constant('a');
  29951. * this.b = _.constant('b');
  29952. * }
  29953. *
  29954. * Foo.prototype.c = _.constant('c');
  29955. *
  29956. * _.functionsIn(new Foo);
  29957. * // => ['a', 'b', 'c']
  29958. */
  29959. function functionsIn(object) {
  29960. return object == null ? [] : baseFunctions(object, keysIn(object));
  29961. }
  29962. /**
  29963. * Gets the value at `path` of `object`. If the resolved value is
  29964. * `undefined`, the `defaultValue` is returned in its place.
  29965. *
  29966. * @static
  29967. * @memberOf _
  29968. * @since 3.7.0
  29969. * @category Object
  29970. * @param {Object} object The object to query.
  29971. * @param {Array|string} path The path of the property to get.
  29972. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  29973. * @returns {*} Returns the resolved value.
  29974. * @example
  29975. *
  29976. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  29977. *
  29978. * _.get(object, 'a[0].b.c');
  29979. * // => 3
  29980. *
  29981. * _.get(object, ['a', '0', 'b', 'c']);
  29982. * // => 3
  29983. *
  29984. * _.get(object, 'a.b.c', 'default');
  29985. * // => 'default'
  29986. */
  29987. function get(object, path, defaultValue) {
  29988. var result = object == null ? undefined : baseGet(object, path);
  29989. return result === undefined ? defaultValue : result;
  29990. }
  29991. /**
  29992. * Checks if `path` is a direct property of `object`.
  29993. *
  29994. * @static
  29995. * @since 0.1.0
  29996. * @memberOf _
  29997. * @category Object
  29998. * @param {Object} object The object to query.
  29999. * @param {Array|string} path The path to check.
  30000. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30001. * @example
  30002. *
  30003. * var object = { 'a': { 'b': 2 } };
  30004. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30005. *
  30006. * _.has(object, 'a');
  30007. * // => true
  30008. *
  30009. * _.has(object, 'a.b');
  30010. * // => true
  30011. *
  30012. * _.has(object, ['a', 'b']);
  30013. * // => true
  30014. *
  30015. * _.has(other, 'a');
  30016. * // => false
  30017. */
  30018. function has(object, path) {
  30019. return object != null && hasPath(object, path, baseHas);
  30020. }
  30021. /**
  30022. * Checks if `path` is a direct or inherited property of `object`.
  30023. *
  30024. * @static
  30025. * @memberOf _
  30026. * @since 4.0.0
  30027. * @category Object
  30028. * @param {Object} object The object to query.
  30029. * @param {Array|string} path The path to check.
  30030. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30031. * @example
  30032. *
  30033. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30034. *
  30035. * _.hasIn(object, 'a');
  30036. * // => true
  30037. *
  30038. * _.hasIn(object, 'a.b');
  30039. * // => true
  30040. *
  30041. * _.hasIn(object, ['a', 'b']);
  30042. * // => true
  30043. *
  30044. * _.hasIn(object, 'b');
  30045. * // => false
  30046. */
  30047. function hasIn(object, path) {
  30048. return object != null && hasPath(object, path, baseHasIn);
  30049. }
  30050. /**
  30051. * Creates an object composed of the inverted keys and values of `object`.
  30052. * If `object` contains duplicate values, subsequent values overwrite
  30053. * property assignments of previous values.
  30054. *
  30055. * @static
  30056. * @memberOf _
  30057. * @since 0.7.0
  30058. * @category Object
  30059. * @param {Object} object The object to invert.
  30060. * @returns {Object} Returns the new inverted object.
  30061. * @example
  30062. *
  30063. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30064. *
  30065. * _.invert(object);
  30066. * // => { '1': 'c', '2': 'b' }
  30067. */
  30068. var invert = createInverter(function(result, value, key) {
  30069. if (value != null &&
  30070. typeof value.toString != 'function') {
  30071. value = nativeObjectToString.call(value);
  30072. }
  30073. result[value] = key;
  30074. }, constant(identity));
  30075. /**
  30076. * This method is like `_.invert` except that the inverted object is generated
  30077. * from the results of running each element of `object` thru `iteratee`. The
  30078. * corresponding inverted value of each inverted key is an array of keys
  30079. * responsible for generating the inverted value. The iteratee is invoked
  30080. * with one argument: (value).
  30081. *
  30082. * @static
  30083. * @memberOf _
  30084. * @since 4.1.0
  30085. * @category Object
  30086. * @param {Object} object The object to invert.
  30087. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30088. * @returns {Object} Returns the new inverted object.
  30089. * @example
  30090. *
  30091. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30092. *
  30093. * _.invertBy(object);
  30094. * // => { '1': ['a', 'c'], '2': ['b'] }
  30095. *
  30096. * _.invertBy(object, function(value) {
  30097. * return 'group' + value;
  30098. * });
  30099. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30100. */
  30101. var invertBy = createInverter(function(result, value, key) {
  30102. if (value != null &&
  30103. typeof value.toString != 'function') {
  30104. value = nativeObjectToString.call(value);
  30105. }
  30106. if (hasOwnProperty.call(result, value)) {
  30107. result[value].push(key);
  30108. } else {
  30109. result[value] = [key];
  30110. }
  30111. }, getIteratee);
  30112. /**
  30113. * Invokes the method at `path` of `object`.
  30114. *
  30115. * @static
  30116. * @memberOf _
  30117. * @since 4.0.0
  30118. * @category Object
  30119. * @param {Object} object The object to query.
  30120. * @param {Array|string} path The path of the method to invoke.
  30121. * @param {...*} [args] The arguments to invoke the method with.
  30122. * @returns {*} Returns the result of the invoked method.
  30123. * @example
  30124. *
  30125. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30126. *
  30127. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30128. * // => [2, 3]
  30129. */
  30130. var invoke = baseRest(baseInvoke);
  30131. /**
  30132. * Creates an array of the own enumerable property names of `object`.
  30133. *
  30134. * **Note:** Non-object values are coerced to objects. See the
  30135. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30136. * for more details.
  30137. *
  30138. * @static
  30139. * @since 0.1.0
  30140. * @memberOf _
  30141. * @category Object
  30142. * @param {Object} object The object to query.
  30143. * @returns {Array} Returns the array of property names.
  30144. * @example
  30145. *
  30146. * function Foo() {
  30147. * this.a = 1;
  30148. * this.b = 2;
  30149. * }
  30150. *
  30151. * Foo.prototype.c = 3;
  30152. *
  30153. * _.keys(new Foo);
  30154. * // => ['a', 'b'] (iteration order is not guaranteed)
  30155. *
  30156. * _.keys('hi');
  30157. * // => ['0', '1']
  30158. */
  30159. function keys(object) {
  30160. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30161. }
  30162. /**
  30163. * Creates an array of the own and inherited enumerable property names of `object`.
  30164. *
  30165. * **Note:** Non-object values are coerced to objects.
  30166. *
  30167. * @static
  30168. * @memberOf _
  30169. * @since 3.0.0
  30170. * @category Object
  30171. * @param {Object} object The object to query.
  30172. * @returns {Array} Returns the array of property names.
  30173. * @example
  30174. *
  30175. * function Foo() {
  30176. * this.a = 1;
  30177. * this.b = 2;
  30178. * }
  30179. *
  30180. * Foo.prototype.c = 3;
  30181. *
  30182. * _.keysIn(new Foo);
  30183. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30184. */
  30185. function keysIn(object) {
  30186. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30187. }
  30188. /**
  30189. * The opposite of `_.mapValues`; this method creates an object with the
  30190. * same values as `object` and keys generated by running each own enumerable
  30191. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30192. * with three arguments: (value, key, object).
  30193. *
  30194. * @static
  30195. * @memberOf _
  30196. * @since 3.8.0
  30197. * @category Object
  30198. * @param {Object} object The object to iterate over.
  30199. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30200. * @returns {Object} Returns the new mapped object.
  30201. * @see _.mapValues
  30202. * @example
  30203. *
  30204. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30205. * return key + value;
  30206. * });
  30207. * // => { 'a1': 1, 'b2': 2 }
  30208. */
  30209. function mapKeys(object, iteratee) {
  30210. var result = {};
  30211. iteratee = getIteratee(iteratee, 3);
  30212. baseForOwn(object, function(value, key, object) {
  30213. baseAssignValue(result, iteratee(value, key, object), value);
  30214. });
  30215. return result;
  30216. }
  30217. /**
  30218. * Creates an object with the same keys as `object` and values generated
  30219. * by running each own enumerable string keyed property of `object` thru
  30220. * `iteratee`. The iteratee is invoked with three arguments:
  30221. * (value, key, object).
  30222. *
  30223. * @static
  30224. * @memberOf _
  30225. * @since 2.4.0
  30226. * @category Object
  30227. * @param {Object} object The object to iterate over.
  30228. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30229. * @returns {Object} Returns the new mapped object.
  30230. * @see _.mapKeys
  30231. * @example
  30232. *
  30233. * var users = {
  30234. * 'fred': { 'user': 'fred', 'age': 40 },
  30235. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30236. * };
  30237. *
  30238. * _.mapValues(users, function(o) { return o.age; });
  30239. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30240. *
  30241. * // The `_.property` iteratee shorthand.
  30242. * _.mapValues(users, 'age');
  30243. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30244. */
  30245. function mapValues(object, iteratee) {
  30246. var result = {};
  30247. iteratee = getIteratee(iteratee, 3);
  30248. baseForOwn(object, function(value, key, object) {
  30249. baseAssignValue(result, key, iteratee(value, key, object));
  30250. });
  30251. return result;
  30252. }
  30253. /**
  30254. * This method is like `_.assign` except that it recursively merges own and
  30255. * inherited enumerable string keyed properties of source objects into the
  30256. * destination object. Source properties that resolve to `undefined` are
  30257. * skipped if a destination value exists. Array and plain object properties
  30258. * are merged recursively. Other objects and value types are overridden by
  30259. * assignment. Source objects are applied from left to right. Subsequent
  30260. * sources overwrite property assignments of previous sources.
  30261. *
  30262. * **Note:** This method mutates `object`.
  30263. *
  30264. * @static
  30265. * @memberOf _
  30266. * @since 0.5.0
  30267. * @category Object
  30268. * @param {Object} object The destination object.
  30269. * @param {...Object} [sources] The source objects.
  30270. * @returns {Object} Returns `object`.
  30271. * @example
  30272. *
  30273. * var object = {
  30274. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30275. * };
  30276. *
  30277. * var other = {
  30278. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30279. * };
  30280. *
  30281. * _.merge(object, other);
  30282. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30283. */
  30284. var merge = createAssigner(function(object, source, srcIndex) {
  30285. baseMerge(object, source, srcIndex);
  30286. });
  30287. /**
  30288. * This method is like `_.merge` except that it accepts `customizer` which
  30289. * is invoked to produce the merged values of the destination and source
  30290. * properties. If `customizer` returns `undefined`, merging is handled by the
  30291. * method instead. The `customizer` is invoked with six arguments:
  30292. * (objValue, srcValue, key, object, source, stack).
  30293. *
  30294. * **Note:** This method mutates `object`.
  30295. *
  30296. * @static
  30297. * @memberOf _
  30298. * @since 4.0.0
  30299. * @category Object
  30300. * @param {Object} object The destination object.
  30301. * @param {...Object} sources The source objects.
  30302. * @param {Function} customizer The function to customize assigned values.
  30303. * @returns {Object} Returns `object`.
  30304. * @example
  30305. *
  30306. * function customizer(objValue, srcValue) {
  30307. * if (_.isArray(objValue)) {
  30308. * return objValue.concat(srcValue);
  30309. * }
  30310. * }
  30311. *
  30312. * var object = { 'a': [1], 'b': [2] };
  30313. * var other = { 'a': [3], 'b': [4] };
  30314. *
  30315. * _.mergeWith(object, other, customizer);
  30316. * // => { 'a': [1, 3], 'b': [2, 4] }
  30317. */
  30318. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30319. baseMerge(object, source, srcIndex, customizer);
  30320. });
  30321. /**
  30322. * The opposite of `_.pick`; this method creates an object composed of the
  30323. * own and inherited enumerable property paths of `object` that are not omitted.
  30324. *
  30325. * **Note:** This method is considerably slower than `_.pick`.
  30326. *
  30327. * @static
  30328. * @since 0.1.0
  30329. * @memberOf _
  30330. * @category Object
  30331. * @param {Object} object The source object.
  30332. * @param {...(string|string[])} [paths] The property paths to omit.
  30333. * @returns {Object} Returns the new object.
  30334. * @example
  30335. *
  30336. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30337. *
  30338. * _.omit(object, ['a', 'c']);
  30339. * // => { 'b': '2' }
  30340. */
  30341. var omit = flatRest(function(object, paths) {
  30342. var result = {};
  30343. if (object == null) {
  30344. return result;
  30345. }
  30346. var isDeep = false;
  30347. paths = arrayMap(paths, function(path) {
  30348. path = castPath(path, object);
  30349. isDeep || (isDeep = path.length > 1);
  30350. return path;
  30351. });
  30352. copyObject(object, getAllKeysIn(object), result);
  30353. if (isDeep) {
  30354. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30355. }
  30356. var length = paths.length;
  30357. while (length--) {
  30358. baseUnset(result, paths[length]);
  30359. }
  30360. return result;
  30361. });
  30362. /**
  30363. * The opposite of `_.pickBy`; this method creates an object composed of
  30364. * the own and inherited enumerable string keyed properties of `object` that
  30365. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30366. * arguments: (value, key).
  30367. *
  30368. * @static
  30369. * @memberOf _
  30370. * @since 4.0.0
  30371. * @category Object
  30372. * @param {Object} object The source object.
  30373. * @param {Function} [predicate=_.identity] The function invoked per property.
  30374. * @returns {Object} Returns the new object.
  30375. * @example
  30376. *
  30377. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30378. *
  30379. * _.omitBy(object, _.isNumber);
  30380. * // => { 'b': '2' }
  30381. */
  30382. function omitBy(object, predicate) {
  30383. return pickBy(object, negate(getIteratee(predicate)));
  30384. }
  30385. /**
  30386. * Creates an object composed of the picked `object` properties.
  30387. *
  30388. * @static
  30389. * @since 0.1.0
  30390. * @memberOf _
  30391. * @category Object
  30392. * @param {Object} object The source object.
  30393. * @param {...(string|string[])} [paths] The property paths to pick.
  30394. * @returns {Object} Returns the new object.
  30395. * @example
  30396. *
  30397. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30398. *
  30399. * _.pick(object, ['a', 'c']);
  30400. * // => { 'a': 1, 'c': 3 }
  30401. */
  30402. var pick = flatRest(function(object, paths) {
  30403. return object == null ? {} : basePick(object, paths);
  30404. });
  30405. /**
  30406. * Creates an object composed of the `object` properties `predicate` returns
  30407. * truthy for. The predicate is invoked with two arguments: (value, key).
  30408. *
  30409. * @static
  30410. * @memberOf _
  30411. * @since 4.0.0
  30412. * @category Object
  30413. * @param {Object} object The source object.
  30414. * @param {Function} [predicate=_.identity] The function invoked per property.
  30415. * @returns {Object} Returns the new object.
  30416. * @example
  30417. *
  30418. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30419. *
  30420. * _.pickBy(object, _.isNumber);
  30421. * // => { 'a': 1, 'c': 3 }
  30422. */
  30423. function pickBy(object, predicate) {
  30424. if (object == null) {
  30425. return {};
  30426. }
  30427. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30428. return [prop];
  30429. });
  30430. predicate = getIteratee(predicate);
  30431. return basePickBy(object, props, function(value, path) {
  30432. return predicate(value, path[0]);
  30433. });
  30434. }
  30435. /**
  30436. * This method is like `_.get` except that if the resolved value is a
  30437. * function it's invoked with the `this` binding of its parent object and
  30438. * its result is returned.
  30439. *
  30440. * @static
  30441. * @since 0.1.0
  30442. * @memberOf _
  30443. * @category Object
  30444. * @param {Object} object The object to query.
  30445. * @param {Array|string} path The path of the property to resolve.
  30446. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30447. * @returns {*} Returns the resolved value.
  30448. * @example
  30449. *
  30450. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30451. *
  30452. * _.result(object, 'a[0].b.c1');
  30453. * // => 3
  30454. *
  30455. * _.result(object, 'a[0].b.c2');
  30456. * // => 4
  30457. *
  30458. * _.result(object, 'a[0].b.c3', 'default');
  30459. * // => 'default'
  30460. *
  30461. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30462. * // => 'default'
  30463. */
  30464. function result(object, path, defaultValue) {
  30465. path = castPath(path, object);
  30466. var index = -1,
  30467. length = path.length;
  30468. // Ensure the loop is entered when path is empty.
  30469. if (!length) {
  30470. length = 1;
  30471. object = undefined;
  30472. }
  30473. while (++index < length) {
  30474. var value = object == null ? undefined : object[toKey(path[index])];
  30475. if (value === undefined) {
  30476. index = length;
  30477. value = defaultValue;
  30478. }
  30479. object = isFunction(value) ? value.call(object) : value;
  30480. }
  30481. return object;
  30482. }
  30483. /**
  30484. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30485. * it's created. Arrays are created for missing index properties while objects
  30486. * are created for all other missing properties. Use `_.setWith` to customize
  30487. * `path` creation.
  30488. *
  30489. * **Note:** This method mutates `object`.
  30490. *
  30491. * @static
  30492. * @memberOf _
  30493. * @since 3.7.0
  30494. * @category Object
  30495. * @param {Object} object The object to modify.
  30496. * @param {Array|string} path The path of the property to set.
  30497. * @param {*} value The value to set.
  30498. * @returns {Object} Returns `object`.
  30499. * @example
  30500. *
  30501. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30502. *
  30503. * _.set(object, 'a[0].b.c', 4);
  30504. * console.log(object.a[0].b.c);
  30505. * // => 4
  30506. *
  30507. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30508. * console.log(object.x[0].y.z);
  30509. * // => 5
  30510. */
  30511. function set(object, path, value) {
  30512. return object == null ? object : baseSet(object, path, value);
  30513. }
  30514. /**
  30515. * This method is like `_.set` except that it accepts `customizer` which is
  30516. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30517. * path creation is handled by the method instead. The `customizer` is invoked
  30518. * with three arguments: (nsValue, key, nsObject).
  30519. *
  30520. * **Note:** This method mutates `object`.
  30521. *
  30522. * @static
  30523. * @memberOf _
  30524. * @since 4.0.0
  30525. * @category Object
  30526. * @param {Object} object The object to modify.
  30527. * @param {Array|string} path The path of the property to set.
  30528. * @param {*} value The value to set.
  30529. * @param {Function} [customizer] The function to customize assigned values.
  30530. * @returns {Object} Returns `object`.
  30531. * @example
  30532. *
  30533. * var object = {};
  30534. *
  30535. * _.setWith(object, '[0][1]', 'a', Object);
  30536. * // => { '0': { '1': 'a' } }
  30537. */
  30538. function setWith(object, path, value, customizer) {
  30539. customizer = typeof customizer == 'function' ? customizer : undefined;
  30540. return object == null ? object : baseSet(object, path, value, customizer);
  30541. }
  30542. /**
  30543. * Creates an array of own enumerable string keyed-value pairs for `object`
  30544. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30545. * entries are returned.
  30546. *
  30547. * @static
  30548. * @memberOf _
  30549. * @since 4.0.0
  30550. * @alias entries
  30551. * @category Object
  30552. * @param {Object} object The object to query.
  30553. * @returns {Array} Returns the key-value pairs.
  30554. * @example
  30555. *
  30556. * function Foo() {
  30557. * this.a = 1;
  30558. * this.b = 2;
  30559. * }
  30560. *
  30561. * Foo.prototype.c = 3;
  30562. *
  30563. * _.toPairs(new Foo);
  30564. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30565. */
  30566. var toPairs = createToPairs(keys);
  30567. /**
  30568. * Creates an array of own and inherited enumerable string keyed-value pairs
  30569. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30570. * or set, its entries are returned.
  30571. *
  30572. * @static
  30573. * @memberOf _
  30574. * @since 4.0.0
  30575. * @alias entriesIn
  30576. * @category Object
  30577. * @param {Object} object The object to query.
  30578. * @returns {Array} Returns the key-value pairs.
  30579. * @example
  30580. *
  30581. * function Foo() {
  30582. * this.a = 1;
  30583. * this.b = 2;
  30584. * }
  30585. *
  30586. * Foo.prototype.c = 3;
  30587. *
  30588. * _.toPairsIn(new Foo);
  30589. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30590. */
  30591. var toPairsIn = createToPairs(keysIn);
  30592. /**
  30593. * An alternative to `_.reduce`; this method transforms `object` to a new
  30594. * `accumulator` object which is the result of running each of its own
  30595. * enumerable string keyed properties thru `iteratee`, with each invocation
  30596. * potentially mutating the `accumulator` object. If `accumulator` is not
  30597. * provided, a new object with the same `[[Prototype]]` will be used. The
  30598. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30599. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30600. *
  30601. * @static
  30602. * @memberOf _
  30603. * @since 1.3.0
  30604. * @category Object
  30605. * @param {Object} object The object to iterate over.
  30606. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30607. * @param {*} [accumulator] The custom accumulator value.
  30608. * @returns {*} Returns the accumulated value.
  30609. * @example
  30610. *
  30611. * _.transform([2, 3, 4], function(result, n) {
  30612. * result.push(n *= n);
  30613. * return n % 2 == 0;
  30614. * }, []);
  30615. * // => [4, 9]
  30616. *
  30617. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30618. * (result[value] || (result[value] = [])).push(key);
  30619. * }, {});
  30620. * // => { '1': ['a', 'c'], '2': ['b'] }
  30621. */
  30622. function transform(object, iteratee, accumulator) {
  30623. var isArr = isArray(object),
  30624. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30625. iteratee = getIteratee(iteratee, 4);
  30626. if (accumulator == null) {
  30627. var Ctor = object && object.constructor;
  30628. if (isArrLike) {
  30629. accumulator = isArr ? new Ctor : [];
  30630. }
  30631. else if (isObject(object)) {
  30632. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30633. }
  30634. else {
  30635. accumulator = {};
  30636. }
  30637. }
  30638. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30639. return iteratee(accumulator, value, index, object);
  30640. });
  30641. return accumulator;
  30642. }
  30643. /**
  30644. * Removes the property at `path` of `object`.
  30645. *
  30646. * **Note:** This method mutates `object`.
  30647. *
  30648. * @static
  30649. * @memberOf _
  30650. * @since 4.0.0
  30651. * @category Object
  30652. * @param {Object} object The object to modify.
  30653. * @param {Array|string} path The path of the property to unset.
  30654. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30655. * @example
  30656. *
  30657. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30658. * _.unset(object, 'a[0].b.c');
  30659. * // => true
  30660. *
  30661. * console.log(object);
  30662. * // => { 'a': [{ 'b': {} }] };
  30663. *
  30664. * _.unset(object, ['a', '0', 'b', 'c']);
  30665. * // => true
  30666. *
  30667. * console.log(object);
  30668. * // => { 'a': [{ 'b': {} }] };
  30669. */
  30670. function unset(object, path) {
  30671. return object == null ? true : baseUnset(object, path);
  30672. }
  30673. /**
  30674. * This method is like `_.set` except that accepts `updater` to produce the
  30675. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30676. * is invoked with one argument: (value).
  30677. *
  30678. * **Note:** This method mutates `object`.
  30679. *
  30680. * @static
  30681. * @memberOf _
  30682. * @since 4.6.0
  30683. * @category Object
  30684. * @param {Object} object The object to modify.
  30685. * @param {Array|string} path The path of the property to set.
  30686. * @param {Function} updater The function to produce the updated value.
  30687. * @returns {Object} Returns `object`.
  30688. * @example
  30689. *
  30690. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30691. *
  30692. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30693. * console.log(object.a[0].b.c);
  30694. * // => 9
  30695. *
  30696. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30697. * console.log(object.x[0].y.z);
  30698. * // => 0
  30699. */
  30700. function update(object, path, updater) {
  30701. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30702. }
  30703. /**
  30704. * This method is like `_.update` except that it accepts `customizer` which is
  30705. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30706. * path creation is handled by the method instead. The `customizer` is invoked
  30707. * with three arguments: (nsValue, key, nsObject).
  30708. *
  30709. * **Note:** This method mutates `object`.
  30710. *
  30711. * @static
  30712. * @memberOf _
  30713. * @since 4.6.0
  30714. * @category Object
  30715. * @param {Object} object The object to modify.
  30716. * @param {Array|string} path The path of the property to set.
  30717. * @param {Function} updater The function to produce the updated value.
  30718. * @param {Function} [customizer] The function to customize assigned values.
  30719. * @returns {Object} Returns `object`.
  30720. * @example
  30721. *
  30722. * var object = {};
  30723. *
  30724. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  30725. * // => { '0': { '1': 'a' } }
  30726. */
  30727. function updateWith(object, path, updater, customizer) {
  30728. customizer = typeof customizer == 'function' ? customizer : undefined;
  30729. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  30730. }
  30731. /**
  30732. * Creates an array of the own enumerable string keyed property values of `object`.
  30733. *
  30734. * **Note:** Non-object values are coerced to objects.
  30735. *
  30736. * @static
  30737. * @since 0.1.0
  30738. * @memberOf _
  30739. * @category Object
  30740. * @param {Object} object The object to query.
  30741. * @returns {Array} Returns the array of property values.
  30742. * @example
  30743. *
  30744. * function Foo() {
  30745. * this.a = 1;
  30746. * this.b = 2;
  30747. * }
  30748. *
  30749. * Foo.prototype.c = 3;
  30750. *
  30751. * _.values(new Foo);
  30752. * // => [1, 2] (iteration order is not guaranteed)
  30753. *
  30754. * _.values('hi');
  30755. * // => ['h', 'i']
  30756. */
  30757. function values(object) {
  30758. return object == null ? [] : baseValues(object, keys(object));
  30759. }
  30760. /**
  30761. * Creates an array of the own and inherited enumerable string keyed property
  30762. * values of `object`.
  30763. *
  30764. * **Note:** Non-object values are coerced to objects.
  30765. *
  30766. * @static
  30767. * @memberOf _
  30768. * @since 3.0.0
  30769. * @category Object
  30770. * @param {Object} object The object to query.
  30771. * @returns {Array} Returns the array of property values.
  30772. * @example
  30773. *
  30774. * function Foo() {
  30775. * this.a = 1;
  30776. * this.b = 2;
  30777. * }
  30778. *
  30779. * Foo.prototype.c = 3;
  30780. *
  30781. * _.valuesIn(new Foo);
  30782. * // => [1, 2, 3] (iteration order is not guaranteed)
  30783. */
  30784. function valuesIn(object) {
  30785. return object == null ? [] : baseValues(object, keysIn(object));
  30786. }
  30787. /*------------------------------------------------------------------------*/
  30788. /**
  30789. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  30790. *
  30791. * @static
  30792. * @memberOf _
  30793. * @since 4.0.0
  30794. * @category Number
  30795. * @param {number} number The number to clamp.
  30796. * @param {number} [lower] The lower bound.
  30797. * @param {number} upper The upper bound.
  30798. * @returns {number} Returns the clamped number.
  30799. * @example
  30800. *
  30801. * _.clamp(-10, -5, 5);
  30802. * // => -5
  30803. *
  30804. * _.clamp(10, -5, 5);
  30805. * // => 5
  30806. */
  30807. function clamp(number, lower, upper) {
  30808. if (upper === undefined) {
  30809. upper = lower;
  30810. lower = undefined;
  30811. }
  30812. if (upper !== undefined) {
  30813. upper = toNumber(upper);
  30814. upper = upper === upper ? upper : 0;
  30815. }
  30816. if (lower !== undefined) {
  30817. lower = toNumber(lower);
  30818. lower = lower === lower ? lower : 0;
  30819. }
  30820. return baseClamp(toNumber(number), lower, upper);
  30821. }
  30822. /**
  30823. * Checks if `n` is between `start` and up to, but not including, `end`. If
  30824. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  30825. * If `start` is greater than `end` the params are swapped to support
  30826. * negative ranges.
  30827. *
  30828. * @static
  30829. * @memberOf _
  30830. * @since 3.3.0
  30831. * @category Number
  30832. * @param {number} number The number to check.
  30833. * @param {number} [start=0] The start of the range.
  30834. * @param {number} end The end of the range.
  30835. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  30836. * @see _.range, _.rangeRight
  30837. * @example
  30838. *
  30839. * _.inRange(3, 2, 4);
  30840. * // => true
  30841. *
  30842. * _.inRange(4, 8);
  30843. * // => true
  30844. *
  30845. * _.inRange(4, 2);
  30846. * // => false
  30847. *
  30848. * _.inRange(2, 2);
  30849. * // => false
  30850. *
  30851. * _.inRange(1.2, 2);
  30852. * // => true
  30853. *
  30854. * _.inRange(5.2, 4);
  30855. * // => false
  30856. *
  30857. * _.inRange(-3, -2, -6);
  30858. * // => true
  30859. */
  30860. function inRange(number, start, end) {
  30861. start = toFinite(start);
  30862. if (end === undefined) {
  30863. end = start;
  30864. start = 0;
  30865. } else {
  30866. end = toFinite(end);
  30867. }
  30868. number = toNumber(number);
  30869. return baseInRange(number, start, end);
  30870. }
  30871. /**
  30872. * Produces a random number between the inclusive `lower` and `upper` bounds.
  30873. * If only one argument is provided a number between `0` and the given number
  30874. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  30875. * floats, a floating-point number is returned instead of an integer.
  30876. *
  30877. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  30878. * floating-point values which can produce unexpected results.
  30879. *
  30880. * @static
  30881. * @memberOf _
  30882. * @since 0.7.0
  30883. * @category Number
  30884. * @param {number} [lower=0] The lower bound.
  30885. * @param {number} [upper=1] The upper bound.
  30886. * @param {boolean} [floating] Specify returning a floating-point number.
  30887. * @returns {number} Returns the random number.
  30888. * @example
  30889. *
  30890. * _.random(0, 5);
  30891. * // => an integer between 0 and 5
  30892. *
  30893. * _.random(5);
  30894. * // => also an integer between 0 and 5
  30895. *
  30896. * _.random(5, true);
  30897. * // => a floating-point number between 0 and 5
  30898. *
  30899. * _.random(1.2, 5.2);
  30900. * // => a floating-point number between 1.2 and 5.2
  30901. */
  30902. function random(lower, upper, floating) {
  30903. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  30904. upper = floating = undefined;
  30905. }
  30906. if (floating === undefined) {
  30907. if (typeof upper == 'boolean') {
  30908. floating = upper;
  30909. upper = undefined;
  30910. }
  30911. else if (typeof lower == 'boolean') {
  30912. floating = lower;
  30913. lower = undefined;
  30914. }
  30915. }
  30916. if (lower === undefined && upper === undefined) {
  30917. lower = 0;
  30918. upper = 1;
  30919. }
  30920. else {
  30921. lower = toFinite(lower);
  30922. if (upper === undefined) {
  30923. upper = lower;
  30924. lower = 0;
  30925. } else {
  30926. upper = toFinite(upper);
  30927. }
  30928. }
  30929. if (lower > upper) {
  30930. var temp = lower;
  30931. lower = upper;
  30932. upper = temp;
  30933. }
  30934. if (floating || lower % 1 || upper % 1) {
  30935. var rand = nativeRandom();
  30936. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  30937. }
  30938. return baseRandom(lower, upper);
  30939. }
  30940. /*------------------------------------------------------------------------*/
  30941. /**
  30942. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  30943. *
  30944. * @static
  30945. * @memberOf _
  30946. * @since 3.0.0
  30947. * @category String
  30948. * @param {string} [string=''] The string to convert.
  30949. * @returns {string} Returns the camel cased string.
  30950. * @example
  30951. *
  30952. * _.camelCase('Foo Bar');
  30953. * // => 'fooBar'
  30954. *
  30955. * _.camelCase('--foo-bar--');
  30956. * // => 'fooBar'
  30957. *
  30958. * _.camelCase('__FOO_BAR__');
  30959. * // => 'fooBar'
  30960. */
  30961. var camelCase = createCompounder(function(result, word, index) {
  30962. word = word.toLowerCase();
  30963. return result + (index ? capitalize(word) : word);
  30964. });
  30965. /**
  30966. * Converts the first character of `string` to upper case and the remaining
  30967. * to lower case.
  30968. *
  30969. * @static
  30970. * @memberOf _
  30971. * @since 3.0.0
  30972. * @category String
  30973. * @param {string} [string=''] The string to capitalize.
  30974. * @returns {string} Returns the capitalized string.
  30975. * @example
  30976. *
  30977. * _.capitalize('FRED');
  30978. * // => 'Fred'
  30979. */
  30980. function capitalize(string) {
  30981. return upperFirst(toString(string).toLowerCase());
  30982. }
  30983. /**
  30984. * Deburrs `string` by converting
  30985. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  30986. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  30987. * letters to basic Latin letters and removing
  30988. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  30989. *
  30990. * @static
  30991. * @memberOf _
  30992. * @since 3.0.0
  30993. * @category String
  30994. * @param {string} [string=''] The string to deburr.
  30995. * @returns {string} Returns the deburred string.
  30996. * @example
  30997. *
  30998. * _.deburr('déjà vu');
  30999. * // => 'deja vu'
  31000. */
  31001. function deburr(string) {
  31002. string = toString(string);
  31003. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31004. }
  31005. /**
  31006. * Checks if `string` ends with the given target string.
  31007. *
  31008. * @static
  31009. * @memberOf _
  31010. * @since 3.0.0
  31011. * @category String
  31012. * @param {string} [string=''] The string to inspect.
  31013. * @param {string} [target] The string to search for.
  31014. * @param {number} [position=string.length] The position to search up to.
  31015. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31016. * else `false`.
  31017. * @example
  31018. *
  31019. * _.endsWith('abc', 'c');
  31020. * // => true
  31021. *
  31022. * _.endsWith('abc', 'b');
  31023. * // => false
  31024. *
  31025. * _.endsWith('abc', 'b', 2);
  31026. * // => true
  31027. */
  31028. function endsWith(string, target, position) {
  31029. string = toString(string);
  31030. target = baseToString(target);
  31031. var length = string.length;
  31032. position = position === undefined
  31033. ? length
  31034. : baseClamp(toInteger(position), 0, length);
  31035. var end = position;
  31036. position -= target.length;
  31037. return position >= 0 && string.slice(position, end) == target;
  31038. }
  31039. /**
  31040. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31041. * corresponding HTML entities.
  31042. *
  31043. * **Note:** No other characters are escaped. To escape additional
  31044. * characters use a third-party library like [_he_](https://mths.be/he).
  31045. *
  31046. * Though the ">" character is escaped for symmetry, characters like
  31047. * ">" and "/" don't need escaping in HTML and have no special meaning
  31048. * unless they're part of a tag or unquoted attribute value. See
  31049. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31050. * (under "semi-related fun fact") for more details.
  31051. *
  31052. * When working with HTML you should always
  31053. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31054. * XSS vectors.
  31055. *
  31056. * @static
  31057. * @since 0.1.0
  31058. * @memberOf _
  31059. * @category String
  31060. * @param {string} [string=''] The string to escape.
  31061. * @returns {string} Returns the escaped string.
  31062. * @example
  31063. *
  31064. * _.escape('fred, barney, & pebbles');
  31065. * // => 'fred, barney, &amp; pebbles'
  31066. */
  31067. function escape(string) {
  31068. string = toString(string);
  31069. return (string && reHasUnescapedHtml.test(string))
  31070. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31071. : string;
  31072. }
  31073. /**
  31074. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31075. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31076. *
  31077. * @static
  31078. * @memberOf _
  31079. * @since 3.0.0
  31080. * @category String
  31081. * @param {string} [string=''] The string to escape.
  31082. * @returns {string} Returns the escaped string.
  31083. * @example
  31084. *
  31085. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31086. * // => '\[lodash\]\(https://lodash\.com/\)'
  31087. */
  31088. function escapeRegExp(string) {
  31089. string = toString(string);
  31090. return (string && reHasRegExpChar.test(string))
  31091. ? string.replace(reRegExpChar, '\\$&')
  31092. : string;
  31093. }
  31094. /**
  31095. * Converts `string` to
  31096. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31097. *
  31098. * @static
  31099. * @memberOf _
  31100. * @since 3.0.0
  31101. * @category String
  31102. * @param {string} [string=''] The string to convert.
  31103. * @returns {string} Returns the kebab cased string.
  31104. * @example
  31105. *
  31106. * _.kebabCase('Foo Bar');
  31107. * // => 'foo-bar'
  31108. *
  31109. * _.kebabCase('fooBar');
  31110. * // => 'foo-bar'
  31111. *
  31112. * _.kebabCase('__FOO_BAR__');
  31113. * // => 'foo-bar'
  31114. */
  31115. var kebabCase = createCompounder(function(result, word, index) {
  31116. return result + (index ? '-' : '') + word.toLowerCase();
  31117. });
  31118. /**
  31119. * Converts `string`, as space separated words, to lower case.
  31120. *
  31121. * @static
  31122. * @memberOf _
  31123. * @since 4.0.0
  31124. * @category String
  31125. * @param {string} [string=''] The string to convert.
  31126. * @returns {string} Returns the lower cased string.
  31127. * @example
  31128. *
  31129. * _.lowerCase('--Foo-Bar--');
  31130. * // => 'foo bar'
  31131. *
  31132. * _.lowerCase('fooBar');
  31133. * // => 'foo bar'
  31134. *
  31135. * _.lowerCase('__FOO_BAR__');
  31136. * // => 'foo bar'
  31137. */
  31138. var lowerCase = createCompounder(function(result, word, index) {
  31139. return result + (index ? ' ' : '') + word.toLowerCase();
  31140. });
  31141. /**
  31142. * Converts the first character of `string` to lower case.
  31143. *
  31144. * @static
  31145. * @memberOf _
  31146. * @since 4.0.0
  31147. * @category String
  31148. * @param {string} [string=''] The string to convert.
  31149. * @returns {string} Returns the converted string.
  31150. * @example
  31151. *
  31152. * _.lowerFirst('Fred');
  31153. * // => 'fred'
  31154. *
  31155. * _.lowerFirst('FRED');
  31156. * // => 'fRED'
  31157. */
  31158. var lowerFirst = createCaseFirst('toLowerCase');
  31159. /**
  31160. * Pads `string` on the left and right sides if it's shorter than `length`.
  31161. * Padding characters are truncated if they can't be evenly divided by `length`.
  31162. *
  31163. * @static
  31164. * @memberOf _
  31165. * @since 3.0.0
  31166. * @category String
  31167. * @param {string} [string=''] The string to pad.
  31168. * @param {number} [length=0] The padding length.
  31169. * @param {string} [chars=' '] The string used as padding.
  31170. * @returns {string} Returns the padded string.
  31171. * @example
  31172. *
  31173. * _.pad('abc', 8);
  31174. * // => ' abc '
  31175. *
  31176. * _.pad('abc', 8, '_-');
  31177. * // => '_-abc_-_'
  31178. *
  31179. * _.pad('abc', 3);
  31180. * // => 'abc'
  31181. */
  31182. function pad(string, length, chars) {
  31183. string = toString(string);
  31184. length = toInteger(length);
  31185. var strLength = length ? stringSize(string) : 0;
  31186. if (!length || strLength >= length) {
  31187. return string;
  31188. }
  31189. var mid = (length - strLength) / 2;
  31190. return (
  31191. createPadding(nativeFloor(mid), chars) +
  31192. string +
  31193. createPadding(nativeCeil(mid), chars)
  31194. );
  31195. }
  31196. /**
  31197. * Pads `string` on the right side if it's shorter than `length`. Padding
  31198. * characters are truncated if they exceed `length`.
  31199. *
  31200. * @static
  31201. * @memberOf _
  31202. * @since 4.0.0
  31203. * @category String
  31204. * @param {string} [string=''] The string to pad.
  31205. * @param {number} [length=0] The padding length.
  31206. * @param {string} [chars=' '] The string used as padding.
  31207. * @returns {string} Returns the padded string.
  31208. * @example
  31209. *
  31210. * _.padEnd('abc', 6);
  31211. * // => 'abc '
  31212. *
  31213. * _.padEnd('abc', 6, '_-');
  31214. * // => 'abc_-_'
  31215. *
  31216. * _.padEnd('abc', 3);
  31217. * // => 'abc'
  31218. */
  31219. function padEnd(string, length, chars) {
  31220. string = toString(string);
  31221. length = toInteger(length);
  31222. var strLength = length ? stringSize(string) : 0;
  31223. return (length && strLength < length)
  31224. ? (string + createPadding(length - strLength, chars))
  31225. : string;
  31226. }
  31227. /**
  31228. * Pads `string` on the left side if it's shorter than `length`. Padding
  31229. * characters are truncated if they exceed `length`.
  31230. *
  31231. * @static
  31232. * @memberOf _
  31233. * @since 4.0.0
  31234. * @category String
  31235. * @param {string} [string=''] The string to pad.
  31236. * @param {number} [length=0] The padding length.
  31237. * @param {string} [chars=' '] The string used as padding.
  31238. * @returns {string} Returns the padded string.
  31239. * @example
  31240. *
  31241. * _.padStart('abc', 6);
  31242. * // => ' abc'
  31243. *
  31244. * _.padStart('abc', 6, '_-');
  31245. * // => '_-_abc'
  31246. *
  31247. * _.padStart('abc', 3);
  31248. * // => 'abc'
  31249. */
  31250. function padStart(string, length, chars) {
  31251. string = toString(string);
  31252. length = toInteger(length);
  31253. var strLength = length ? stringSize(string) : 0;
  31254. return (length && strLength < length)
  31255. ? (createPadding(length - strLength, chars) + string)
  31256. : string;
  31257. }
  31258. /**
  31259. * Converts `string` to an integer of the specified radix. If `radix` is
  31260. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31261. * hexadecimal, in which case a `radix` of `16` is used.
  31262. *
  31263. * **Note:** This method aligns with the
  31264. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31265. *
  31266. * @static
  31267. * @memberOf _
  31268. * @since 1.1.0
  31269. * @category String
  31270. * @param {string} string The string to convert.
  31271. * @param {number} [radix=10] The radix to interpret `value` by.
  31272. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31273. * @returns {number} Returns the converted integer.
  31274. * @example
  31275. *
  31276. * _.parseInt('08');
  31277. * // => 8
  31278. *
  31279. * _.map(['6', '08', '10'], _.parseInt);
  31280. * // => [6, 8, 10]
  31281. */
  31282. function parseInt(string, radix, guard) {
  31283. if (guard || radix == null) {
  31284. radix = 0;
  31285. } else if (radix) {
  31286. radix = +radix;
  31287. }
  31288. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31289. }
  31290. /**
  31291. * Repeats the given string `n` times.
  31292. *
  31293. * @static
  31294. * @memberOf _
  31295. * @since 3.0.0
  31296. * @category String
  31297. * @param {string} [string=''] The string to repeat.
  31298. * @param {number} [n=1] The number of times to repeat the string.
  31299. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31300. * @returns {string} Returns the repeated string.
  31301. * @example
  31302. *
  31303. * _.repeat('*', 3);
  31304. * // => '***'
  31305. *
  31306. * _.repeat('abc', 2);
  31307. * // => 'abcabc'
  31308. *
  31309. * _.repeat('abc', 0);
  31310. * // => ''
  31311. */
  31312. function repeat(string, n, guard) {
  31313. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31314. n = 1;
  31315. } else {
  31316. n = toInteger(n);
  31317. }
  31318. return baseRepeat(toString(string), n);
  31319. }
  31320. /**
  31321. * Replaces matches for `pattern` in `string` with `replacement`.
  31322. *
  31323. * **Note:** This method is based on
  31324. * [`String#replace`](https://mdn.io/String/replace).
  31325. *
  31326. * @static
  31327. * @memberOf _
  31328. * @since 4.0.0
  31329. * @category String
  31330. * @param {string} [string=''] The string to modify.
  31331. * @param {RegExp|string} pattern The pattern to replace.
  31332. * @param {Function|string} replacement The match replacement.
  31333. * @returns {string} Returns the modified string.
  31334. * @example
  31335. *
  31336. * _.replace('Hi Fred', 'Fred', 'Barney');
  31337. * // => 'Hi Barney'
  31338. */
  31339. function replace() {
  31340. var args = arguments,
  31341. string = toString(args[0]);
  31342. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31343. }
  31344. /**
  31345. * Converts `string` to
  31346. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31347. *
  31348. * @static
  31349. * @memberOf _
  31350. * @since 3.0.0
  31351. * @category String
  31352. * @param {string} [string=''] The string to convert.
  31353. * @returns {string} Returns the snake cased string.
  31354. * @example
  31355. *
  31356. * _.snakeCase('Foo Bar');
  31357. * // => 'foo_bar'
  31358. *
  31359. * _.snakeCase('fooBar');
  31360. * // => 'foo_bar'
  31361. *
  31362. * _.snakeCase('--FOO-BAR--');
  31363. * // => 'foo_bar'
  31364. */
  31365. var snakeCase = createCompounder(function(result, word, index) {
  31366. return result + (index ? '_' : '') + word.toLowerCase();
  31367. });
  31368. /**
  31369. * Splits `string` by `separator`.
  31370. *
  31371. * **Note:** This method is based on
  31372. * [`String#split`](https://mdn.io/String/split).
  31373. *
  31374. * @static
  31375. * @memberOf _
  31376. * @since 4.0.0
  31377. * @category String
  31378. * @param {string} [string=''] The string to split.
  31379. * @param {RegExp|string} separator The separator pattern to split by.
  31380. * @param {number} [limit] The length to truncate results to.
  31381. * @returns {Array} Returns the string segments.
  31382. * @example
  31383. *
  31384. * _.split('a-b-c', '-', 2);
  31385. * // => ['a', 'b']
  31386. */
  31387. function split(string, separator, limit) {
  31388. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31389. separator = limit = undefined;
  31390. }
  31391. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31392. if (!limit) {
  31393. return [];
  31394. }
  31395. string = toString(string);
  31396. if (string && (
  31397. typeof separator == 'string' ||
  31398. (separator != null && !isRegExp(separator))
  31399. )) {
  31400. separator = baseToString(separator);
  31401. if (!separator && hasUnicode(string)) {
  31402. return castSlice(stringToArray(string), 0, limit);
  31403. }
  31404. }
  31405. return string.split(separator, limit);
  31406. }
  31407. /**
  31408. * Converts `string` to
  31409. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31410. *
  31411. * @static
  31412. * @memberOf _
  31413. * @since 3.1.0
  31414. * @category String
  31415. * @param {string} [string=''] The string to convert.
  31416. * @returns {string} Returns the start cased string.
  31417. * @example
  31418. *
  31419. * _.startCase('--foo-bar--');
  31420. * // => 'Foo Bar'
  31421. *
  31422. * _.startCase('fooBar');
  31423. * // => 'Foo Bar'
  31424. *
  31425. * _.startCase('__FOO_BAR__');
  31426. * // => 'FOO BAR'
  31427. */
  31428. var startCase = createCompounder(function(result, word, index) {
  31429. return result + (index ? ' ' : '') + upperFirst(word);
  31430. });
  31431. /**
  31432. * Checks if `string` starts with the given target string.
  31433. *
  31434. * @static
  31435. * @memberOf _
  31436. * @since 3.0.0
  31437. * @category String
  31438. * @param {string} [string=''] The string to inspect.
  31439. * @param {string} [target] The string to search for.
  31440. * @param {number} [position=0] The position to search from.
  31441. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31442. * else `false`.
  31443. * @example
  31444. *
  31445. * _.startsWith('abc', 'a');
  31446. * // => true
  31447. *
  31448. * _.startsWith('abc', 'b');
  31449. * // => false
  31450. *
  31451. * _.startsWith('abc', 'b', 1);
  31452. * // => true
  31453. */
  31454. function startsWith(string, target, position) {
  31455. string = toString(string);
  31456. position = position == null
  31457. ? 0
  31458. : baseClamp(toInteger(position), 0, string.length);
  31459. target = baseToString(target);
  31460. return string.slice(position, position + target.length) == target;
  31461. }
  31462. /**
  31463. * Creates a compiled template function that can interpolate data properties
  31464. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31465. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31466. * properties may be accessed as free variables in the template. If a setting
  31467. * object is given, it takes precedence over `_.templateSettings` values.
  31468. *
  31469. * **Note:** In the development build `_.template` utilizes
  31470. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31471. * for easier debugging.
  31472. *
  31473. * For more information on precompiling templates see
  31474. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31475. *
  31476. * For more information on Chrome extension sandboxes see
  31477. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31478. *
  31479. * @static
  31480. * @since 0.1.0
  31481. * @memberOf _
  31482. * @category String
  31483. * @param {string} [string=''] The template string.
  31484. * @param {Object} [options={}] The options object.
  31485. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31486. * The HTML "escape" delimiter.
  31487. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31488. * The "evaluate" delimiter.
  31489. * @param {Object} [options.imports=_.templateSettings.imports]
  31490. * An object to import into the template as free variables.
  31491. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31492. * The "interpolate" delimiter.
  31493. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31494. * The sourceURL of the compiled template.
  31495. * @param {string} [options.variable='obj']
  31496. * The data object variable name.
  31497. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31498. * @returns {Function} Returns the compiled template function.
  31499. * @example
  31500. *
  31501. * // Use the "interpolate" delimiter to create a compiled template.
  31502. * var compiled = _.template('hello <%= user %>!');
  31503. * compiled({ 'user': 'fred' });
  31504. * // => 'hello fred!'
  31505. *
  31506. * // Use the HTML "escape" delimiter to escape data property values.
  31507. * var compiled = _.template('<b><%- value %></b>');
  31508. * compiled({ 'value': '<script>' });
  31509. * // => '<b>&lt;script&gt;</b>'
  31510. *
  31511. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31512. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31513. * compiled({ 'users': ['fred', 'barney'] });
  31514. * // => '<li>fred</li><li>barney</li>'
  31515. *
  31516. * // Use the internal `print` function in "evaluate" delimiters.
  31517. * var compiled = _.template('<% print("hello " + user); %>!');
  31518. * compiled({ 'user': 'barney' });
  31519. * // => 'hello barney!'
  31520. *
  31521. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31522. * // Disable support by replacing the "interpolate" delimiter.
  31523. * var compiled = _.template('hello ${ user }!');
  31524. * compiled({ 'user': 'pebbles' });
  31525. * // => 'hello pebbles!'
  31526. *
  31527. * // Use backslashes to treat delimiters as plain text.
  31528. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31529. * compiled({ 'value': 'ignored' });
  31530. * // => '<%- value %>'
  31531. *
  31532. * // Use the `imports` option to import `jQuery` as `jq`.
  31533. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31534. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31535. * compiled({ 'users': ['fred', 'barney'] });
  31536. * // => '<li>fred</li><li>barney</li>'
  31537. *
  31538. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31539. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31540. * compiled(data);
  31541. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31542. *
  31543. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31544. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31545. * compiled.source;
  31546. * // => function(data) {
  31547. * // var __t, __p = '';
  31548. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31549. * // return __p;
  31550. * // }
  31551. *
  31552. * // Use custom template delimiters.
  31553. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31554. * var compiled = _.template('hello {{ user }}!');
  31555. * compiled({ 'user': 'mustache' });
  31556. * // => 'hello mustache!'
  31557. *
  31558. * // Use the `source` property to inline compiled templates for meaningful
  31559. * // line numbers in error messages and stack traces.
  31560. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31561. * var JST = {\
  31562. * "main": ' + _.template(mainText).source + '\
  31563. * };\
  31564. * ');
  31565. */
  31566. function template(string, options, guard) {
  31567. // Based on John Resig's `tmpl` implementation
  31568. // (http://ejohn.org/blog/javascript-micro-templating/)
  31569. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31570. var settings = lodash.templateSettings;
  31571. if (guard && isIterateeCall(string, options, guard)) {
  31572. options = undefined;
  31573. }
  31574. string = toString(string);
  31575. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31576. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31577. importsKeys = keys(imports),
  31578. importsValues = baseValues(imports, importsKeys);
  31579. var isEscaping,
  31580. isEvaluating,
  31581. index = 0,
  31582. interpolate = options.interpolate || reNoMatch,
  31583. source = "__p += '";
  31584. // Compile the regexp to match each delimiter.
  31585. var reDelimiters = RegExp(
  31586. (options.escape || reNoMatch).source + '|' +
  31587. interpolate.source + '|' +
  31588. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31589. (options.evaluate || reNoMatch).source + '|$'
  31590. , 'g');
  31591. // Use a sourceURL for easier debugging.
  31592. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31593. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31594. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31595. var sourceURL = '//# sourceURL=' +
  31596. (hasOwnProperty.call(options, 'sourceURL')
  31597. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31598. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31599. ) + '\n';
  31600. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31601. interpolateValue || (interpolateValue = esTemplateValue);
  31602. // Escape characters that can't be included in string literals.
  31603. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31604. // Replace delimiters with snippets.
  31605. if (escapeValue) {
  31606. isEscaping = true;
  31607. source += "' +\n__e(" + escapeValue + ") +\n'";
  31608. }
  31609. if (evaluateValue) {
  31610. isEvaluating = true;
  31611. source += "';\n" + evaluateValue + ";\n__p += '";
  31612. }
  31613. if (interpolateValue) {
  31614. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31615. }
  31616. index = offset + match.length;
  31617. // The JS engine embedded in Adobe products needs `match` returned in
  31618. // order to produce the correct `offset` value.
  31619. return match;
  31620. });
  31621. source += "';\n";
  31622. // If `variable` is not specified wrap a with-statement around the generated
  31623. // code to add the data object to the top of the scope chain.
  31624. // Like with sourceURL, we take care to not check the option's prototype,
  31625. // as this configuration is a code injection vector.
  31626. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31627. if (!variable) {
  31628. source = 'with (obj) {\n' + source + '\n}\n';
  31629. }
  31630. // Cleanup code by stripping empty strings.
  31631. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31632. .replace(reEmptyStringMiddle, '$1')
  31633. .replace(reEmptyStringTrailing, '$1;');
  31634. // Frame code as the function body.
  31635. source = 'function(' + (variable || 'obj') + ') {\n' +
  31636. (variable
  31637. ? ''
  31638. : 'obj || (obj = {});\n'
  31639. ) +
  31640. "var __t, __p = ''" +
  31641. (isEscaping
  31642. ? ', __e = _.escape'
  31643. : ''
  31644. ) +
  31645. (isEvaluating
  31646. ? ', __j = Array.prototype.join;\n' +
  31647. "function print() { __p += __j.call(arguments, '') }\n"
  31648. : ';\n'
  31649. ) +
  31650. source +
  31651. 'return __p\n}';
  31652. var result = attempt(function() {
  31653. return Function(importsKeys, sourceURL + 'return ' + source)
  31654. .apply(undefined, importsValues);
  31655. });
  31656. // Provide the compiled function's source by its `toString` method or
  31657. // the `source` property as a convenience for inlining compiled templates.
  31658. result.source = source;
  31659. if (isError(result)) {
  31660. throw result;
  31661. }
  31662. return result;
  31663. }
  31664. /**
  31665. * Converts `string`, as a whole, to lower case just like
  31666. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31667. *
  31668. * @static
  31669. * @memberOf _
  31670. * @since 4.0.0
  31671. * @category String
  31672. * @param {string} [string=''] The string to convert.
  31673. * @returns {string} Returns the lower cased string.
  31674. * @example
  31675. *
  31676. * _.toLower('--Foo-Bar--');
  31677. * // => '--foo-bar--'
  31678. *
  31679. * _.toLower('fooBar');
  31680. * // => 'foobar'
  31681. *
  31682. * _.toLower('__FOO_BAR__');
  31683. * // => '__foo_bar__'
  31684. */
  31685. function toLower(value) {
  31686. return toString(value).toLowerCase();
  31687. }
  31688. /**
  31689. * Converts `string`, as a whole, to upper case just like
  31690. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31691. *
  31692. * @static
  31693. * @memberOf _
  31694. * @since 4.0.0
  31695. * @category String
  31696. * @param {string} [string=''] The string to convert.
  31697. * @returns {string} Returns the upper cased string.
  31698. * @example
  31699. *
  31700. * _.toUpper('--foo-bar--');
  31701. * // => '--FOO-BAR--'
  31702. *
  31703. * _.toUpper('fooBar');
  31704. * // => 'FOOBAR'
  31705. *
  31706. * _.toUpper('__foo_bar__');
  31707. * // => '__FOO_BAR__'
  31708. */
  31709. function toUpper(value) {
  31710. return toString(value).toUpperCase();
  31711. }
  31712. /**
  31713. * Removes leading and trailing whitespace or specified characters from `string`.
  31714. *
  31715. * @static
  31716. * @memberOf _
  31717. * @since 3.0.0
  31718. * @category String
  31719. * @param {string} [string=''] The string to trim.
  31720. * @param {string} [chars=whitespace] The characters to trim.
  31721. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31722. * @returns {string} Returns the trimmed string.
  31723. * @example
  31724. *
  31725. * _.trim(' abc ');
  31726. * // => 'abc'
  31727. *
  31728. * _.trim('-_-abc-_-', '_-');
  31729. * // => 'abc'
  31730. *
  31731. * _.map([' foo ', ' bar '], _.trim);
  31732. * // => ['foo', 'bar']
  31733. */
  31734. function trim(string, chars, guard) {
  31735. string = toString(string);
  31736. if (string && (guard || chars === undefined)) {
  31737. return string.replace(reTrim, '');
  31738. }
  31739. if (!string || !(chars = baseToString(chars))) {
  31740. return string;
  31741. }
  31742. var strSymbols = stringToArray(string),
  31743. chrSymbols = stringToArray(chars),
  31744. start = charsStartIndex(strSymbols, chrSymbols),
  31745. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  31746. return castSlice(strSymbols, start, end).join('');
  31747. }
  31748. /**
  31749. * Removes trailing whitespace or specified characters from `string`.
  31750. *
  31751. * @static
  31752. * @memberOf _
  31753. * @since 4.0.0
  31754. * @category String
  31755. * @param {string} [string=''] The string to trim.
  31756. * @param {string} [chars=whitespace] The characters to trim.
  31757. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31758. * @returns {string} Returns the trimmed string.
  31759. * @example
  31760. *
  31761. * _.trimEnd(' abc ');
  31762. * // => ' abc'
  31763. *
  31764. * _.trimEnd('-_-abc-_-', '_-');
  31765. * // => '-_-abc'
  31766. */
  31767. function trimEnd(string, chars, guard) {
  31768. string = toString(string);
  31769. if (string && (guard || chars === undefined)) {
  31770. return string.replace(reTrimEnd, '');
  31771. }
  31772. if (!string || !(chars = baseToString(chars))) {
  31773. return string;
  31774. }
  31775. var strSymbols = stringToArray(string),
  31776. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  31777. return castSlice(strSymbols, 0, end).join('');
  31778. }
  31779. /**
  31780. * Removes leading whitespace or specified characters from `string`.
  31781. *
  31782. * @static
  31783. * @memberOf _
  31784. * @since 4.0.0
  31785. * @category String
  31786. * @param {string} [string=''] The string to trim.
  31787. * @param {string} [chars=whitespace] The characters to trim.
  31788. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31789. * @returns {string} Returns the trimmed string.
  31790. * @example
  31791. *
  31792. * _.trimStart(' abc ');
  31793. * // => 'abc '
  31794. *
  31795. * _.trimStart('-_-abc-_-', '_-');
  31796. * // => 'abc-_-'
  31797. */
  31798. function trimStart(string, chars, guard) {
  31799. string = toString(string);
  31800. if (string && (guard || chars === undefined)) {
  31801. return string.replace(reTrimStart, '');
  31802. }
  31803. if (!string || !(chars = baseToString(chars))) {
  31804. return string;
  31805. }
  31806. var strSymbols = stringToArray(string),
  31807. start = charsStartIndex(strSymbols, stringToArray(chars));
  31808. return castSlice(strSymbols, start).join('');
  31809. }
  31810. /**
  31811. * Truncates `string` if it's longer than the given maximum string length.
  31812. * The last characters of the truncated string are replaced with the omission
  31813. * string which defaults to "...".
  31814. *
  31815. * @static
  31816. * @memberOf _
  31817. * @since 4.0.0
  31818. * @category String
  31819. * @param {string} [string=''] The string to truncate.
  31820. * @param {Object} [options={}] The options object.
  31821. * @param {number} [options.length=30] The maximum string length.
  31822. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  31823. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  31824. * @returns {string} Returns the truncated string.
  31825. * @example
  31826. *
  31827. * _.truncate('hi-diddly-ho there, neighborino');
  31828. * // => 'hi-diddly-ho there, neighbo...'
  31829. *
  31830. * _.truncate('hi-diddly-ho there, neighborino', {
  31831. * 'length': 24,
  31832. * 'separator': ' '
  31833. * });
  31834. * // => 'hi-diddly-ho there,...'
  31835. *
  31836. * _.truncate('hi-diddly-ho there, neighborino', {
  31837. * 'length': 24,
  31838. * 'separator': /,? +/
  31839. * });
  31840. * // => 'hi-diddly-ho there...'
  31841. *
  31842. * _.truncate('hi-diddly-ho there, neighborino', {
  31843. * 'omission': ' [...]'
  31844. * });
  31845. * // => 'hi-diddly-ho there, neig [...]'
  31846. */
  31847. function truncate(string, options) {
  31848. var length = DEFAULT_TRUNC_LENGTH,
  31849. omission = DEFAULT_TRUNC_OMISSION;
  31850. if (isObject(options)) {
  31851. var separator = 'separator' in options ? options.separator : separator;
  31852. length = 'length' in options ? toInteger(options.length) : length;
  31853. omission = 'omission' in options ? baseToString(options.omission) : omission;
  31854. }
  31855. string = toString(string);
  31856. var strLength = string.length;
  31857. if (hasUnicode(string)) {
  31858. var strSymbols = stringToArray(string);
  31859. strLength = strSymbols.length;
  31860. }
  31861. if (length >= strLength) {
  31862. return string;
  31863. }
  31864. var end = length - stringSize(omission);
  31865. if (end < 1) {
  31866. return omission;
  31867. }
  31868. var result = strSymbols
  31869. ? castSlice(strSymbols, 0, end).join('')
  31870. : string.slice(0, end);
  31871. if (separator === undefined) {
  31872. return result + omission;
  31873. }
  31874. if (strSymbols) {
  31875. end += (result.length - end);
  31876. }
  31877. if (isRegExp(separator)) {
  31878. if (string.slice(end).search(separator)) {
  31879. var match,
  31880. substring = result;
  31881. if (!separator.global) {
  31882. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  31883. }
  31884. separator.lastIndex = 0;
  31885. while ((match = separator.exec(substring))) {
  31886. var newEnd = match.index;
  31887. }
  31888. result = result.slice(0, newEnd === undefined ? end : newEnd);
  31889. }
  31890. } else if (string.indexOf(baseToString(separator), end) != end) {
  31891. var index = result.lastIndexOf(separator);
  31892. if (index > -1) {
  31893. result = result.slice(0, index);
  31894. }
  31895. }
  31896. return result + omission;
  31897. }
  31898. /**
  31899. * The inverse of `_.escape`; this method converts the HTML entities
  31900. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  31901. * their corresponding characters.
  31902. *
  31903. * **Note:** No other HTML entities are unescaped. To unescape additional
  31904. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  31905. *
  31906. * @static
  31907. * @memberOf _
  31908. * @since 0.6.0
  31909. * @category String
  31910. * @param {string} [string=''] The string to unescape.
  31911. * @returns {string} Returns the unescaped string.
  31912. * @example
  31913. *
  31914. * _.unescape('fred, barney, &amp; pebbles');
  31915. * // => 'fred, barney, & pebbles'
  31916. */
  31917. function unescape(string) {
  31918. string = toString(string);
  31919. return (string && reHasEscapedHtml.test(string))
  31920. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  31921. : string;
  31922. }
  31923. /**
  31924. * Converts `string`, as space separated words, to upper case.
  31925. *
  31926. * @static
  31927. * @memberOf _
  31928. * @since 4.0.0
  31929. * @category String
  31930. * @param {string} [string=''] The string to convert.
  31931. * @returns {string} Returns the upper cased string.
  31932. * @example
  31933. *
  31934. * _.upperCase('--foo-bar');
  31935. * // => 'FOO BAR'
  31936. *
  31937. * _.upperCase('fooBar');
  31938. * // => 'FOO BAR'
  31939. *
  31940. * _.upperCase('__foo_bar__');
  31941. * // => 'FOO BAR'
  31942. */
  31943. var upperCase = createCompounder(function(result, word, index) {
  31944. return result + (index ? ' ' : '') + word.toUpperCase();
  31945. });
  31946. /**
  31947. * Converts the first character of `string` to upper case.
  31948. *
  31949. * @static
  31950. * @memberOf _
  31951. * @since 4.0.0
  31952. * @category String
  31953. * @param {string} [string=''] The string to convert.
  31954. * @returns {string} Returns the converted string.
  31955. * @example
  31956. *
  31957. * _.upperFirst('fred');
  31958. * // => 'Fred'
  31959. *
  31960. * _.upperFirst('FRED');
  31961. * // => 'FRED'
  31962. */
  31963. var upperFirst = createCaseFirst('toUpperCase');
  31964. /**
  31965. * Splits `string` into an array of its words.
  31966. *
  31967. * @static
  31968. * @memberOf _
  31969. * @since 3.0.0
  31970. * @category String
  31971. * @param {string} [string=''] The string to inspect.
  31972. * @param {RegExp|string} [pattern] The pattern to match words.
  31973. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31974. * @returns {Array} Returns the words of `string`.
  31975. * @example
  31976. *
  31977. * _.words('fred, barney, & pebbles');
  31978. * // => ['fred', 'barney', 'pebbles']
  31979. *
  31980. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  31981. * // => ['fred', 'barney', '&', 'pebbles']
  31982. */
  31983. function words(string, pattern, guard) {
  31984. string = toString(string);
  31985. pattern = guard ? undefined : pattern;
  31986. if (pattern === undefined) {
  31987. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  31988. }
  31989. return string.match(pattern) || [];
  31990. }
  31991. /*------------------------------------------------------------------------*/
  31992. /**
  31993. * Attempts to invoke `func`, returning either the result or the caught error
  31994. * object. Any additional arguments are provided to `func` when it's invoked.
  31995. *
  31996. * @static
  31997. * @memberOf _
  31998. * @since 3.0.0
  31999. * @category Util
  32000. * @param {Function} func The function to attempt.
  32001. * @param {...*} [args] The arguments to invoke `func` with.
  32002. * @returns {*} Returns the `func` result or error object.
  32003. * @example
  32004. *
  32005. * // Avoid throwing errors for invalid selectors.
  32006. * var elements = _.attempt(function(selector) {
  32007. * return document.querySelectorAll(selector);
  32008. * }, '>_>');
  32009. *
  32010. * if (_.isError(elements)) {
  32011. * elements = [];
  32012. * }
  32013. */
  32014. var attempt = baseRest(function(func, args) {
  32015. try {
  32016. return apply(func, undefined, args);
  32017. } catch (e) {
  32018. return isError(e) ? e : new Error(e);
  32019. }
  32020. });
  32021. /**
  32022. * Binds methods of an object to the object itself, overwriting the existing
  32023. * method.
  32024. *
  32025. * **Note:** This method doesn't set the "length" property of bound functions.
  32026. *
  32027. * @static
  32028. * @since 0.1.0
  32029. * @memberOf _
  32030. * @category Util
  32031. * @param {Object} object The object to bind and assign the bound methods to.
  32032. * @param {...(string|string[])} methodNames The object method names to bind.
  32033. * @returns {Object} Returns `object`.
  32034. * @example
  32035. *
  32036. * var view = {
  32037. * 'label': 'docs',
  32038. * 'click': function() {
  32039. * console.log('clicked ' + this.label);
  32040. * }
  32041. * };
  32042. *
  32043. * _.bindAll(view, ['click']);
  32044. * jQuery(element).on('click', view.click);
  32045. * // => Logs 'clicked docs' when clicked.
  32046. */
  32047. var bindAll = flatRest(function(object, methodNames) {
  32048. arrayEach(methodNames, function(key) {
  32049. key = toKey(key);
  32050. baseAssignValue(object, key, bind(object[key], object));
  32051. });
  32052. return object;
  32053. });
  32054. /**
  32055. * Creates a function that iterates over `pairs` and invokes the corresponding
  32056. * function of the first predicate to return truthy. The predicate-function
  32057. * pairs are invoked with the `this` binding and arguments of the created
  32058. * function.
  32059. *
  32060. * @static
  32061. * @memberOf _
  32062. * @since 4.0.0
  32063. * @category Util
  32064. * @param {Array} pairs The predicate-function pairs.
  32065. * @returns {Function} Returns the new composite function.
  32066. * @example
  32067. *
  32068. * var func = _.cond([
  32069. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32070. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32071. * [_.stubTrue, _.constant('no match')]
  32072. * ]);
  32073. *
  32074. * func({ 'a': 1, 'b': 2 });
  32075. * // => 'matches A'
  32076. *
  32077. * func({ 'a': 0, 'b': 1 });
  32078. * // => 'matches B'
  32079. *
  32080. * func({ 'a': '1', 'b': '2' });
  32081. * // => 'no match'
  32082. */
  32083. function cond(pairs) {
  32084. var length = pairs == null ? 0 : pairs.length,
  32085. toIteratee = getIteratee();
  32086. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32087. if (typeof pair[1] != 'function') {
  32088. throw new TypeError(FUNC_ERROR_TEXT);
  32089. }
  32090. return [toIteratee(pair[0]), pair[1]];
  32091. });
  32092. return baseRest(function(args) {
  32093. var index = -1;
  32094. while (++index < length) {
  32095. var pair = pairs[index];
  32096. if (apply(pair[0], this, args)) {
  32097. return apply(pair[1], this, args);
  32098. }
  32099. }
  32100. });
  32101. }
  32102. /**
  32103. * Creates a function that invokes the predicate properties of `source` with
  32104. * the corresponding property values of a given object, returning `true` if
  32105. * all predicates return truthy, else `false`.
  32106. *
  32107. * **Note:** The created function is equivalent to `_.conformsTo` with
  32108. * `source` partially applied.
  32109. *
  32110. * @static
  32111. * @memberOf _
  32112. * @since 4.0.0
  32113. * @category Util
  32114. * @param {Object} source The object of property predicates to conform to.
  32115. * @returns {Function} Returns the new spec function.
  32116. * @example
  32117. *
  32118. * var objects = [
  32119. * { 'a': 2, 'b': 1 },
  32120. * { 'a': 1, 'b': 2 }
  32121. * ];
  32122. *
  32123. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32124. * // => [{ 'a': 1, 'b': 2 }]
  32125. */
  32126. function conforms(source) {
  32127. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32128. }
  32129. /**
  32130. * Creates a function that returns `value`.
  32131. *
  32132. * @static
  32133. * @memberOf _
  32134. * @since 2.4.0
  32135. * @category Util
  32136. * @param {*} value The value to return from the new function.
  32137. * @returns {Function} Returns the new constant function.
  32138. * @example
  32139. *
  32140. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32141. *
  32142. * console.log(objects);
  32143. * // => [{ 'a': 1 }, { 'a': 1 }]
  32144. *
  32145. * console.log(objects[0] === objects[1]);
  32146. * // => true
  32147. */
  32148. function constant(value) {
  32149. return function() {
  32150. return value;
  32151. };
  32152. }
  32153. /**
  32154. * Checks `value` to determine whether a default value should be returned in
  32155. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32156. * or `undefined`.
  32157. *
  32158. * @static
  32159. * @memberOf _
  32160. * @since 4.14.0
  32161. * @category Util
  32162. * @param {*} value The value to check.
  32163. * @param {*} defaultValue The default value.
  32164. * @returns {*} Returns the resolved value.
  32165. * @example
  32166. *
  32167. * _.defaultTo(1, 10);
  32168. * // => 1
  32169. *
  32170. * _.defaultTo(undefined, 10);
  32171. * // => 10
  32172. */
  32173. function defaultTo(value, defaultValue) {
  32174. return (value == null || value !== value) ? defaultValue : value;
  32175. }
  32176. /**
  32177. * Creates a function that returns the result of invoking the given functions
  32178. * with the `this` binding of the created function, where each successive
  32179. * invocation is supplied the return value of the previous.
  32180. *
  32181. * @static
  32182. * @memberOf _
  32183. * @since 3.0.0
  32184. * @category Util
  32185. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32186. * @returns {Function} Returns the new composite function.
  32187. * @see _.flowRight
  32188. * @example
  32189. *
  32190. * function square(n) {
  32191. * return n * n;
  32192. * }
  32193. *
  32194. * var addSquare = _.flow([_.add, square]);
  32195. * addSquare(1, 2);
  32196. * // => 9
  32197. */
  32198. var flow = createFlow();
  32199. /**
  32200. * This method is like `_.flow` except that it creates a function that
  32201. * invokes the given functions from right to left.
  32202. *
  32203. * @static
  32204. * @since 3.0.0
  32205. * @memberOf _
  32206. * @category Util
  32207. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32208. * @returns {Function} Returns the new composite function.
  32209. * @see _.flow
  32210. * @example
  32211. *
  32212. * function square(n) {
  32213. * return n * n;
  32214. * }
  32215. *
  32216. * var addSquare = _.flowRight([square, _.add]);
  32217. * addSquare(1, 2);
  32218. * // => 9
  32219. */
  32220. var flowRight = createFlow(true);
  32221. /**
  32222. * This method returns the first argument it receives.
  32223. *
  32224. * @static
  32225. * @since 0.1.0
  32226. * @memberOf _
  32227. * @category Util
  32228. * @param {*} value Any value.
  32229. * @returns {*} Returns `value`.
  32230. * @example
  32231. *
  32232. * var object = { 'a': 1 };
  32233. *
  32234. * console.log(_.identity(object) === object);
  32235. * // => true
  32236. */
  32237. function identity(value) {
  32238. return value;
  32239. }
  32240. /**
  32241. * Creates a function that invokes `func` with the arguments of the created
  32242. * function. If `func` is a property name, the created function returns the
  32243. * property value for a given element. If `func` is an array or object, the
  32244. * created function returns `true` for elements that contain the equivalent
  32245. * source properties, otherwise it returns `false`.
  32246. *
  32247. * @static
  32248. * @since 4.0.0
  32249. * @memberOf _
  32250. * @category Util
  32251. * @param {*} [func=_.identity] The value to convert to a callback.
  32252. * @returns {Function} Returns the callback.
  32253. * @example
  32254. *
  32255. * var users = [
  32256. * { 'user': 'barney', 'age': 36, 'active': true },
  32257. * { 'user': 'fred', 'age': 40, 'active': false }
  32258. * ];
  32259. *
  32260. * // The `_.matches` iteratee shorthand.
  32261. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32262. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32263. *
  32264. * // The `_.matchesProperty` iteratee shorthand.
  32265. * _.filter(users, _.iteratee(['user', 'fred']));
  32266. * // => [{ 'user': 'fred', 'age': 40 }]
  32267. *
  32268. * // The `_.property` iteratee shorthand.
  32269. * _.map(users, _.iteratee('user'));
  32270. * // => ['barney', 'fred']
  32271. *
  32272. * // Create custom iteratee shorthands.
  32273. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32274. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32275. * return func.test(string);
  32276. * };
  32277. * });
  32278. *
  32279. * _.filter(['abc', 'def'], /ef/);
  32280. * // => ['def']
  32281. */
  32282. function iteratee(func) {
  32283. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32284. }
  32285. /**
  32286. * Creates a function that performs a partial deep comparison between a given
  32287. * object and `source`, returning `true` if the given object has equivalent
  32288. * property values, else `false`.
  32289. *
  32290. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32291. * partially applied.
  32292. *
  32293. * Partial comparisons will match empty array and empty object `source`
  32294. * values against any array or object value, respectively. See `_.isEqual`
  32295. * for a list of supported value comparisons.
  32296. *
  32297. * @static
  32298. * @memberOf _
  32299. * @since 3.0.0
  32300. * @category Util
  32301. * @param {Object} source The object of property values to match.
  32302. * @returns {Function} Returns the new spec function.
  32303. * @example
  32304. *
  32305. * var objects = [
  32306. * { 'a': 1, 'b': 2, 'c': 3 },
  32307. * { 'a': 4, 'b': 5, 'c': 6 }
  32308. * ];
  32309. *
  32310. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32311. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32312. */
  32313. function matches(source) {
  32314. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32315. }
  32316. /**
  32317. * Creates a function that performs a partial deep comparison between the
  32318. * value at `path` of a given object to `srcValue`, returning `true` if the
  32319. * object value is equivalent, else `false`.
  32320. *
  32321. * **Note:** Partial comparisons will match empty array and empty object
  32322. * `srcValue` values against any array or object value, respectively. See
  32323. * `_.isEqual` for a list of supported value comparisons.
  32324. *
  32325. * @static
  32326. * @memberOf _
  32327. * @since 3.2.0
  32328. * @category Util
  32329. * @param {Array|string} path The path of the property to get.
  32330. * @param {*} srcValue The value to match.
  32331. * @returns {Function} Returns the new spec function.
  32332. * @example
  32333. *
  32334. * var objects = [
  32335. * { 'a': 1, 'b': 2, 'c': 3 },
  32336. * { 'a': 4, 'b': 5, 'c': 6 }
  32337. * ];
  32338. *
  32339. * _.find(objects, _.matchesProperty('a', 4));
  32340. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32341. */
  32342. function matchesProperty(path, srcValue) {
  32343. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32344. }
  32345. /**
  32346. * Creates a function that invokes the method at `path` of a given object.
  32347. * Any additional arguments are provided to the invoked method.
  32348. *
  32349. * @static
  32350. * @memberOf _
  32351. * @since 3.7.0
  32352. * @category Util
  32353. * @param {Array|string} path The path of the method to invoke.
  32354. * @param {...*} [args] The arguments to invoke the method with.
  32355. * @returns {Function} Returns the new invoker function.
  32356. * @example
  32357. *
  32358. * var objects = [
  32359. * { 'a': { 'b': _.constant(2) } },
  32360. * { 'a': { 'b': _.constant(1) } }
  32361. * ];
  32362. *
  32363. * _.map(objects, _.method('a.b'));
  32364. * // => [2, 1]
  32365. *
  32366. * _.map(objects, _.method(['a', 'b']));
  32367. * // => [2, 1]
  32368. */
  32369. var method = baseRest(function(path, args) {
  32370. return function(object) {
  32371. return baseInvoke(object, path, args);
  32372. };
  32373. });
  32374. /**
  32375. * The opposite of `_.method`; this method creates a function that invokes
  32376. * the method at a given path of `object`. Any additional arguments are
  32377. * provided to the invoked method.
  32378. *
  32379. * @static
  32380. * @memberOf _
  32381. * @since 3.7.0
  32382. * @category Util
  32383. * @param {Object} object The object to query.
  32384. * @param {...*} [args] The arguments to invoke the method with.
  32385. * @returns {Function} Returns the new invoker function.
  32386. * @example
  32387. *
  32388. * var array = _.times(3, _.constant),
  32389. * object = { 'a': array, 'b': array, 'c': array };
  32390. *
  32391. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32392. * // => [2, 0]
  32393. *
  32394. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32395. * // => [2, 0]
  32396. */
  32397. var methodOf = baseRest(function(object, args) {
  32398. return function(path) {
  32399. return baseInvoke(object, path, args);
  32400. };
  32401. });
  32402. /**
  32403. * Adds all own enumerable string keyed function properties of a source
  32404. * object to the destination object. If `object` is a function, then methods
  32405. * are added to its prototype as well.
  32406. *
  32407. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32408. * avoid conflicts caused by modifying the original.
  32409. *
  32410. * @static
  32411. * @since 0.1.0
  32412. * @memberOf _
  32413. * @category Util
  32414. * @param {Function|Object} [object=lodash] The destination object.
  32415. * @param {Object} source The object of functions to add.
  32416. * @param {Object} [options={}] The options object.
  32417. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32418. * @returns {Function|Object} Returns `object`.
  32419. * @example
  32420. *
  32421. * function vowels(string) {
  32422. * return _.filter(string, function(v) {
  32423. * return /[aeiou]/i.test(v);
  32424. * });
  32425. * }
  32426. *
  32427. * _.mixin({ 'vowels': vowels });
  32428. * _.vowels('fred');
  32429. * // => ['e']
  32430. *
  32431. * _('fred').vowels().value();
  32432. * // => ['e']
  32433. *
  32434. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32435. * _('fred').vowels();
  32436. * // => ['e']
  32437. */
  32438. function mixin(object, source, options) {
  32439. var props = keys(source),
  32440. methodNames = baseFunctions(source, props);
  32441. if (options == null &&
  32442. !(isObject(source) && (methodNames.length || !props.length))) {
  32443. options = source;
  32444. source = object;
  32445. object = this;
  32446. methodNames = baseFunctions(source, keys(source));
  32447. }
  32448. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32449. isFunc = isFunction(object);
  32450. arrayEach(methodNames, function(methodName) {
  32451. var func = source[methodName];
  32452. object[methodName] = func;
  32453. if (isFunc) {
  32454. object.prototype[methodName] = function() {
  32455. var chainAll = this.__chain__;
  32456. if (chain || chainAll) {
  32457. var result = object(this.__wrapped__),
  32458. actions = result.__actions__ = copyArray(this.__actions__);
  32459. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32460. result.__chain__ = chainAll;
  32461. return result;
  32462. }
  32463. return func.apply(object, arrayPush([this.value()], arguments));
  32464. };
  32465. }
  32466. });
  32467. return object;
  32468. }
  32469. /**
  32470. * Reverts the `_` variable to its previous value and returns a reference to
  32471. * the `lodash` function.
  32472. *
  32473. * @static
  32474. * @since 0.1.0
  32475. * @memberOf _
  32476. * @category Util
  32477. * @returns {Function} Returns the `lodash` function.
  32478. * @example
  32479. *
  32480. * var lodash = _.noConflict();
  32481. */
  32482. function noConflict() {
  32483. if (root._ === this) {
  32484. root._ = oldDash;
  32485. }
  32486. return this;
  32487. }
  32488. /**
  32489. * This method returns `undefined`.
  32490. *
  32491. * @static
  32492. * @memberOf _
  32493. * @since 2.3.0
  32494. * @category Util
  32495. * @example
  32496. *
  32497. * _.times(2, _.noop);
  32498. * // => [undefined, undefined]
  32499. */
  32500. function noop() {
  32501. // No operation performed.
  32502. }
  32503. /**
  32504. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32505. * the nth argument from the end is returned.
  32506. *
  32507. * @static
  32508. * @memberOf _
  32509. * @since 4.0.0
  32510. * @category Util
  32511. * @param {number} [n=0] The index of the argument to return.
  32512. * @returns {Function} Returns the new pass-thru function.
  32513. * @example
  32514. *
  32515. * var func = _.nthArg(1);
  32516. * func('a', 'b', 'c', 'd');
  32517. * // => 'b'
  32518. *
  32519. * var func = _.nthArg(-2);
  32520. * func('a', 'b', 'c', 'd');
  32521. * // => 'c'
  32522. */
  32523. function nthArg(n) {
  32524. n = toInteger(n);
  32525. return baseRest(function(args) {
  32526. return baseNth(args, n);
  32527. });
  32528. }
  32529. /**
  32530. * Creates a function that invokes `iteratees` with the arguments it receives
  32531. * and returns their results.
  32532. *
  32533. * @static
  32534. * @memberOf _
  32535. * @since 4.0.0
  32536. * @category Util
  32537. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32538. * The iteratees to invoke.
  32539. * @returns {Function} Returns the new function.
  32540. * @example
  32541. *
  32542. * var func = _.over([Math.max, Math.min]);
  32543. *
  32544. * func(1, 2, 3, 4);
  32545. * // => [4, 1]
  32546. */
  32547. var over = createOver(arrayMap);
  32548. /**
  32549. * Creates a function that checks if **all** of the `predicates` return
  32550. * truthy when invoked with the arguments it receives.
  32551. *
  32552. * @static
  32553. * @memberOf _
  32554. * @since 4.0.0
  32555. * @category Util
  32556. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32557. * The predicates to check.
  32558. * @returns {Function} Returns the new function.
  32559. * @example
  32560. *
  32561. * var func = _.overEvery([Boolean, isFinite]);
  32562. *
  32563. * func('1');
  32564. * // => true
  32565. *
  32566. * func(null);
  32567. * // => false
  32568. *
  32569. * func(NaN);
  32570. * // => false
  32571. */
  32572. var overEvery = createOver(arrayEvery);
  32573. /**
  32574. * Creates a function that checks if **any** of the `predicates` return
  32575. * truthy when invoked with the arguments it receives.
  32576. *
  32577. * @static
  32578. * @memberOf _
  32579. * @since 4.0.0
  32580. * @category Util
  32581. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32582. * The predicates to check.
  32583. * @returns {Function} Returns the new function.
  32584. * @example
  32585. *
  32586. * var func = _.overSome([Boolean, isFinite]);
  32587. *
  32588. * func('1');
  32589. * // => true
  32590. *
  32591. * func(null);
  32592. * // => true
  32593. *
  32594. * func(NaN);
  32595. * // => false
  32596. */
  32597. var overSome = createOver(arraySome);
  32598. /**
  32599. * Creates a function that returns the value at `path` of a given object.
  32600. *
  32601. * @static
  32602. * @memberOf _
  32603. * @since 2.4.0
  32604. * @category Util
  32605. * @param {Array|string} path The path of the property to get.
  32606. * @returns {Function} Returns the new accessor function.
  32607. * @example
  32608. *
  32609. * var objects = [
  32610. * { 'a': { 'b': 2 } },
  32611. * { 'a': { 'b': 1 } }
  32612. * ];
  32613. *
  32614. * _.map(objects, _.property('a.b'));
  32615. * // => [2, 1]
  32616. *
  32617. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32618. * // => [1, 2]
  32619. */
  32620. function property(path) {
  32621. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32622. }
  32623. /**
  32624. * The opposite of `_.property`; this method creates a function that returns
  32625. * the value at a given path of `object`.
  32626. *
  32627. * @static
  32628. * @memberOf _
  32629. * @since 3.0.0
  32630. * @category Util
  32631. * @param {Object} object The object to query.
  32632. * @returns {Function} Returns the new accessor function.
  32633. * @example
  32634. *
  32635. * var array = [0, 1, 2],
  32636. * object = { 'a': array, 'b': array, 'c': array };
  32637. *
  32638. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32639. * // => [2, 0]
  32640. *
  32641. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32642. * // => [2, 0]
  32643. */
  32644. function propertyOf(object) {
  32645. return function(path) {
  32646. return object == null ? undefined : baseGet(object, path);
  32647. };
  32648. }
  32649. /**
  32650. * Creates an array of numbers (positive and/or negative) progressing from
  32651. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32652. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32653. * it's set to `start` with `start` then set to `0`.
  32654. *
  32655. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32656. * floating-point values which can produce unexpected results.
  32657. *
  32658. * @static
  32659. * @since 0.1.0
  32660. * @memberOf _
  32661. * @category Util
  32662. * @param {number} [start=0] The start of the range.
  32663. * @param {number} end The end of the range.
  32664. * @param {number} [step=1] The value to increment or decrement by.
  32665. * @returns {Array} Returns the range of numbers.
  32666. * @see _.inRange, _.rangeRight
  32667. * @example
  32668. *
  32669. * _.range(4);
  32670. * // => [0, 1, 2, 3]
  32671. *
  32672. * _.range(-4);
  32673. * // => [0, -1, -2, -3]
  32674. *
  32675. * _.range(1, 5);
  32676. * // => [1, 2, 3, 4]
  32677. *
  32678. * _.range(0, 20, 5);
  32679. * // => [0, 5, 10, 15]
  32680. *
  32681. * _.range(0, -4, -1);
  32682. * // => [0, -1, -2, -3]
  32683. *
  32684. * _.range(1, 4, 0);
  32685. * // => [1, 1, 1]
  32686. *
  32687. * _.range(0);
  32688. * // => []
  32689. */
  32690. var range = createRange();
  32691. /**
  32692. * This method is like `_.range` except that it populates values in
  32693. * descending order.
  32694. *
  32695. * @static
  32696. * @memberOf _
  32697. * @since 4.0.0
  32698. * @category Util
  32699. * @param {number} [start=0] The start of the range.
  32700. * @param {number} end The end of the range.
  32701. * @param {number} [step=1] The value to increment or decrement by.
  32702. * @returns {Array} Returns the range of numbers.
  32703. * @see _.inRange, _.range
  32704. * @example
  32705. *
  32706. * _.rangeRight(4);
  32707. * // => [3, 2, 1, 0]
  32708. *
  32709. * _.rangeRight(-4);
  32710. * // => [-3, -2, -1, 0]
  32711. *
  32712. * _.rangeRight(1, 5);
  32713. * // => [4, 3, 2, 1]
  32714. *
  32715. * _.rangeRight(0, 20, 5);
  32716. * // => [15, 10, 5, 0]
  32717. *
  32718. * _.rangeRight(0, -4, -1);
  32719. * // => [-3, -2, -1, 0]
  32720. *
  32721. * _.rangeRight(1, 4, 0);
  32722. * // => [1, 1, 1]
  32723. *
  32724. * _.rangeRight(0);
  32725. * // => []
  32726. */
  32727. var rangeRight = createRange(true);
  32728. /**
  32729. * This method returns a new empty array.
  32730. *
  32731. * @static
  32732. * @memberOf _
  32733. * @since 4.13.0
  32734. * @category Util
  32735. * @returns {Array} Returns the new empty array.
  32736. * @example
  32737. *
  32738. * var arrays = _.times(2, _.stubArray);
  32739. *
  32740. * console.log(arrays);
  32741. * // => [[], []]
  32742. *
  32743. * console.log(arrays[0] === arrays[1]);
  32744. * // => false
  32745. */
  32746. function stubArray() {
  32747. return [];
  32748. }
  32749. /**
  32750. * This method returns `false`.
  32751. *
  32752. * @static
  32753. * @memberOf _
  32754. * @since 4.13.0
  32755. * @category Util
  32756. * @returns {boolean} Returns `false`.
  32757. * @example
  32758. *
  32759. * _.times(2, _.stubFalse);
  32760. * // => [false, false]
  32761. */
  32762. function stubFalse() {
  32763. return false;
  32764. }
  32765. /**
  32766. * This method returns a new empty object.
  32767. *
  32768. * @static
  32769. * @memberOf _
  32770. * @since 4.13.0
  32771. * @category Util
  32772. * @returns {Object} Returns the new empty object.
  32773. * @example
  32774. *
  32775. * var objects = _.times(2, _.stubObject);
  32776. *
  32777. * console.log(objects);
  32778. * // => [{}, {}]
  32779. *
  32780. * console.log(objects[0] === objects[1]);
  32781. * // => false
  32782. */
  32783. function stubObject() {
  32784. return {};
  32785. }
  32786. /**
  32787. * This method returns an empty string.
  32788. *
  32789. * @static
  32790. * @memberOf _
  32791. * @since 4.13.0
  32792. * @category Util
  32793. * @returns {string} Returns the empty string.
  32794. * @example
  32795. *
  32796. * _.times(2, _.stubString);
  32797. * // => ['', '']
  32798. */
  32799. function stubString() {
  32800. return '';
  32801. }
  32802. /**
  32803. * This method returns `true`.
  32804. *
  32805. * @static
  32806. * @memberOf _
  32807. * @since 4.13.0
  32808. * @category Util
  32809. * @returns {boolean} Returns `true`.
  32810. * @example
  32811. *
  32812. * _.times(2, _.stubTrue);
  32813. * // => [true, true]
  32814. */
  32815. function stubTrue() {
  32816. return true;
  32817. }
  32818. /**
  32819. * Invokes the iteratee `n` times, returning an array of the results of
  32820. * each invocation. The iteratee is invoked with one argument; (index).
  32821. *
  32822. * @static
  32823. * @since 0.1.0
  32824. * @memberOf _
  32825. * @category Util
  32826. * @param {number} n The number of times to invoke `iteratee`.
  32827. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32828. * @returns {Array} Returns the array of results.
  32829. * @example
  32830. *
  32831. * _.times(3, String);
  32832. * // => ['0', '1', '2']
  32833. *
  32834. * _.times(4, _.constant(0));
  32835. * // => [0, 0, 0, 0]
  32836. */
  32837. function times(n, iteratee) {
  32838. n = toInteger(n);
  32839. if (n < 1 || n > MAX_SAFE_INTEGER) {
  32840. return [];
  32841. }
  32842. var index = MAX_ARRAY_LENGTH,
  32843. length = nativeMin(n, MAX_ARRAY_LENGTH);
  32844. iteratee = getIteratee(iteratee);
  32845. n -= MAX_ARRAY_LENGTH;
  32846. var result = baseTimes(length, iteratee);
  32847. while (++index < n) {
  32848. iteratee(index);
  32849. }
  32850. return result;
  32851. }
  32852. /**
  32853. * Converts `value` to a property path array.
  32854. *
  32855. * @static
  32856. * @memberOf _
  32857. * @since 4.0.0
  32858. * @category Util
  32859. * @param {*} value The value to convert.
  32860. * @returns {Array} Returns the new property path array.
  32861. * @example
  32862. *
  32863. * _.toPath('a.b.c');
  32864. * // => ['a', 'b', 'c']
  32865. *
  32866. * _.toPath('a[0].b.c');
  32867. * // => ['a', '0', 'b', 'c']
  32868. */
  32869. function toPath(value) {
  32870. if (isArray(value)) {
  32871. return arrayMap(value, toKey);
  32872. }
  32873. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  32874. }
  32875. /**
  32876. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  32877. *
  32878. * @static
  32879. * @since 0.1.0
  32880. * @memberOf _
  32881. * @category Util
  32882. * @param {string} [prefix=''] The value to prefix the ID with.
  32883. * @returns {string} Returns the unique ID.
  32884. * @example
  32885. *
  32886. * _.uniqueId('contact_');
  32887. * // => 'contact_104'
  32888. *
  32889. * _.uniqueId();
  32890. * // => '105'
  32891. */
  32892. function uniqueId(prefix) {
  32893. var id = ++idCounter;
  32894. return toString(prefix) + id;
  32895. }
  32896. /*------------------------------------------------------------------------*/
  32897. /**
  32898. * Adds two numbers.
  32899. *
  32900. * @static
  32901. * @memberOf _
  32902. * @since 3.4.0
  32903. * @category Math
  32904. * @param {number} augend The first number in an addition.
  32905. * @param {number} addend The second number in an addition.
  32906. * @returns {number} Returns the total.
  32907. * @example
  32908. *
  32909. * _.add(6, 4);
  32910. * // => 10
  32911. */
  32912. var add = createMathOperation(function(augend, addend) {
  32913. return augend + addend;
  32914. }, 0);
  32915. /**
  32916. * Computes `number` rounded up to `precision`.
  32917. *
  32918. * @static
  32919. * @memberOf _
  32920. * @since 3.10.0
  32921. * @category Math
  32922. * @param {number} number The number to round up.
  32923. * @param {number} [precision=0] The precision to round up to.
  32924. * @returns {number} Returns the rounded up number.
  32925. * @example
  32926. *
  32927. * _.ceil(4.006);
  32928. * // => 5
  32929. *
  32930. * _.ceil(6.004, 2);
  32931. * // => 6.01
  32932. *
  32933. * _.ceil(6040, -2);
  32934. * // => 6100
  32935. */
  32936. var ceil = createRound('ceil');
  32937. /**
  32938. * Divide two numbers.
  32939. *
  32940. * @static
  32941. * @memberOf _
  32942. * @since 4.7.0
  32943. * @category Math
  32944. * @param {number} dividend The first number in a division.
  32945. * @param {number} divisor The second number in a division.
  32946. * @returns {number} Returns the quotient.
  32947. * @example
  32948. *
  32949. * _.divide(6, 4);
  32950. * // => 1.5
  32951. */
  32952. var divide = createMathOperation(function(dividend, divisor) {
  32953. return dividend / divisor;
  32954. }, 1);
  32955. /**
  32956. * Computes `number` rounded down to `precision`.
  32957. *
  32958. * @static
  32959. * @memberOf _
  32960. * @since 3.10.0
  32961. * @category Math
  32962. * @param {number} number The number to round down.
  32963. * @param {number} [precision=0] The precision to round down to.
  32964. * @returns {number} Returns the rounded down number.
  32965. * @example
  32966. *
  32967. * _.floor(4.006);
  32968. * // => 4
  32969. *
  32970. * _.floor(0.046, 2);
  32971. * // => 0.04
  32972. *
  32973. * _.floor(4060, -2);
  32974. * // => 4000
  32975. */
  32976. var floor = createRound('floor');
  32977. /**
  32978. * Computes the maximum value of `array`. If `array` is empty or falsey,
  32979. * `undefined` is returned.
  32980. *
  32981. * @static
  32982. * @since 0.1.0
  32983. * @memberOf _
  32984. * @category Math
  32985. * @param {Array} array The array to iterate over.
  32986. * @returns {*} Returns the maximum value.
  32987. * @example
  32988. *
  32989. * _.max([4, 2, 8, 6]);
  32990. * // => 8
  32991. *
  32992. * _.max([]);
  32993. * // => undefined
  32994. */
  32995. function max(array) {
  32996. return (array && array.length)
  32997. ? baseExtremum(array, identity, baseGt)
  32998. : undefined;
  32999. }
  33000. /**
  33001. * This method is like `_.max` except that it accepts `iteratee` which is
  33002. * invoked for each element in `array` to generate the criterion by which
  33003. * the value is ranked. The iteratee is invoked with one argument: (value).
  33004. *
  33005. * @static
  33006. * @memberOf _
  33007. * @since 4.0.0
  33008. * @category Math
  33009. * @param {Array} array The array to iterate over.
  33010. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33011. * @returns {*} Returns the maximum value.
  33012. * @example
  33013. *
  33014. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33015. *
  33016. * _.maxBy(objects, function(o) { return o.n; });
  33017. * // => { 'n': 2 }
  33018. *
  33019. * // The `_.property` iteratee shorthand.
  33020. * _.maxBy(objects, 'n');
  33021. * // => { 'n': 2 }
  33022. */
  33023. function maxBy(array, iteratee) {
  33024. return (array && array.length)
  33025. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33026. : undefined;
  33027. }
  33028. /**
  33029. * Computes the mean of the values in `array`.
  33030. *
  33031. * @static
  33032. * @memberOf _
  33033. * @since 4.0.0
  33034. * @category Math
  33035. * @param {Array} array The array to iterate over.
  33036. * @returns {number} Returns the mean.
  33037. * @example
  33038. *
  33039. * _.mean([4, 2, 8, 6]);
  33040. * // => 5
  33041. */
  33042. function mean(array) {
  33043. return baseMean(array, identity);
  33044. }
  33045. /**
  33046. * This method is like `_.mean` except that it accepts `iteratee` which is
  33047. * invoked for each element in `array` to generate the value to be averaged.
  33048. * The iteratee is invoked with one argument: (value).
  33049. *
  33050. * @static
  33051. * @memberOf _
  33052. * @since 4.7.0
  33053. * @category Math
  33054. * @param {Array} array The array to iterate over.
  33055. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33056. * @returns {number} Returns the mean.
  33057. * @example
  33058. *
  33059. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33060. *
  33061. * _.meanBy(objects, function(o) { return o.n; });
  33062. * // => 5
  33063. *
  33064. * // The `_.property` iteratee shorthand.
  33065. * _.meanBy(objects, 'n');
  33066. * // => 5
  33067. */
  33068. function meanBy(array, iteratee) {
  33069. return baseMean(array, getIteratee(iteratee, 2));
  33070. }
  33071. /**
  33072. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33073. * `undefined` is returned.
  33074. *
  33075. * @static
  33076. * @since 0.1.0
  33077. * @memberOf _
  33078. * @category Math
  33079. * @param {Array} array The array to iterate over.
  33080. * @returns {*} Returns the minimum value.
  33081. * @example
  33082. *
  33083. * _.min([4, 2, 8, 6]);
  33084. * // => 2
  33085. *
  33086. * _.min([]);
  33087. * // => undefined
  33088. */
  33089. function min(array) {
  33090. return (array && array.length)
  33091. ? baseExtremum(array, identity, baseLt)
  33092. : undefined;
  33093. }
  33094. /**
  33095. * This method is like `_.min` except that it accepts `iteratee` which is
  33096. * invoked for each element in `array` to generate the criterion by which
  33097. * the value is ranked. The iteratee is invoked with one argument: (value).
  33098. *
  33099. * @static
  33100. * @memberOf _
  33101. * @since 4.0.0
  33102. * @category Math
  33103. * @param {Array} array The array to iterate over.
  33104. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33105. * @returns {*} Returns the minimum value.
  33106. * @example
  33107. *
  33108. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33109. *
  33110. * _.minBy(objects, function(o) { return o.n; });
  33111. * // => { 'n': 1 }
  33112. *
  33113. * // The `_.property` iteratee shorthand.
  33114. * _.minBy(objects, 'n');
  33115. * // => { 'n': 1 }
  33116. */
  33117. function minBy(array, iteratee) {
  33118. return (array && array.length)
  33119. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33120. : undefined;
  33121. }
  33122. /**
  33123. * Multiply two numbers.
  33124. *
  33125. * @static
  33126. * @memberOf _
  33127. * @since 4.7.0
  33128. * @category Math
  33129. * @param {number} multiplier The first number in a multiplication.
  33130. * @param {number} multiplicand The second number in a multiplication.
  33131. * @returns {number} Returns the product.
  33132. * @example
  33133. *
  33134. * _.multiply(6, 4);
  33135. * // => 24
  33136. */
  33137. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33138. return multiplier * multiplicand;
  33139. }, 1);
  33140. /**
  33141. * Computes `number` rounded to `precision`.
  33142. *
  33143. * @static
  33144. * @memberOf _
  33145. * @since 3.10.0
  33146. * @category Math
  33147. * @param {number} number The number to round.
  33148. * @param {number} [precision=0] The precision to round to.
  33149. * @returns {number} Returns the rounded number.
  33150. * @example
  33151. *
  33152. * _.round(4.006);
  33153. * // => 4
  33154. *
  33155. * _.round(4.006, 2);
  33156. * // => 4.01
  33157. *
  33158. * _.round(4060, -2);
  33159. * // => 4100
  33160. */
  33161. var round = createRound('round');
  33162. /**
  33163. * Subtract two numbers.
  33164. *
  33165. * @static
  33166. * @memberOf _
  33167. * @since 4.0.0
  33168. * @category Math
  33169. * @param {number} minuend The first number in a subtraction.
  33170. * @param {number} subtrahend The second number in a subtraction.
  33171. * @returns {number} Returns the difference.
  33172. * @example
  33173. *
  33174. * _.subtract(6, 4);
  33175. * // => 2
  33176. */
  33177. var subtract = createMathOperation(function(minuend, subtrahend) {
  33178. return minuend - subtrahend;
  33179. }, 0);
  33180. /**
  33181. * Computes the sum of the values in `array`.
  33182. *
  33183. * @static
  33184. * @memberOf _
  33185. * @since 3.4.0
  33186. * @category Math
  33187. * @param {Array} array The array to iterate over.
  33188. * @returns {number} Returns the sum.
  33189. * @example
  33190. *
  33191. * _.sum([4, 2, 8, 6]);
  33192. * // => 20
  33193. */
  33194. function sum(array) {
  33195. return (array && array.length)
  33196. ? baseSum(array, identity)
  33197. : 0;
  33198. }
  33199. /**
  33200. * This method is like `_.sum` except that it accepts `iteratee` which is
  33201. * invoked for each element in `array` to generate the value to be summed.
  33202. * The iteratee is invoked with one argument: (value).
  33203. *
  33204. * @static
  33205. * @memberOf _
  33206. * @since 4.0.0
  33207. * @category Math
  33208. * @param {Array} array The array to iterate over.
  33209. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33210. * @returns {number} Returns the sum.
  33211. * @example
  33212. *
  33213. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33214. *
  33215. * _.sumBy(objects, function(o) { return o.n; });
  33216. * // => 20
  33217. *
  33218. * // The `_.property` iteratee shorthand.
  33219. * _.sumBy(objects, 'n');
  33220. * // => 20
  33221. */
  33222. function sumBy(array, iteratee) {
  33223. return (array && array.length)
  33224. ? baseSum(array, getIteratee(iteratee, 2))
  33225. : 0;
  33226. }
  33227. /*------------------------------------------------------------------------*/
  33228. // Add methods that return wrapped values in chain sequences.
  33229. lodash.after = after;
  33230. lodash.ary = ary;
  33231. lodash.assign = assign;
  33232. lodash.assignIn = assignIn;
  33233. lodash.assignInWith = assignInWith;
  33234. lodash.assignWith = assignWith;
  33235. lodash.at = at;
  33236. lodash.before = before;
  33237. lodash.bind = bind;
  33238. lodash.bindAll = bindAll;
  33239. lodash.bindKey = bindKey;
  33240. lodash.castArray = castArray;
  33241. lodash.chain = chain;
  33242. lodash.chunk = chunk;
  33243. lodash.compact = compact;
  33244. lodash.concat = concat;
  33245. lodash.cond = cond;
  33246. lodash.conforms = conforms;
  33247. lodash.constant = constant;
  33248. lodash.countBy = countBy;
  33249. lodash.create = create;
  33250. lodash.curry = curry;
  33251. lodash.curryRight = curryRight;
  33252. lodash.debounce = debounce;
  33253. lodash.defaults = defaults;
  33254. lodash.defaultsDeep = defaultsDeep;
  33255. lodash.defer = defer;
  33256. lodash.delay = delay;
  33257. lodash.difference = difference;
  33258. lodash.differenceBy = differenceBy;
  33259. lodash.differenceWith = differenceWith;
  33260. lodash.drop = drop;
  33261. lodash.dropRight = dropRight;
  33262. lodash.dropRightWhile = dropRightWhile;
  33263. lodash.dropWhile = dropWhile;
  33264. lodash.fill = fill;
  33265. lodash.filter = filter;
  33266. lodash.flatMap = flatMap;
  33267. lodash.flatMapDeep = flatMapDeep;
  33268. lodash.flatMapDepth = flatMapDepth;
  33269. lodash.flatten = flatten;
  33270. lodash.flattenDeep = flattenDeep;
  33271. lodash.flattenDepth = flattenDepth;
  33272. lodash.flip = flip;
  33273. lodash.flow = flow;
  33274. lodash.flowRight = flowRight;
  33275. lodash.fromPairs = fromPairs;
  33276. lodash.functions = functions;
  33277. lodash.functionsIn = functionsIn;
  33278. lodash.groupBy = groupBy;
  33279. lodash.initial = initial;
  33280. lodash.intersection = intersection;
  33281. lodash.intersectionBy = intersectionBy;
  33282. lodash.intersectionWith = intersectionWith;
  33283. lodash.invert = invert;
  33284. lodash.invertBy = invertBy;
  33285. lodash.invokeMap = invokeMap;
  33286. lodash.iteratee = iteratee;
  33287. lodash.keyBy = keyBy;
  33288. lodash.keys = keys;
  33289. lodash.keysIn = keysIn;
  33290. lodash.map = map;
  33291. lodash.mapKeys = mapKeys;
  33292. lodash.mapValues = mapValues;
  33293. lodash.matches = matches;
  33294. lodash.matchesProperty = matchesProperty;
  33295. lodash.memoize = memoize;
  33296. lodash.merge = merge;
  33297. lodash.mergeWith = mergeWith;
  33298. lodash.method = method;
  33299. lodash.methodOf = methodOf;
  33300. lodash.mixin = mixin;
  33301. lodash.negate = negate;
  33302. lodash.nthArg = nthArg;
  33303. lodash.omit = omit;
  33304. lodash.omitBy = omitBy;
  33305. lodash.once = once;
  33306. lodash.orderBy = orderBy;
  33307. lodash.over = over;
  33308. lodash.overArgs = overArgs;
  33309. lodash.overEvery = overEvery;
  33310. lodash.overSome = overSome;
  33311. lodash.partial = partial;
  33312. lodash.partialRight = partialRight;
  33313. lodash.partition = partition;
  33314. lodash.pick = pick;
  33315. lodash.pickBy = pickBy;
  33316. lodash.property = property;
  33317. lodash.propertyOf = propertyOf;
  33318. lodash.pull = pull;
  33319. lodash.pullAll = pullAll;
  33320. lodash.pullAllBy = pullAllBy;
  33321. lodash.pullAllWith = pullAllWith;
  33322. lodash.pullAt = pullAt;
  33323. lodash.range = range;
  33324. lodash.rangeRight = rangeRight;
  33325. lodash.rearg = rearg;
  33326. lodash.reject = reject;
  33327. lodash.remove = remove;
  33328. lodash.rest = rest;
  33329. lodash.reverse = reverse;
  33330. lodash.sampleSize = sampleSize;
  33331. lodash.set = set;
  33332. lodash.setWith = setWith;
  33333. lodash.shuffle = shuffle;
  33334. lodash.slice = slice;
  33335. lodash.sortBy = sortBy;
  33336. lodash.sortedUniq = sortedUniq;
  33337. lodash.sortedUniqBy = sortedUniqBy;
  33338. lodash.split = split;
  33339. lodash.spread = spread;
  33340. lodash.tail = tail;
  33341. lodash.take = take;
  33342. lodash.takeRight = takeRight;
  33343. lodash.takeRightWhile = takeRightWhile;
  33344. lodash.takeWhile = takeWhile;
  33345. lodash.tap = tap;
  33346. lodash.throttle = throttle;
  33347. lodash.thru = thru;
  33348. lodash.toArray = toArray;
  33349. lodash.toPairs = toPairs;
  33350. lodash.toPairsIn = toPairsIn;
  33351. lodash.toPath = toPath;
  33352. lodash.toPlainObject = toPlainObject;
  33353. lodash.transform = transform;
  33354. lodash.unary = unary;
  33355. lodash.union = union;
  33356. lodash.unionBy = unionBy;
  33357. lodash.unionWith = unionWith;
  33358. lodash.uniq = uniq;
  33359. lodash.uniqBy = uniqBy;
  33360. lodash.uniqWith = uniqWith;
  33361. lodash.unset = unset;
  33362. lodash.unzip = unzip;
  33363. lodash.unzipWith = unzipWith;
  33364. lodash.update = update;
  33365. lodash.updateWith = updateWith;
  33366. lodash.values = values;
  33367. lodash.valuesIn = valuesIn;
  33368. lodash.without = without;
  33369. lodash.words = words;
  33370. lodash.wrap = wrap;
  33371. lodash.xor = xor;
  33372. lodash.xorBy = xorBy;
  33373. lodash.xorWith = xorWith;
  33374. lodash.zip = zip;
  33375. lodash.zipObject = zipObject;
  33376. lodash.zipObjectDeep = zipObjectDeep;
  33377. lodash.zipWith = zipWith;
  33378. // Add aliases.
  33379. lodash.entries = toPairs;
  33380. lodash.entriesIn = toPairsIn;
  33381. lodash.extend = assignIn;
  33382. lodash.extendWith = assignInWith;
  33383. // Add methods to `lodash.prototype`.
  33384. mixin(lodash, lodash);
  33385. /*------------------------------------------------------------------------*/
  33386. // Add methods that return unwrapped values in chain sequences.
  33387. lodash.add = add;
  33388. lodash.attempt = attempt;
  33389. lodash.camelCase = camelCase;
  33390. lodash.capitalize = capitalize;
  33391. lodash.ceil = ceil;
  33392. lodash.clamp = clamp;
  33393. lodash.clone = clone;
  33394. lodash.cloneDeep = cloneDeep;
  33395. lodash.cloneDeepWith = cloneDeepWith;
  33396. lodash.cloneWith = cloneWith;
  33397. lodash.conformsTo = conformsTo;
  33398. lodash.deburr = deburr;
  33399. lodash.defaultTo = defaultTo;
  33400. lodash.divide = divide;
  33401. lodash.endsWith = endsWith;
  33402. lodash.eq = eq;
  33403. lodash.escape = escape;
  33404. lodash.escapeRegExp = escapeRegExp;
  33405. lodash.every = every;
  33406. lodash.find = find;
  33407. lodash.findIndex = findIndex;
  33408. lodash.findKey = findKey;
  33409. lodash.findLast = findLast;
  33410. lodash.findLastIndex = findLastIndex;
  33411. lodash.findLastKey = findLastKey;
  33412. lodash.floor = floor;
  33413. lodash.forEach = forEach;
  33414. lodash.forEachRight = forEachRight;
  33415. lodash.forIn = forIn;
  33416. lodash.forInRight = forInRight;
  33417. lodash.forOwn = forOwn;
  33418. lodash.forOwnRight = forOwnRight;
  33419. lodash.get = get;
  33420. lodash.gt = gt;
  33421. lodash.gte = gte;
  33422. lodash.has = has;
  33423. lodash.hasIn = hasIn;
  33424. lodash.head = head;
  33425. lodash.identity = identity;
  33426. lodash.includes = includes;
  33427. lodash.indexOf = indexOf;
  33428. lodash.inRange = inRange;
  33429. lodash.invoke = invoke;
  33430. lodash.isArguments = isArguments;
  33431. lodash.isArray = isArray;
  33432. lodash.isArrayBuffer = isArrayBuffer;
  33433. lodash.isArrayLike = isArrayLike;
  33434. lodash.isArrayLikeObject = isArrayLikeObject;
  33435. lodash.isBoolean = isBoolean;
  33436. lodash.isBuffer = isBuffer;
  33437. lodash.isDate = isDate;
  33438. lodash.isElement = isElement;
  33439. lodash.isEmpty = isEmpty;
  33440. lodash.isEqual = isEqual;
  33441. lodash.isEqualWith = isEqualWith;
  33442. lodash.isError = isError;
  33443. lodash.isFinite = isFinite;
  33444. lodash.isFunction = isFunction;
  33445. lodash.isInteger = isInteger;
  33446. lodash.isLength = isLength;
  33447. lodash.isMap = isMap;
  33448. lodash.isMatch = isMatch;
  33449. lodash.isMatchWith = isMatchWith;
  33450. lodash.isNaN = isNaN;
  33451. lodash.isNative = isNative;
  33452. lodash.isNil = isNil;
  33453. lodash.isNull = isNull;
  33454. lodash.isNumber = isNumber;
  33455. lodash.isObject = isObject;
  33456. lodash.isObjectLike = isObjectLike;
  33457. lodash.isPlainObject = isPlainObject;
  33458. lodash.isRegExp = isRegExp;
  33459. lodash.isSafeInteger = isSafeInteger;
  33460. lodash.isSet = isSet;
  33461. lodash.isString = isString;
  33462. lodash.isSymbol = isSymbol;
  33463. lodash.isTypedArray = isTypedArray;
  33464. lodash.isUndefined = isUndefined;
  33465. lodash.isWeakMap = isWeakMap;
  33466. lodash.isWeakSet = isWeakSet;
  33467. lodash.join = join;
  33468. lodash.kebabCase = kebabCase;
  33469. lodash.last = last;
  33470. lodash.lastIndexOf = lastIndexOf;
  33471. lodash.lowerCase = lowerCase;
  33472. lodash.lowerFirst = lowerFirst;
  33473. lodash.lt = lt;
  33474. lodash.lte = lte;
  33475. lodash.max = max;
  33476. lodash.maxBy = maxBy;
  33477. lodash.mean = mean;
  33478. lodash.meanBy = meanBy;
  33479. lodash.min = min;
  33480. lodash.minBy = minBy;
  33481. lodash.stubArray = stubArray;
  33482. lodash.stubFalse = stubFalse;
  33483. lodash.stubObject = stubObject;
  33484. lodash.stubString = stubString;
  33485. lodash.stubTrue = stubTrue;
  33486. lodash.multiply = multiply;
  33487. lodash.nth = nth;
  33488. lodash.noConflict = noConflict;
  33489. lodash.noop = noop;
  33490. lodash.now = now;
  33491. lodash.pad = pad;
  33492. lodash.padEnd = padEnd;
  33493. lodash.padStart = padStart;
  33494. lodash.parseInt = parseInt;
  33495. lodash.random = random;
  33496. lodash.reduce = reduce;
  33497. lodash.reduceRight = reduceRight;
  33498. lodash.repeat = repeat;
  33499. lodash.replace = replace;
  33500. lodash.result = result;
  33501. lodash.round = round;
  33502. lodash.runInContext = runInContext;
  33503. lodash.sample = sample;
  33504. lodash.size = size;
  33505. lodash.snakeCase = snakeCase;
  33506. lodash.some = some;
  33507. lodash.sortedIndex = sortedIndex;
  33508. lodash.sortedIndexBy = sortedIndexBy;
  33509. lodash.sortedIndexOf = sortedIndexOf;
  33510. lodash.sortedLastIndex = sortedLastIndex;
  33511. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33512. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33513. lodash.startCase = startCase;
  33514. lodash.startsWith = startsWith;
  33515. lodash.subtract = subtract;
  33516. lodash.sum = sum;
  33517. lodash.sumBy = sumBy;
  33518. lodash.template = template;
  33519. lodash.times = times;
  33520. lodash.toFinite = toFinite;
  33521. lodash.toInteger = toInteger;
  33522. lodash.toLength = toLength;
  33523. lodash.toLower = toLower;
  33524. lodash.toNumber = toNumber;
  33525. lodash.toSafeInteger = toSafeInteger;
  33526. lodash.toString = toString;
  33527. lodash.toUpper = toUpper;
  33528. lodash.trim = trim;
  33529. lodash.trimEnd = trimEnd;
  33530. lodash.trimStart = trimStart;
  33531. lodash.truncate = truncate;
  33532. lodash.unescape = unescape;
  33533. lodash.uniqueId = uniqueId;
  33534. lodash.upperCase = upperCase;
  33535. lodash.upperFirst = upperFirst;
  33536. // Add aliases.
  33537. lodash.each = forEach;
  33538. lodash.eachRight = forEachRight;
  33539. lodash.first = head;
  33540. mixin(lodash, (function() {
  33541. var source = {};
  33542. baseForOwn(lodash, function(func, methodName) {
  33543. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33544. source[methodName] = func;
  33545. }
  33546. });
  33547. return source;
  33548. }()), { 'chain': false });
  33549. /*------------------------------------------------------------------------*/
  33550. /**
  33551. * The semantic version number.
  33552. *
  33553. * @static
  33554. * @memberOf _
  33555. * @type {string}
  33556. */
  33557. lodash.VERSION = VERSION;
  33558. // Assign default placeholders.
  33559. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33560. lodash[methodName].placeholder = lodash;
  33561. });
  33562. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33563. arrayEach(['drop', 'take'], function(methodName, index) {
  33564. LazyWrapper.prototype[methodName] = function(n) {
  33565. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33566. var result = (this.__filtered__ && !index)
  33567. ? new LazyWrapper(this)
  33568. : this.clone();
  33569. if (result.__filtered__) {
  33570. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33571. } else {
  33572. result.__views__.push({
  33573. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33574. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33575. });
  33576. }
  33577. return result;
  33578. };
  33579. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33580. return this.reverse()[methodName](n).reverse();
  33581. };
  33582. });
  33583. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33584. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33585. var type = index + 1,
  33586. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33587. LazyWrapper.prototype[methodName] = function(iteratee) {
  33588. var result = this.clone();
  33589. result.__iteratees__.push({
  33590. 'iteratee': getIteratee(iteratee, 3),
  33591. 'type': type
  33592. });
  33593. result.__filtered__ = result.__filtered__ || isFilter;
  33594. return result;
  33595. };
  33596. });
  33597. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33598. arrayEach(['head', 'last'], function(methodName, index) {
  33599. var takeName = 'take' + (index ? 'Right' : '');
  33600. LazyWrapper.prototype[methodName] = function() {
  33601. return this[takeName](1).value()[0];
  33602. };
  33603. });
  33604. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33605. arrayEach(['initial', 'tail'], function(methodName, index) {
  33606. var dropName = 'drop' + (index ? '' : 'Right');
  33607. LazyWrapper.prototype[methodName] = function() {
  33608. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33609. };
  33610. });
  33611. LazyWrapper.prototype.compact = function() {
  33612. return this.filter(identity);
  33613. };
  33614. LazyWrapper.prototype.find = function(predicate) {
  33615. return this.filter(predicate).head();
  33616. };
  33617. LazyWrapper.prototype.findLast = function(predicate) {
  33618. return this.reverse().find(predicate);
  33619. };
  33620. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33621. if (typeof path == 'function') {
  33622. return new LazyWrapper(this);
  33623. }
  33624. return this.map(function(value) {
  33625. return baseInvoke(value, path, args);
  33626. });
  33627. });
  33628. LazyWrapper.prototype.reject = function(predicate) {
  33629. return this.filter(negate(getIteratee(predicate)));
  33630. };
  33631. LazyWrapper.prototype.slice = function(start, end) {
  33632. start = toInteger(start);
  33633. var result = this;
  33634. if (result.__filtered__ && (start > 0 || end < 0)) {
  33635. return new LazyWrapper(result);
  33636. }
  33637. if (start < 0) {
  33638. result = result.takeRight(-start);
  33639. } else if (start) {
  33640. result = result.drop(start);
  33641. }
  33642. if (end !== undefined) {
  33643. end = toInteger(end);
  33644. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33645. }
  33646. return result;
  33647. };
  33648. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33649. return this.reverse().takeWhile(predicate).reverse();
  33650. };
  33651. LazyWrapper.prototype.toArray = function() {
  33652. return this.take(MAX_ARRAY_LENGTH);
  33653. };
  33654. // Add `LazyWrapper` methods to `lodash.prototype`.
  33655. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33656. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33657. isTaker = /^(?:head|last)$/.test(methodName),
  33658. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33659. retUnwrapped = isTaker || /^find/.test(methodName);
  33660. if (!lodashFunc) {
  33661. return;
  33662. }
  33663. lodash.prototype[methodName] = function() {
  33664. var value = this.__wrapped__,
  33665. args = isTaker ? [1] : arguments,
  33666. isLazy = value instanceof LazyWrapper,
  33667. iteratee = args[0],
  33668. useLazy = isLazy || isArray(value);
  33669. var interceptor = function(value) {
  33670. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33671. return (isTaker && chainAll) ? result[0] : result;
  33672. };
  33673. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33674. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33675. isLazy = useLazy = false;
  33676. }
  33677. var chainAll = this.__chain__,
  33678. isHybrid = !!this.__actions__.length,
  33679. isUnwrapped = retUnwrapped && !chainAll,
  33680. onlyLazy = isLazy && !isHybrid;
  33681. if (!retUnwrapped && useLazy) {
  33682. value = onlyLazy ? value : new LazyWrapper(this);
  33683. var result = func.apply(value, args);
  33684. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33685. return new LodashWrapper(result, chainAll);
  33686. }
  33687. if (isUnwrapped && onlyLazy) {
  33688. return func.apply(this, args);
  33689. }
  33690. result = this.thru(interceptor);
  33691. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33692. };
  33693. });
  33694. // Add `Array` methods to `lodash.prototype`.
  33695. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33696. var func = arrayProto[methodName],
  33697. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33698. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33699. lodash.prototype[methodName] = function() {
  33700. var args = arguments;
  33701. if (retUnwrapped && !this.__chain__) {
  33702. var value = this.value();
  33703. return func.apply(isArray(value) ? value : [], args);
  33704. }
  33705. return this[chainName](function(value) {
  33706. return func.apply(isArray(value) ? value : [], args);
  33707. });
  33708. };
  33709. });
  33710. // Map minified method names to their real names.
  33711. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33712. var lodashFunc = lodash[methodName];
  33713. if (lodashFunc) {
  33714. var key = lodashFunc.name + '';
  33715. if (!hasOwnProperty.call(realNames, key)) {
  33716. realNames[key] = [];
  33717. }
  33718. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  33719. }
  33720. });
  33721. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  33722. 'name': 'wrapper',
  33723. 'func': undefined
  33724. }];
  33725. // Add methods to `LazyWrapper`.
  33726. LazyWrapper.prototype.clone = lazyClone;
  33727. LazyWrapper.prototype.reverse = lazyReverse;
  33728. LazyWrapper.prototype.value = lazyValue;
  33729. // Add chain sequence methods to the `lodash` wrapper.
  33730. lodash.prototype.at = wrapperAt;
  33731. lodash.prototype.chain = wrapperChain;
  33732. lodash.prototype.commit = wrapperCommit;
  33733. lodash.prototype.next = wrapperNext;
  33734. lodash.prototype.plant = wrapperPlant;
  33735. lodash.prototype.reverse = wrapperReverse;
  33736. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  33737. // Add lazy aliases.
  33738. lodash.prototype.first = lodash.prototype.head;
  33739. if (symIterator) {
  33740. lodash.prototype[symIterator] = wrapperToIterator;
  33741. }
  33742. return lodash;
  33743. });
  33744. /*--------------------------------------------------------------------------*/
  33745. // Export lodash.
  33746. var _ = runInContext();
  33747. // Some AMD build optimizers, like r.js, check for condition patterns like:
  33748. if (true) {
  33749. // Expose Lodash on the global object to prevent errors when Lodash is
  33750. // loaded by a script tag in the presence of an AMD loader.
  33751. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  33752. // Use `_.noConflict` to remove Lodash from the global object.
  33753. root._ = _;
  33754. // Define as an anonymous module so, through path mapping, it can be
  33755. // referenced as the "underscore" module.
  33756. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  33757. return _;
  33758. }).call(exports, __webpack_require__, exports, module),
  33759. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  33760. }
  33761. // Check for `exports` after `define` in case a build optimizer adds it.
  33762. else {}
  33763. }.call(this));
  33764. /* 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)))
  33765. /***/ }),
  33766. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  33767. /*!***************************************************!*\
  33768. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  33769. \***************************************************/
  33770. /*! exports provided: default */
  33771. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  33772. "use strict";
  33773. __webpack_require__.r(__webpack_exports__);
  33774. /* WEBPACK VAR INJECTION */(function(global) {/**!
  33775. * @fileOverview Kickass library to create and place poppers near their reference elements.
  33776. * @version 1.16.1
  33777. * @license
  33778. * Copyright (c) 2016 Federico Zivolo and contributors
  33779. *
  33780. * Permission is hereby granted, free of charge, to any person obtaining a copy
  33781. * of this software and associated documentation files (the "Software"), to deal
  33782. * in the Software without restriction, including without limitation the rights
  33783. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  33784. * copies of the Software, and to permit persons to whom the Software is
  33785. * furnished to do so, subject to the following conditions:
  33786. *
  33787. * The above copyright notice and this permission notice shall be included in all
  33788. * copies or substantial portions of the Software.
  33789. *
  33790. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  33791. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  33792. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  33793. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  33794. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  33795. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  33796. * SOFTWARE.
  33797. */
  33798. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  33799. var timeoutDuration = function () {
  33800. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  33801. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  33802. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  33803. return 1;
  33804. }
  33805. }
  33806. return 0;
  33807. }();
  33808. function microtaskDebounce(fn) {
  33809. var called = false;
  33810. return function () {
  33811. if (called) {
  33812. return;
  33813. }
  33814. called = true;
  33815. window.Promise.resolve().then(function () {
  33816. called = false;
  33817. fn();
  33818. });
  33819. };
  33820. }
  33821. function taskDebounce(fn) {
  33822. var scheduled = false;
  33823. return function () {
  33824. if (!scheduled) {
  33825. scheduled = true;
  33826. setTimeout(function () {
  33827. scheduled = false;
  33828. fn();
  33829. }, timeoutDuration);
  33830. }
  33831. };
  33832. }
  33833. var supportsMicroTasks = isBrowser && window.Promise;
  33834. /**
  33835. * Create a debounced version of a method, that's asynchronously deferred
  33836. * but called in the minimum time possible.
  33837. *
  33838. * @method
  33839. * @memberof Popper.Utils
  33840. * @argument {Function} fn
  33841. * @returns {Function}
  33842. */
  33843. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  33844. /**
  33845. * Check if the given variable is a function
  33846. * @method
  33847. * @memberof Popper.Utils
  33848. * @argument {Any} functionToCheck - variable to check
  33849. * @returns {Boolean} answer to: is a function?
  33850. */
  33851. function isFunction(functionToCheck) {
  33852. var getType = {};
  33853. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  33854. }
  33855. /**
  33856. * Get CSS computed property of the given element
  33857. * @method
  33858. * @memberof Popper.Utils
  33859. * @argument {Eement} element
  33860. * @argument {String} property
  33861. */
  33862. function getStyleComputedProperty(element, property) {
  33863. if (element.nodeType !== 1) {
  33864. return [];
  33865. }
  33866. // NOTE: 1 DOM access here
  33867. var window = element.ownerDocument.defaultView;
  33868. var css = window.getComputedStyle(element, null);
  33869. return property ? css[property] : css;
  33870. }
  33871. /**
  33872. * Returns the parentNode or the host of the element
  33873. * @method
  33874. * @memberof Popper.Utils
  33875. * @argument {Element} element
  33876. * @returns {Element} parent
  33877. */
  33878. function getParentNode(element) {
  33879. if (element.nodeName === 'HTML') {
  33880. return element;
  33881. }
  33882. return element.parentNode || element.host;
  33883. }
  33884. /**
  33885. * Returns the scrolling parent of the given element
  33886. * @method
  33887. * @memberof Popper.Utils
  33888. * @argument {Element} element
  33889. * @returns {Element} scroll parent
  33890. */
  33891. function getScrollParent(element) {
  33892. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  33893. if (!element) {
  33894. return document.body;
  33895. }
  33896. switch (element.nodeName) {
  33897. case 'HTML':
  33898. case 'BODY':
  33899. return element.ownerDocument.body;
  33900. case '#document':
  33901. return element.body;
  33902. }
  33903. // Firefox want us to check `-x` and `-y` variations as well
  33904. var _getStyleComputedProp = getStyleComputedProperty(element),
  33905. overflow = _getStyleComputedProp.overflow,
  33906. overflowX = _getStyleComputedProp.overflowX,
  33907. overflowY = _getStyleComputedProp.overflowY;
  33908. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  33909. return element;
  33910. }
  33911. return getScrollParent(getParentNode(element));
  33912. }
  33913. /**
  33914. * Returns the reference node of the reference object, or the reference object itself.
  33915. * @method
  33916. * @memberof Popper.Utils
  33917. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  33918. * @returns {Element} parent
  33919. */
  33920. function getReferenceNode(reference) {
  33921. return reference && reference.referenceNode ? reference.referenceNode : reference;
  33922. }
  33923. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  33924. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  33925. /**
  33926. * Determines if the browser is Internet Explorer
  33927. * @method
  33928. * @memberof Popper.Utils
  33929. * @param {Number} version to check
  33930. * @returns {Boolean} isIE
  33931. */
  33932. function isIE(version) {
  33933. if (version === 11) {
  33934. return isIE11;
  33935. }
  33936. if (version === 10) {
  33937. return isIE10;
  33938. }
  33939. return isIE11 || isIE10;
  33940. }
  33941. /**
  33942. * Returns the offset parent of the given element
  33943. * @method
  33944. * @memberof Popper.Utils
  33945. * @argument {Element} element
  33946. * @returns {Element} offset parent
  33947. */
  33948. function getOffsetParent(element) {
  33949. if (!element) {
  33950. return document.documentElement;
  33951. }
  33952. var noOffsetParent = isIE(10) ? document.body : null;
  33953. // NOTE: 1 DOM access here
  33954. var offsetParent = element.offsetParent || null;
  33955. // Skip hidden elements which don't have an offsetParent
  33956. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  33957. offsetParent = (element = element.nextElementSibling).offsetParent;
  33958. }
  33959. var nodeName = offsetParent && offsetParent.nodeName;
  33960. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  33961. return element ? element.ownerDocument.documentElement : document.documentElement;
  33962. }
  33963. // .offsetParent will return the closest TH, TD or TABLE in case
  33964. // no offsetParent is present, I hate this job...
  33965. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  33966. return getOffsetParent(offsetParent);
  33967. }
  33968. return offsetParent;
  33969. }
  33970. function isOffsetContainer(element) {
  33971. var nodeName = element.nodeName;
  33972. if (nodeName === 'BODY') {
  33973. return false;
  33974. }
  33975. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  33976. }
  33977. /**
  33978. * Finds the root node (document, shadowDOM root) of the given element
  33979. * @method
  33980. * @memberof Popper.Utils
  33981. * @argument {Element} node
  33982. * @returns {Element} root node
  33983. */
  33984. function getRoot(node) {
  33985. if (node.parentNode !== null) {
  33986. return getRoot(node.parentNode);
  33987. }
  33988. return node;
  33989. }
  33990. /**
  33991. * Finds the offset parent common to the two provided nodes
  33992. * @method
  33993. * @memberof Popper.Utils
  33994. * @argument {Element} element1
  33995. * @argument {Element} element2
  33996. * @returns {Element} common offset parent
  33997. */
  33998. function findCommonOffsetParent(element1, element2) {
  33999. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34000. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34001. return document.documentElement;
  34002. }
  34003. // Here we make sure to give as "start" the element that comes first in the DOM
  34004. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34005. var start = order ? element1 : element2;
  34006. var end = order ? element2 : element1;
  34007. // Get common ancestor container
  34008. var range = document.createRange();
  34009. range.setStart(start, 0);
  34010. range.setEnd(end, 0);
  34011. var commonAncestorContainer = range.commonAncestorContainer;
  34012. // Both nodes are inside #document
  34013. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34014. if (isOffsetContainer(commonAncestorContainer)) {
  34015. return commonAncestorContainer;
  34016. }
  34017. return getOffsetParent(commonAncestorContainer);
  34018. }
  34019. // one of the nodes is inside shadowDOM, find which one
  34020. var element1root = getRoot(element1);
  34021. if (element1root.host) {
  34022. return findCommonOffsetParent(element1root.host, element2);
  34023. } else {
  34024. return findCommonOffsetParent(element1, getRoot(element2).host);
  34025. }
  34026. }
  34027. /**
  34028. * Gets the scroll value of the given element in the given side (top and left)
  34029. * @method
  34030. * @memberof Popper.Utils
  34031. * @argument {Element} element
  34032. * @argument {String} side `top` or `left`
  34033. * @returns {number} amount of scrolled pixels
  34034. */
  34035. function getScroll(element) {
  34036. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34037. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34038. var nodeName = element.nodeName;
  34039. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34040. var html = element.ownerDocument.documentElement;
  34041. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34042. return scrollingElement[upperSide];
  34043. }
  34044. return element[upperSide];
  34045. }
  34046. /*
  34047. * Sum or subtract the element scroll values (left and top) from a given rect object
  34048. * @method
  34049. * @memberof Popper.Utils
  34050. * @param {Object} rect - Rect object you want to change
  34051. * @param {HTMLElement} element - The element from the function reads the scroll values
  34052. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34053. * @return {Object} rect - The modifier rect object
  34054. */
  34055. function includeScroll(rect, element) {
  34056. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34057. var scrollTop = getScroll(element, 'top');
  34058. var scrollLeft = getScroll(element, 'left');
  34059. var modifier = subtract ? -1 : 1;
  34060. rect.top += scrollTop * modifier;
  34061. rect.bottom += scrollTop * modifier;
  34062. rect.left += scrollLeft * modifier;
  34063. rect.right += scrollLeft * modifier;
  34064. return rect;
  34065. }
  34066. /*
  34067. * Helper to detect borders of a given element
  34068. * @method
  34069. * @memberof Popper.Utils
  34070. * @param {CSSStyleDeclaration} styles
  34071. * Result of `getStyleComputedProperty` on the given element
  34072. * @param {String} axis - `x` or `y`
  34073. * @return {number} borders - The borders size of the given axis
  34074. */
  34075. function getBordersSize(styles, axis) {
  34076. var sideA = axis === 'x' ? 'Left' : 'Top';
  34077. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34078. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34079. }
  34080. function getSize(axis, body, html, computedStyle) {
  34081. 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);
  34082. }
  34083. function getWindowSizes(document) {
  34084. var body = document.body;
  34085. var html = document.documentElement;
  34086. var computedStyle = isIE(10) && getComputedStyle(html);
  34087. return {
  34088. height: getSize('Height', body, html, computedStyle),
  34089. width: getSize('Width', body, html, computedStyle)
  34090. };
  34091. }
  34092. var classCallCheck = function (instance, Constructor) {
  34093. if (!(instance instanceof Constructor)) {
  34094. throw new TypeError("Cannot call a class as a function");
  34095. }
  34096. };
  34097. var createClass = function () {
  34098. function defineProperties(target, props) {
  34099. for (var i = 0; i < props.length; i++) {
  34100. var descriptor = props[i];
  34101. descriptor.enumerable = descriptor.enumerable || false;
  34102. descriptor.configurable = true;
  34103. if ("value" in descriptor) descriptor.writable = true;
  34104. Object.defineProperty(target, descriptor.key, descriptor);
  34105. }
  34106. }
  34107. return function (Constructor, protoProps, staticProps) {
  34108. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34109. if (staticProps) defineProperties(Constructor, staticProps);
  34110. return Constructor;
  34111. };
  34112. }();
  34113. var defineProperty = function (obj, key, value) {
  34114. if (key in obj) {
  34115. Object.defineProperty(obj, key, {
  34116. value: value,
  34117. enumerable: true,
  34118. configurable: true,
  34119. writable: true
  34120. });
  34121. } else {
  34122. obj[key] = value;
  34123. }
  34124. return obj;
  34125. };
  34126. var _extends = Object.assign || function (target) {
  34127. for (var i = 1; i < arguments.length; i++) {
  34128. var source = arguments[i];
  34129. for (var key in source) {
  34130. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34131. target[key] = source[key];
  34132. }
  34133. }
  34134. }
  34135. return target;
  34136. };
  34137. /**
  34138. * Given element offsets, generate an output similar to getBoundingClientRect
  34139. * @method
  34140. * @memberof Popper.Utils
  34141. * @argument {Object} offsets
  34142. * @returns {Object} ClientRect like output
  34143. */
  34144. function getClientRect(offsets) {
  34145. return _extends({}, offsets, {
  34146. right: offsets.left + offsets.width,
  34147. bottom: offsets.top + offsets.height
  34148. });
  34149. }
  34150. /**
  34151. * Get bounding client rect of given element
  34152. * @method
  34153. * @memberof Popper.Utils
  34154. * @param {HTMLElement} element
  34155. * @return {Object} client rect
  34156. */
  34157. function getBoundingClientRect(element) {
  34158. var rect = {};
  34159. // IE10 10 FIX: Please, don't ask, the element isn't
  34160. // considered in DOM in some circumstances...
  34161. // This isn't reproducible in IE10 compatibility mode of IE11
  34162. try {
  34163. if (isIE(10)) {
  34164. rect = element.getBoundingClientRect();
  34165. var scrollTop = getScroll(element, 'top');
  34166. var scrollLeft = getScroll(element, 'left');
  34167. rect.top += scrollTop;
  34168. rect.left += scrollLeft;
  34169. rect.bottom += scrollTop;
  34170. rect.right += scrollLeft;
  34171. } else {
  34172. rect = element.getBoundingClientRect();
  34173. }
  34174. } catch (e) {}
  34175. var result = {
  34176. left: rect.left,
  34177. top: rect.top,
  34178. width: rect.right - rect.left,
  34179. height: rect.bottom - rect.top
  34180. };
  34181. // subtract scrollbar size from sizes
  34182. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34183. var width = sizes.width || element.clientWidth || result.width;
  34184. var height = sizes.height || element.clientHeight || result.height;
  34185. var horizScrollbar = element.offsetWidth - width;
  34186. var vertScrollbar = element.offsetHeight - height;
  34187. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34188. // we make this check conditional for performance reasons
  34189. if (horizScrollbar || vertScrollbar) {
  34190. var styles = getStyleComputedProperty(element);
  34191. horizScrollbar -= getBordersSize(styles, 'x');
  34192. vertScrollbar -= getBordersSize(styles, 'y');
  34193. result.width -= horizScrollbar;
  34194. result.height -= vertScrollbar;
  34195. }
  34196. return getClientRect(result);
  34197. }
  34198. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34199. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34200. var isIE10 = isIE(10);
  34201. var isHTML = parent.nodeName === 'HTML';
  34202. var childrenRect = getBoundingClientRect(children);
  34203. var parentRect = getBoundingClientRect(parent);
  34204. var scrollParent = getScrollParent(children);
  34205. var styles = getStyleComputedProperty(parent);
  34206. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34207. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34208. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34209. if (fixedPosition && isHTML) {
  34210. parentRect.top = Math.max(parentRect.top, 0);
  34211. parentRect.left = Math.max(parentRect.left, 0);
  34212. }
  34213. var offsets = getClientRect({
  34214. top: childrenRect.top - parentRect.top - borderTopWidth,
  34215. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34216. width: childrenRect.width,
  34217. height: childrenRect.height
  34218. });
  34219. offsets.marginTop = 0;
  34220. offsets.marginLeft = 0;
  34221. // Subtract margins of documentElement in case it's being used as parent
  34222. // we do this only on HTML because it's the only element that behaves
  34223. // differently when margins are applied to it. The margins are included in
  34224. // the box of the documentElement, in the other cases not.
  34225. if (!isIE10 && isHTML) {
  34226. var marginTop = parseFloat(styles.marginTop);
  34227. var marginLeft = parseFloat(styles.marginLeft);
  34228. offsets.top -= borderTopWidth - marginTop;
  34229. offsets.bottom -= borderTopWidth - marginTop;
  34230. offsets.left -= borderLeftWidth - marginLeft;
  34231. offsets.right -= borderLeftWidth - marginLeft;
  34232. // Attach marginTop and marginLeft because in some circumstances we may need them
  34233. offsets.marginTop = marginTop;
  34234. offsets.marginLeft = marginLeft;
  34235. }
  34236. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34237. offsets = includeScroll(offsets, parent);
  34238. }
  34239. return offsets;
  34240. }
  34241. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34242. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34243. var html = element.ownerDocument.documentElement;
  34244. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34245. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34246. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34247. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34248. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34249. var offset = {
  34250. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34251. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34252. width: width,
  34253. height: height
  34254. };
  34255. return getClientRect(offset);
  34256. }
  34257. /**
  34258. * Check if the given element is fixed or is inside a fixed parent
  34259. * @method
  34260. * @memberof Popper.Utils
  34261. * @argument {Element} element
  34262. * @argument {Element} customContainer
  34263. * @returns {Boolean} answer to "isFixed?"
  34264. */
  34265. function isFixed(element) {
  34266. var nodeName = element.nodeName;
  34267. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34268. return false;
  34269. }
  34270. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34271. return true;
  34272. }
  34273. var parentNode = getParentNode(element);
  34274. if (!parentNode) {
  34275. return false;
  34276. }
  34277. return isFixed(parentNode);
  34278. }
  34279. /**
  34280. * Finds the first parent of an element that has a transformed property defined
  34281. * @method
  34282. * @memberof Popper.Utils
  34283. * @argument {Element} element
  34284. * @returns {Element} first transformed parent or documentElement
  34285. */
  34286. function getFixedPositionOffsetParent(element) {
  34287. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34288. if (!element || !element.parentElement || isIE()) {
  34289. return document.documentElement;
  34290. }
  34291. var el = element.parentElement;
  34292. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34293. el = el.parentElement;
  34294. }
  34295. return el || document.documentElement;
  34296. }
  34297. /**
  34298. * Computed the boundaries limits and return them
  34299. * @method
  34300. * @memberof Popper.Utils
  34301. * @param {HTMLElement} popper
  34302. * @param {HTMLElement} reference
  34303. * @param {number} padding
  34304. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34305. * @param {Boolean} fixedPosition - Is in fixed position mode
  34306. * @returns {Object} Coordinates of the boundaries
  34307. */
  34308. function getBoundaries(popper, reference, padding, boundariesElement) {
  34309. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34310. // NOTE: 1 DOM access here
  34311. var boundaries = { top: 0, left: 0 };
  34312. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34313. // Handle viewport case
  34314. if (boundariesElement === 'viewport') {
  34315. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34316. } else {
  34317. // Handle other cases based on DOM element used as boundaries
  34318. var boundariesNode = void 0;
  34319. if (boundariesElement === 'scrollParent') {
  34320. boundariesNode = getScrollParent(getParentNode(reference));
  34321. if (boundariesNode.nodeName === 'BODY') {
  34322. boundariesNode = popper.ownerDocument.documentElement;
  34323. }
  34324. } else if (boundariesElement === 'window') {
  34325. boundariesNode = popper.ownerDocument.documentElement;
  34326. } else {
  34327. boundariesNode = boundariesElement;
  34328. }
  34329. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34330. // In case of HTML, we need a different computation
  34331. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34332. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34333. height = _getWindowSizes.height,
  34334. width = _getWindowSizes.width;
  34335. boundaries.top += offsets.top - offsets.marginTop;
  34336. boundaries.bottom = height + offsets.top;
  34337. boundaries.left += offsets.left - offsets.marginLeft;
  34338. boundaries.right = width + offsets.left;
  34339. } else {
  34340. // for all the other DOM elements, this one is good
  34341. boundaries = offsets;
  34342. }
  34343. }
  34344. // Add paddings
  34345. padding = padding || 0;
  34346. var isPaddingNumber = typeof padding === 'number';
  34347. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34348. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34349. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34350. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34351. return boundaries;
  34352. }
  34353. function getArea(_ref) {
  34354. var width = _ref.width,
  34355. height = _ref.height;
  34356. return width * height;
  34357. }
  34358. /**
  34359. * Utility used to transform the `auto` placement to the placement with more
  34360. * available space.
  34361. * @method
  34362. * @memberof Popper.Utils
  34363. * @argument {Object} data - The data object generated by update method
  34364. * @argument {Object} options - Modifiers configuration and options
  34365. * @returns {Object} The data object, properly modified
  34366. */
  34367. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34368. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34369. if (placement.indexOf('auto') === -1) {
  34370. return placement;
  34371. }
  34372. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34373. var rects = {
  34374. top: {
  34375. width: boundaries.width,
  34376. height: refRect.top - boundaries.top
  34377. },
  34378. right: {
  34379. width: boundaries.right - refRect.right,
  34380. height: boundaries.height
  34381. },
  34382. bottom: {
  34383. width: boundaries.width,
  34384. height: boundaries.bottom - refRect.bottom
  34385. },
  34386. left: {
  34387. width: refRect.left - boundaries.left,
  34388. height: boundaries.height
  34389. }
  34390. };
  34391. var sortedAreas = Object.keys(rects).map(function (key) {
  34392. return _extends({
  34393. key: key
  34394. }, rects[key], {
  34395. area: getArea(rects[key])
  34396. });
  34397. }).sort(function (a, b) {
  34398. return b.area - a.area;
  34399. });
  34400. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34401. var width = _ref2.width,
  34402. height = _ref2.height;
  34403. return width >= popper.clientWidth && height >= popper.clientHeight;
  34404. });
  34405. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34406. var variation = placement.split('-')[1];
  34407. return computedPlacement + (variation ? '-' + variation : '');
  34408. }
  34409. /**
  34410. * Get offsets to the reference element
  34411. * @method
  34412. * @memberof Popper.Utils
  34413. * @param {Object} state
  34414. * @param {Element} popper - the popper element
  34415. * @param {Element} reference - the reference element (the popper will be relative to this)
  34416. * @param {Element} fixedPosition - is in fixed position mode
  34417. * @returns {Object} An object containing the offsets which will be applied to the popper
  34418. */
  34419. function getReferenceOffsets(state, popper, reference) {
  34420. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34421. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34422. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34423. }
  34424. /**
  34425. * Get the outer sizes of the given element (offset size + margins)
  34426. * @method
  34427. * @memberof Popper.Utils
  34428. * @argument {Element} element
  34429. * @returns {Object} object containing width and height properties
  34430. */
  34431. function getOuterSizes(element) {
  34432. var window = element.ownerDocument.defaultView;
  34433. var styles = window.getComputedStyle(element);
  34434. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34435. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34436. var result = {
  34437. width: element.offsetWidth + y,
  34438. height: element.offsetHeight + x
  34439. };
  34440. return result;
  34441. }
  34442. /**
  34443. * Get the opposite placement of the given one
  34444. * @method
  34445. * @memberof Popper.Utils
  34446. * @argument {String} placement
  34447. * @returns {String} flipped placement
  34448. */
  34449. function getOppositePlacement(placement) {
  34450. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34451. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34452. return hash[matched];
  34453. });
  34454. }
  34455. /**
  34456. * Get offsets to the popper
  34457. * @method
  34458. * @memberof Popper.Utils
  34459. * @param {Object} position - CSS position the Popper will get applied
  34460. * @param {HTMLElement} popper - the popper element
  34461. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34462. * @param {String} placement - one of the valid placement options
  34463. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34464. */
  34465. function getPopperOffsets(popper, referenceOffsets, placement) {
  34466. placement = placement.split('-')[0];
  34467. // Get popper node sizes
  34468. var popperRect = getOuterSizes(popper);
  34469. // Add position, width and height to our offsets object
  34470. var popperOffsets = {
  34471. width: popperRect.width,
  34472. height: popperRect.height
  34473. };
  34474. // depending by the popper placement we have to compute its offsets slightly differently
  34475. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34476. var mainSide = isHoriz ? 'top' : 'left';
  34477. var secondarySide = isHoriz ? 'left' : 'top';
  34478. var measurement = isHoriz ? 'height' : 'width';
  34479. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34480. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34481. if (placement === secondarySide) {
  34482. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34483. } else {
  34484. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34485. }
  34486. return popperOffsets;
  34487. }
  34488. /**
  34489. * Mimics the `find` method of Array
  34490. * @method
  34491. * @memberof Popper.Utils
  34492. * @argument {Array} arr
  34493. * @argument prop
  34494. * @argument value
  34495. * @returns index or -1
  34496. */
  34497. function find(arr, check) {
  34498. // use native find if supported
  34499. if (Array.prototype.find) {
  34500. return arr.find(check);
  34501. }
  34502. // use `filter` to obtain the same behavior of `find`
  34503. return arr.filter(check)[0];
  34504. }
  34505. /**
  34506. * Return the index of the matching object
  34507. * @method
  34508. * @memberof Popper.Utils
  34509. * @argument {Array} arr
  34510. * @argument prop
  34511. * @argument value
  34512. * @returns index or -1
  34513. */
  34514. function findIndex(arr, prop, value) {
  34515. // use native findIndex if supported
  34516. if (Array.prototype.findIndex) {
  34517. return arr.findIndex(function (cur) {
  34518. return cur[prop] === value;
  34519. });
  34520. }
  34521. // use `find` + `indexOf` if `findIndex` isn't supported
  34522. var match = find(arr, function (obj) {
  34523. return obj[prop] === value;
  34524. });
  34525. return arr.indexOf(match);
  34526. }
  34527. /**
  34528. * Loop trough the list of modifiers and run them in order,
  34529. * each of them will then edit the data object.
  34530. * @method
  34531. * @memberof Popper.Utils
  34532. * @param {dataObject} data
  34533. * @param {Array} modifiers
  34534. * @param {String} ends - Optional modifier name used as stopper
  34535. * @returns {dataObject}
  34536. */
  34537. function runModifiers(modifiers, data, ends) {
  34538. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34539. modifiersToRun.forEach(function (modifier) {
  34540. if (modifier['function']) {
  34541. // eslint-disable-line dot-notation
  34542. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34543. }
  34544. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34545. if (modifier.enabled && isFunction(fn)) {
  34546. // Add properties to offsets to make them a complete clientRect object
  34547. // we do this before each modifier to make sure the previous one doesn't
  34548. // mess with these values
  34549. data.offsets.popper = getClientRect(data.offsets.popper);
  34550. data.offsets.reference = getClientRect(data.offsets.reference);
  34551. data = fn(data, modifier);
  34552. }
  34553. });
  34554. return data;
  34555. }
  34556. /**
  34557. * Updates the position of the popper, computing the new offsets and applying
  34558. * the new style.<br />
  34559. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34560. * @method
  34561. * @memberof Popper
  34562. */
  34563. function update() {
  34564. // if popper is destroyed, don't perform any further update
  34565. if (this.state.isDestroyed) {
  34566. return;
  34567. }
  34568. var data = {
  34569. instance: this,
  34570. styles: {},
  34571. arrowStyles: {},
  34572. attributes: {},
  34573. flipped: false,
  34574. offsets: {}
  34575. };
  34576. // compute reference element offsets
  34577. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34578. // compute auto placement, store placement inside the data object,
  34579. // modifiers will be able to edit `placement` if needed
  34580. // and refer to originalPlacement to know the original value
  34581. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34582. // store the computed placement inside `originalPlacement`
  34583. data.originalPlacement = data.placement;
  34584. data.positionFixed = this.options.positionFixed;
  34585. // compute the popper offsets
  34586. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34587. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34588. // run the modifiers
  34589. data = runModifiers(this.modifiers, data);
  34590. // the first `update` will call `onCreate` callback
  34591. // the other ones will call `onUpdate` callback
  34592. if (!this.state.isCreated) {
  34593. this.state.isCreated = true;
  34594. this.options.onCreate(data);
  34595. } else {
  34596. this.options.onUpdate(data);
  34597. }
  34598. }
  34599. /**
  34600. * Helper used to know if the given modifier is enabled.
  34601. * @method
  34602. * @memberof Popper.Utils
  34603. * @returns {Boolean}
  34604. */
  34605. function isModifierEnabled(modifiers, modifierName) {
  34606. return modifiers.some(function (_ref) {
  34607. var name = _ref.name,
  34608. enabled = _ref.enabled;
  34609. return enabled && name === modifierName;
  34610. });
  34611. }
  34612. /**
  34613. * Get the prefixed supported property name
  34614. * @method
  34615. * @memberof Popper.Utils
  34616. * @argument {String} property (camelCase)
  34617. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34618. */
  34619. function getSupportedPropertyName(property) {
  34620. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34621. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34622. for (var i = 0; i < prefixes.length; i++) {
  34623. var prefix = prefixes[i];
  34624. var toCheck = prefix ? '' + prefix + upperProp : property;
  34625. if (typeof document.body.style[toCheck] !== 'undefined') {
  34626. return toCheck;
  34627. }
  34628. }
  34629. return null;
  34630. }
  34631. /**
  34632. * Destroys the popper.
  34633. * @method
  34634. * @memberof Popper
  34635. */
  34636. function destroy() {
  34637. this.state.isDestroyed = true;
  34638. // touch DOM only if `applyStyle` modifier is enabled
  34639. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34640. this.popper.removeAttribute('x-placement');
  34641. this.popper.style.position = '';
  34642. this.popper.style.top = '';
  34643. this.popper.style.left = '';
  34644. this.popper.style.right = '';
  34645. this.popper.style.bottom = '';
  34646. this.popper.style.willChange = '';
  34647. this.popper.style[getSupportedPropertyName('transform')] = '';
  34648. }
  34649. this.disableEventListeners();
  34650. // remove the popper if user explicitly asked for the deletion on destroy
  34651. // do not use `remove` because IE11 doesn't support it
  34652. if (this.options.removeOnDestroy) {
  34653. this.popper.parentNode.removeChild(this.popper);
  34654. }
  34655. return this;
  34656. }
  34657. /**
  34658. * Get the window associated with the element
  34659. * @argument {Element} element
  34660. * @returns {Window}
  34661. */
  34662. function getWindow(element) {
  34663. var ownerDocument = element.ownerDocument;
  34664. return ownerDocument ? ownerDocument.defaultView : window;
  34665. }
  34666. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34667. var isBody = scrollParent.nodeName === 'BODY';
  34668. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34669. target.addEventListener(event, callback, { passive: true });
  34670. if (!isBody) {
  34671. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34672. }
  34673. scrollParents.push(target);
  34674. }
  34675. /**
  34676. * Setup needed event listeners used to update the popper position
  34677. * @method
  34678. * @memberof Popper.Utils
  34679. * @private
  34680. */
  34681. function setupEventListeners(reference, options, state, updateBound) {
  34682. // Resize event listener on window
  34683. state.updateBound = updateBound;
  34684. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34685. // Scroll event listener on scroll parents
  34686. var scrollElement = getScrollParent(reference);
  34687. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34688. state.scrollElement = scrollElement;
  34689. state.eventsEnabled = true;
  34690. return state;
  34691. }
  34692. /**
  34693. * It will add resize/scroll events and start recalculating
  34694. * position of the popper element when they are triggered.
  34695. * @method
  34696. * @memberof Popper
  34697. */
  34698. function enableEventListeners() {
  34699. if (!this.state.eventsEnabled) {
  34700. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34701. }
  34702. }
  34703. /**
  34704. * Remove event listeners used to update the popper position
  34705. * @method
  34706. * @memberof Popper.Utils
  34707. * @private
  34708. */
  34709. function removeEventListeners(reference, state) {
  34710. // Remove resize event listener on window
  34711. getWindow(reference).removeEventListener('resize', state.updateBound);
  34712. // Remove scroll event listener on scroll parents
  34713. state.scrollParents.forEach(function (target) {
  34714. target.removeEventListener('scroll', state.updateBound);
  34715. });
  34716. // Reset state
  34717. state.updateBound = null;
  34718. state.scrollParents = [];
  34719. state.scrollElement = null;
  34720. state.eventsEnabled = false;
  34721. return state;
  34722. }
  34723. /**
  34724. * It will remove resize/scroll events and won't recalculate popper position
  34725. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  34726. * unless you call `update` method manually.
  34727. * @method
  34728. * @memberof Popper
  34729. */
  34730. function disableEventListeners() {
  34731. if (this.state.eventsEnabled) {
  34732. cancelAnimationFrame(this.scheduleUpdate);
  34733. this.state = removeEventListeners(this.reference, this.state);
  34734. }
  34735. }
  34736. /**
  34737. * Tells if a given input is a number
  34738. * @method
  34739. * @memberof Popper.Utils
  34740. * @param {*} input to check
  34741. * @return {Boolean}
  34742. */
  34743. function isNumeric(n) {
  34744. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  34745. }
  34746. /**
  34747. * Set the style to the given popper
  34748. * @method
  34749. * @memberof Popper.Utils
  34750. * @argument {Element} element - Element to apply the style to
  34751. * @argument {Object} styles
  34752. * Object with a list of properties and values which will be applied to the element
  34753. */
  34754. function setStyles(element, styles) {
  34755. Object.keys(styles).forEach(function (prop) {
  34756. var unit = '';
  34757. // add unit if the value is numeric and is one of the following
  34758. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  34759. unit = 'px';
  34760. }
  34761. element.style[prop] = styles[prop] + unit;
  34762. });
  34763. }
  34764. /**
  34765. * Set the attributes to the given popper
  34766. * @method
  34767. * @memberof Popper.Utils
  34768. * @argument {Element} element - Element to apply the attributes to
  34769. * @argument {Object} styles
  34770. * Object with a list of properties and values which will be applied to the element
  34771. */
  34772. function setAttributes(element, attributes) {
  34773. Object.keys(attributes).forEach(function (prop) {
  34774. var value = attributes[prop];
  34775. if (value !== false) {
  34776. element.setAttribute(prop, attributes[prop]);
  34777. } else {
  34778. element.removeAttribute(prop);
  34779. }
  34780. });
  34781. }
  34782. /**
  34783. * @function
  34784. * @memberof Modifiers
  34785. * @argument {Object} data - The data object generated by `update` method
  34786. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  34787. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  34788. * @argument {Object} options - Modifiers configuration and options
  34789. * @returns {Object} The same data object
  34790. */
  34791. function applyStyle(data) {
  34792. // any property present in `data.styles` will be applied to the popper,
  34793. // in this way we can make the 3rd party modifiers add custom styles to it
  34794. // Be aware, modifiers could override the properties defined in the previous
  34795. // lines of this modifier!
  34796. setStyles(data.instance.popper, data.styles);
  34797. // any property present in `data.attributes` will be applied to the popper,
  34798. // they will be set as HTML attributes of the element
  34799. setAttributes(data.instance.popper, data.attributes);
  34800. // if arrowElement is defined and arrowStyles has some properties
  34801. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  34802. setStyles(data.arrowElement, data.arrowStyles);
  34803. }
  34804. return data;
  34805. }
  34806. /**
  34807. * Set the x-placement attribute before everything else because it could be used
  34808. * to add margins to the popper margins needs to be calculated to get the
  34809. * correct popper offsets.
  34810. * @method
  34811. * @memberof Popper.modifiers
  34812. * @param {HTMLElement} reference - The reference element used to position the popper
  34813. * @param {HTMLElement} popper - The HTML element used as popper
  34814. * @param {Object} options - Popper.js options
  34815. */
  34816. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  34817. // compute reference element offsets
  34818. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  34819. // compute auto placement, store placement inside the data object,
  34820. // modifiers will be able to edit `placement` if needed
  34821. // and refer to originalPlacement to know the original value
  34822. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  34823. popper.setAttribute('x-placement', placement);
  34824. // Apply `position` to popper before anything else because
  34825. // without the position applied we can't guarantee correct computations
  34826. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  34827. return options;
  34828. }
  34829. /**
  34830. * @function
  34831. * @memberof Popper.Utils
  34832. * @argument {Object} data - The data object generated by `update` method
  34833. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  34834. * @returns {Object} The popper's position offsets rounded
  34835. *
  34836. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  34837. * good as it can be within reason.
  34838. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  34839. *
  34840. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  34841. * as well on High DPI screens).
  34842. *
  34843. * Firefox prefers no rounding for positioning and does not have blurriness on
  34844. * high DPI screens.
  34845. *
  34846. * Only horizontal placement and left/right values need to be considered.
  34847. */
  34848. function getRoundedOffsets(data, shouldRound) {
  34849. var _data$offsets = data.offsets,
  34850. popper = _data$offsets.popper,
  34851. reference = _data$offsets.reference;
  34852. var round = Math.round,
  34853. floor = Math.floor;
  34854. var noRound = function noRound(v) {
  34855. return v;
  34856. };
  34857. var referenceWidth = round(reference.width);
  34858. var popperWidth = round(popper.width);
  34859. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  34860. var isVariation = data.placement.indexOf('-') !== -1;
  34861. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  34862. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  34863. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  34864. var verticalToInteger = !shouldRound ? noRound : round;
  34865. return {
  34866. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  34867. top: verticalToInteger(popper.top),
  34868. bottom: verticalToInteger(popper.bottom),
  34869. right: horizontalToInteger(popper.right)
  34870. };
  34871. }
  34872. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  34873. /**
  34874. * @function
  34875. * @memberof Modifiers
  34876. * @argument {Object} data - The data object generated by `update` method
  34877. * @argument {Object} options - Modifiers configuration and options
  34878. * @returns {Object} The data object, properly modified
  34879. */
  34880. function computeStyle(data, options) {
  34881. var x = options.x,
  34882. y = options.y;
  34883. var popper = data.offsets.popper;
  34884. // Remove this legacy support in Popper.js v2
  34885. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  34886. return modifier.name === 'applyStyle';
  34887. }).gpuAcceleration;
  34888. if (legacyGpuAccelerationOption !== undefined) {
  34889. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  34890. }
  34891. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  34892. var offsetParent = getOffsetParent(data.instance.popper);
  34893. var offsetParentRect = getBoundingClientRect(offsetParent);
  34894. // Styles
  34895. var styles = {
  34896. position: popper.position
  34897. };
  34898. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  34899. var sideA = x === 'bottom' ? 'top' : 'bottom';
  34900. var sideB = y === 'right' ? 'left' : 'right';
  34901. // if gpuAcceleration is set to `true` and transform is supported,
  34902. // we use `translate3d` to apply the position to the popper we
  34903. // automatically use the supported prefixed version if needed
  34904. var prefixedProperty = getSupportedPropertyName('transform');
  34905. // now, let's make a step back and look at this code closely (wtf?)
  34906. // If the content of the popper grows once it's been positioned, it
  34907. // may happen that the popper gets misplaced because of the new content
  34908. // overflowing its reference element
  34909. // To avoid this problem, we provide two options (x and y), which allow
  34910. // the consumer to define the offset origin.
  34911. // If we position a popper on top of a reference element, we can set
  34912. // `x` to `top` to make the popper grow towards its top instead of
  34913. // its bottom.
  34914. var left = void 0,
  34915. top = void 0;
  34916. if (sideA === 'bottom') {
  34917. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  34918. // and not the bottom of the html element
  34919. if (offsetParent.nodeName === 'HTML') {
  34920. top = -offsetParent.clientHeight + offsets.bottom;
  34921. } else {
  34922. top = -offsetParentRect.height + offsets.bottom;
  34923. }
  34924. } else {
  34925. top = offsets.top;
  34926. }
  34927. if (sideB === 'right') {
  34928. if (offsetParent.nodeName === 'HTML') {
  34929. left = -offsetParent.clientWidth + offsets.right;
  34930. } else {
  34931. left = -offsetParentRect.width + offsets.right;
  34932. }
  34933. } else {
  34934. left = offsets.left;
  34935. }
  34936. if (gpuAcceleration && prefixedProperty) {
  34937. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  34938. styles[sideA] = 0;
  34939. styles[sideB] = 0;
  34940. styles.willChange = 'transform';
  34941. } else {
  34942. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  34943. var invertTop = sideA === 'bottom' ? -1 : 1;
  34944. var invertLeft = sideB === 'right' ? -1 : 1;
  34945. styles[sideA] = top * invertTop;
  34946. styles[sideB] = left * invertLeft;
  34947. styles.willChange = sideA + ', ' + sideB;
  34948. }
  34949. // Attributes
  34950. var attributes = {
  34951. 'x-placement': data.placement
  34952. };
  34953. // Update `data` attributes, styles and arrowStyles
  34954. data.attributes = _extends({}, attributes, data.attributes);
  34955. data.styles = _extends({}, styles, data.styles);
  34956. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  34957. return data;
  34958. }
  34959. /**
  34960. * Helper used to know if the given modifier depends from another one.<br />
  34961. * It checks if the needed modifier is listed and enabled.
  34962. * @method
  34963. * @memberof Popper.Utils
  34964. * @param {Array} modifiers - list of modifiers
  34965. * @param {String} requestingName - name of requesting modifier
  34966. * @param {String} requestedName - name of requested modifier
  34967. * @returns {Boolean}
  34968. */
  34969. function isModifierRequired(modifiers, requestingName, requestedName) {
  34970. var requesting = find(modifiers, function (_ref) {
  34971. var name = _ref.name;
  34972. return name === requestingName;
  34973. });
  34974. var isRequired = !!requesting && modifiers.some(function (modifier) {
  34975. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  34976. });
  34977. if (!isRequired) {
  34978. var _requesting = '`' + requestingName + '`';
  34979. var requested = '`' + requestedName + '`';
  34980. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  34981. }
  34982. return isRequired;
  34983. }
  34984. /**
  34985. * @function
  34986. * @memberof Modifiers
  34987. * @argument {Object} data - The data object generated by update method
  34988. * @argument {Object} options - Modifiers configuration and options
  34989. * @returns {Object} The data object, properly modified
  34990. */
  34991. function arrow(data, options) {
  34992. var _data$offsets$arrow;
  34993. // arrow depends on keepTogether in order to work
  34994. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  34995. return data;
  34996. }
  34997. var arrowElement = options.element;
  34998. // if arrowElement is a string, suppose it's a CSS selector
  34999. if (typeof arrowElement === 'string') {
  35000. arrowElement = data.instance.popper.querySelector(arrowElement);
  35001. // if arrowElement is not found, don't run the modifier
  35002. if (!arrowElement) {
  35003. return data;
  35004. }
  35005. } else {
  35006. // if the arrowElement isn't a query selector we must check that the
  35007. // provided DOM node is child of its popper node
  35008. if (!data.instance.popper.contains(arrowElement)) {
  35009. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35010. return data;
  35011. }
  35012. }
  35013. var placement = data.placement.split('-')[0];
  35014. var _data$offsets = data.offsets,
  35015. popper = _data$offsets.popper,
  35016. reference = _data$offsets.reference;
  35017. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35018. var len = isVertical ? 'height' : 'width';
  35019. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35020. var side = sideCapitalized.toLowerCase();
  35021. var altSide = isVertical ? 'left' : 'top';
  35022. var opSide = isVertical ? 'bottom' : 'right';
  35023. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35024. //
  35025. // extends keepTogether behavior making sure the popper and its
  35026. // reference have enough pixels in conjunction
  35027. //
  35028. // top/left side
  35029. if (reference[opSide] - arrowElementSize < popper[side]) {
  35030. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35031. }
  35032. // bottom/right side
  35033. if (reference[side] + arrowElementSize > popper[opSide]) {
  35034. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35035. }
  35036. data.offsets.popper = getClientRect(data.offsets.popper);
  35037. // compute center of the popper
  35038. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35039. // Compute the sideValue using the updated popper offsets
  35040. // take popper margin in account because we don't have this info available
  35041. var css = getStyleComputedProperty(data.instance.popper);
  35042. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35043. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35044. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35045. // prevent arrowElement from being placed not contiguously to its popper
  35046. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35047. data.arrowElement = arrowElement;
  35048. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35049. return data;
  35050. }
  35051. /**
  35052. * Get the opposite placement variation of the given one
  35053. * @method
  35054. * @memberof Popper.Utils
  35055. * @argument {String} placement variation
  35056. * @returns {String} flipped placement variation
  35057. */
  35058. function getOppositeVariation(variation) {
  35059. if (variation === 'end') {
  35060. return 'start';
  35061. } else if (variation === 'start') {
  35062. return 'end';
  35063. }
  35064. return variation;
  35065. }
  35066. /**
  35067. * List of accepted placements to use as values of the `placement` option.<br />
  35068. * Valid placements are:
  35069. * - `auto`
  35070. * - `top`
  35071. * - `right`
  35072. * - `bottom`
  35073. * - `left`
  35074. *
  35075. * Each placement can have a variation from this list:
  35076. * - `-start`
  35077. * - `-end`
  35078. *
  35079. * Variations are interpreted easily if you think of them as the left to right
  35080. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35081. * is right.<br />
  35082. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35083. *
  35084. * Some valid examples are:
  35085. * - `top-end` (on top of reference, right aligned)
  35086. * - `right-start` (on right of reference, top aligned)
  35087. * - `bottom` (on bottom, centered)
  35088. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35089. *
  35090. * @static
  35091. * @type {Array}
  35092. * @enum {String}
  35093. * @readonly
  35094. * @method placements
  35095. * @memberof Popper
  35096. */
  35097. 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'];
  35098. // Get rid of `auto` `auto-start` and `auto-end`
  35099. var validPlacements = placements.slice(3);
  35100. /**
  35101. * Given an initial placement, returns all the subsequent placements
  35102. * clockwise (or counter-clockwise).
  35103. *
  35104. * @method
  35105. * @memberof Popper.Utils
  35106. * @argument {String} placement - A valid placement (it accepts variations)
  35107. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35108. * @returns {Array} placements including their variations
  35109. */
  35110. function clockwise(placement) {
  35111. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35112. var index = validPlacements.indexOf(placement);
  35113. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35114. return counter ? arr.reverse() : arr;
  35115. }
  35116. var BEHAVIORS = {
  35117. FLIP: 'flip',
  35118. CLOCKWISE: 'clockwise',
  35119. COUNTERCLOCKWISE: 'counterclockwise'
  35120. };
  35121. /**
  35122. * @function
  35123. * @memberof Modifiers
  35124. * @argument {Object} data - The data object generated by update method
  35125. * @argument {Object} options - Modifiers configuration and options
  35126. * @returns {Object} The data object, properly modified
  35127. */
  35128. function flip(data, options) {
  35129. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35130. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35131. return data;
  35132. }
  35133. if (data.flipped && data.placement === data.originalPlacement) {
  35134. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35135. return data;
  35136. }
  35137. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35138. var placement = data.placement.split('-')[0];
  35139. var placementOpposite = getOppositePlacement(placement);
  35140. var variation = data.placement.split('-')[1] || '';
  35141. var flipOrder = [];
  35142. switch (options.behavior) {
  35143. case BEHAVIORS.FLIP:
  35144. flipOrder = [placement, placementOpposite];
  35145. break;
  35146. case BEHAVIORS.CLOCKWISE:
  35147. flipOrder = clockwise(placement);
  35148. break;
  35149. case BEHAVIORS.COUNTERCLOCKWISE:
  35150. flipOrder = clockwise(placement, true);
  35151. break;
  35152. default:
  35153. flipOrder = options.behavior;
  35154. }
  35155. flipOrder.forEach(function (step, index) {
  35156. if (placement !== step || flipOrder.length === index + 1) {
  35157. return data;
  35158. }
  35159. placement = data.placement.split('-')[0];
  35160. placementOpposite = getOppositePlacement(placement);
  35161. var popperOffsets = data.offsets.popper;
  35162. var refOffsets = data.offsets.reference;
  35163. // using floor because the reference offsets may contain decimals we are not going to consider here
  35164. var floor = Math.floor;
  35165. 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);
  35166. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35167. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35168. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35169. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35170. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35171. // flip the variation if required
  35172. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35173. // flips variation if reference element overflows boundaries
  35174. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35175. // flips variation if popper content overflows boundaries
  35176. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35177. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35178. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35179. // this boolean to detect any flip loop
  35180. data.flipped = true;
  35181. if (overlapsRef || overflowsBoundaries) {
  35182. placement = flipOrder[index + 1];
  35183. }
  35184. if (flippedVariation) {
  35185. variation = getOppositeVariation(variation);
  35186. }
  35187. data.placement = placement + (variation ? '-' + variation : '');
  35188. // this object contains `position`, we want to preserve it along with
  35189. // any additional property we may add in the future
  35190. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35191. data = runModifiers(data.instance.modifiers, data, 'flip');
  35192. }
  35193. });
  35194. return data;
  35195. }
  35196. /**
  35197. * @function
  35198. * @memberof Modifiers
  35199. * @argument {Object} data - The data object generated by update method
  35200. * @argument {Object} options - Modifiers configuration and options
  35201. * @returns {Object} The data object, properly modified
  35202. */
  35203. function keepTogether(data) {
  35204. var _data$offsets = data.offsets,
  35205. popper = _data$offsets.popper,
  35206. reference = _data$offsets.reference;
  35207. var placement = data.placement.split('-')[0];
  35208. var floor = Math.floor;
  35209. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35210. var side = isVertical ? 'right' : 'bottom';
  35211. var opSide = isVertical ? 'left' : 'top';
  35212. var measurement = isVertical ? 'width' : 'height';
  35213. if (popper[side] < floor(reference[opSide])) {
  35214. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35215. }
  35216. if (popper[opSide] > floor(reference[side])) {
  35217. data.offsets.popper[opSide] = floor(reference[side]);
  35218. }
  35219. return data;
  35220. }
  35221. /**
  35222. * Converts a string containing value + unit into a px value number
  35223. * @function
  35224. * @memberof {modifiers~offset}
  35225. * @private
  35226. * @argument {String} str - Value + unit string
  35227. * @argument {String} measurement - `height` or `width`
  35228. * @argument {Object} popperOffsets
  35229. * @argument {Object} referenceOffsets
  35230. * @returns {Number|String}
  35231. * Value in pixels, or original string if no values were extracted
  35232. */
  35233. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35234. // separate value from unit
  35235. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35236. var value = +split[1];
  35237. var unit = split[2];
  35238. // If it's not a number it's an operator, I guess
  35239. if (!value) {
  35240. return str;
  35241. }
  35242. if (unit.indexOf('%') === 0) {
  35243. var element = void 0;
  35244. switch (unit) {
  35245. case '%p':
  35246. element = popperOffsets;
  35247. break;
  35248. case '%':
  35249. case '%r':
  35250. default:
  35251. element = referenceOffsets;
  35252. }
  35253. var rect = getClientRect(element);
  35254. return rect[measurement] / 100 * value;
  35255. } else if (unit === 'vh' || unit === 'vw') {
  35256. // if is a vh or vw, we calculate the size based on the viewport
  35257. var size = void 0;
  35258. if (unit === 'vh') {
  35259. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35260. } else {
  35261. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35262. }
  35263. return size / 100 * value;
  35264. } else {
  35265. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35266. // if is an implicit unit, it's px, and we return just the value
  35267. return value;
  35268. }
  35269. }
  35270. /**
  35271. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35272. * @function
  35273. * @memberof {modifiers~offset}
  35274. * @private
  35275. * @argument {String} offset
  35276. * @argument {Object} popperOffsets
  35277. * @argument {Object} referenceOffsets
  35278. * @argument {String} basePlacement
  35279. * @returns {Array} a two cells array with x and y offsets in numbers
  35280. */
  35281. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35282. var offsets = [0, 0];
  35283. // Use height if placement is left or right and index is 0 otherwise use width
  35284. // in this way the first offset will use an axis and the second one
  35285. // will use the other one
  35286. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35287. // Split the offset string to obtain a list of values and operands
  35288. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35289. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35290. return frag.trim();
  35291. });
  35292. // Detect if the offset string contains a pair of values or a single one
  35293. // they could be separated by comma or space
  35294. var divider = fragments.indexOf(find(fragments, function (frag) {
  35295. return frag.search(/,|\s/) !== -1;
  35296. }));
  35297. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35298. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35299. }
  35300. // If divider is found, we divide the list of values and operands to divide
  35301. // them by ofset X and Y.
  35302. var splitRegex = /\s*,\s*|\s+/;
  35303. 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];
  35304. // Convert the values with units to absolute pixels to allow our computations
  35305. ops = ops.map(function (op, index) {
  35306. // Most of the units rely on the orientation of the popper
  35307. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35308. var mergeWithPrevious = false;
  35309. return op
  35310. // This aggregates any `+` or `-` sign that aren't considered operators
  35311. // e.g.: 10 + +5 => [10, +, +5]
  35312. .reduce(function (a, b) {
  35313. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35314. a[a.length - 1] = b;
  35315. mergeWithPrevious = true;
  35316. return a;
  35317. } else if (mergeWithPrevious) {
  35318. a[a.length - 1] += b;
  35319. mergeWithPrevious = false;
  35320. return a;
  35321. } else {
  35322. return a.concat(b);
  35323. }
  35324. }, [])
  35325. // Here we convert the string values into number values (in px)
  35326. .map(function (str) {
  35327. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35328. });
  35329. });
  35330. // Loop trough the offsets arrays and execute the operations
  35331. ops.forEach(function (op, index) {
  35332. op.forEach(function (frag, index2) {
  35333. if (isNumeric(frag)) {
  35334. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35335. }
  35336. });
  35337. });
  35338. return offsets;
  35339. }
  35340. /**
  35341. * @function
  35342. * @memberof Modifiers
  35343. * @argument {Object} data - The data object generated by update method
  35344. * @argument {Object} options - Modifiers configuration and options
  35345. * @argument {Number|String} options.offset=0
  35346. * The offset value as described in the modifier description
  35347. * @returns {Object} The data object, properly modified
  35348. */
  35349. function offset(data, _ref) {
  35350. var offset = _ref.offset;
  35351. var placement = data.placement,
  35352. _data$offsets = data.offsets,
  35353. popper = _data$offsets.popper,
  35354. reference = _data$offsets.reference;
  35355. var basePlacement = placement.split('-')[0];
  35356. var offsets = void 0;
  35357. if (isNumeric(+offset)) {
  35358. offsets = [+offset, 0];
  35359. } else {
  35360. offsets = parseOffset(offset, popper, reference, basePlacement);
  35361. }
  35362. if (basePlacement === 'left') {
  35363. popper.top += offsets[0];
  35364. popper.left -= offsets[1];
  35365. } else if (basePlacement === 'right') {
  35366. popper.top += offsets[0];
  35367. popper.left += offsets[1];
  35368. } else if (basePlacement === 'top') {
  35369. popper.left += offsets[0];
  35370. popper.top -= offsets[1];
  35371. } else if (basePlacement === 'bottom') {
  35372. popper.left += offsets[0];
  35373. popper.top += offsets[1];
  35374. }
  35375. data.popper = popper;
  35376. return data;
  35377. }
  35378. /**
  35379. * @function
  35380. * @memberof Modifiers
  35381. * @argument {Object} data - The data object generated by `update` method
  35382. * @argument {Object} options - Modifiers configuration and options
  35383. * @returns {Object} The data object, properly modified
  35384. */
  35385. function preventOverflow(data, options) {
  35386. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35387. // If offsetParent is the reference element, we really want to
  35388. // go one step up and use the next offsetParent as reference to
  35389. // avoid to make this modifier completely useless and look like broken
  35390. if (data.instance.reference === boundariesElement) {
  35391. boundariesElement = getOffsetParent(boundariesElement);
  35392. }
  35393. // NOTE: DOM access here
  35394. // resets the popper's position so that the document size can be calculated excluding
  35395. // the size of the popper element itself
  35396. var transformProp = getSupportedPropertyName('transform');
  35397. var popperStyles = data.instance.popper.style; // assignment to help minification
  35398. var top = popperStyles.top,
  35399. left = popperStyles.left,
  35400. transform = popperStyles[transformProp];
  35401. popperStyles.top = '';
  35402. popperStyles.left = '';
  35403. popperStyles[transformProp] = '';
  35404. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35405. // NOTE: DOM access here
  35406. // restores the original style properties after the offsets have been computed
  35407. popperStyles.top = top;
  35408. popperStyles.left = left;
  35409. popperStyles[transformProp] = transform;
  35410. options.boundaries = boundaries;
  35411. var order = options.priority;
  35412. var popper = data.offsets.popper;
  35413. var check = {
  35414. primary: function primary(placement) {
  35415. var value = popper[placement];
  35416. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35417. value = Math.max(popper[placement], boundaries[placement]);
  35418. }
  35419. return defineProperty({}, placement, value);
  35420. },
  35421. secondary: function secondary(placement) {
  35422. var mainSide = placement === 'right' ? 'left' : 'top';
  35423. var value = popper[mainSide];
  35424. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35425. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35426. }
  35427. return defineProperty({}, mainSide, value);
  35428. }
  35429. };
  35430. order.forEach(function (placement) {
  35431. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35432. popper = _extends({}, popper, check[side](placement));
  35433. });
  35434. data.offsets.popper = popper;
  35435. return data;
  35436. }
  35437. /**
  35438. * @function
  35439. * @memberof Modifiers
  35440. * @argument {Object} data - The data object generated by `update` method
  35441. * @argument {Object} options - Modifiers configuration and options
  35442. * @returns {Object} The data object, properly modified
  35443. */
  35444. function shift(data) {
  35445. var placement = data.placement;
  35446. var basePlacement = placement.split('-')[0];
  35447. var shiftvariation = placement.split('-')[1];
  35448. // if shift shiftvariation is specified, run the modifier
  35449. if (shiftvariation) {
  35450. var _data$offsets = data.offsets,
  35451. reference = _data$offsets.reference,
  35452. popper = _data$offsets.popper;
  35453. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35454. var side = isVertical ? 'left' : 'top';
  35455. var measurement = isVertical ? 'width' : 'height';
  35456. var shiftOffsets = {
  35457. start: defineProperty({}, side, reference[side]),
  35458. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35459. };
  35460. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35461. }
  35462. return data;
  35463. }
  35464. /**
  35465. * @function
  35466. * @memberof Modifiers
  35467. * @argument {Object} data - The data object generated by update method
  35468. * @argument {Object} options - Modifiers configuration and options
  35469. * @returns {Object} The data object, properly modified
  35470. */
  35471. function hide(data) {
  35472. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35473. return data;
  35474. }
  35475. var refRect = data.offsets.reference;
  35476. var bound = find(data.instance.modifiers, function (modifier) {
  35477. return modifier.name === 'preventOverflow';
  35478. }).boundaries;
  35479. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35480. // Avoid unnecessary DOM access if visibility hasn't changed
  35481. if (data.hide === true) {
  35482. return data;
  35483. }
  35484. data.hide = true;
  35485. data.attributes['x-out-of-boundaries'] = '';
  35486. } else {
  35487. // Avoid unnecessary DOM access if visibility hasn't changed
  35488. if (data.hide === false) {
  35489. return data;
  35490. }
  35491. data.hide = false;
  35492. data.attributes['x-out-of-boundaries'] = false;
  35493. }
  35494. return data;
  35495. }
  35496. /**
  35497. * @function
  35498. * @memberof Modifiers
  35499. * @argument {Object} data - The data object generated by `update` method
  35500. * @argument {Object} options - Modifiers configuration and options
  35501. * @returns {Object} The data object, properly modified
  35502. */
  35503. function inner(data) {
  35504. var placement = data.placement;
  35505. var basePlacement = placement.split('-')[0];
  35506. var _data$offsets = data.offsets,
  35507. popper = _data$offsets.popper,
  35508. reference = _data$offsets.reference;
  35509. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35510. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35511. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35512. data.placement = getOppositePlacement(placement);
  35513. data.offsets.popper = getClientRect(popper);
  35514. return data;
  35515. }
  35516. /**
  35517. * Modifier function, each modifier can have a function of this type assigned
  35518. * to its `fn` property.<br />
  35519. * These functions will be called on each update, this means that you must
  35520. * make sure they are performant enough to avoid performance bottlenecks.
  35521. *
  35522. * @function ModifierFn
  35523. * @argument {dataObject} data - The data object generated by `update` method
  35524. * @argument {Object} options - Modifiers configuration and options
  35525. * @returns {dataObject} The data object, properly modified
  35526. */
  35527. /**
  35528. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35529. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35530. * needed by the library.
  35531. *
  35532. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35533. * All the other properties are configurations that could be tweaked.
  35534. * @namespace modifiers
  35535. */
  35536. var modifiers = {
  35537. /**
  35538. * Modifier used to shift the popper on the start or end of its reference
  35539. * element.<br />
  35540. * It will read the variation of the `placement` property.<br />
  35541. * It can be one either `-end` or `-start`.
  35542. * @memberof modifiers
  35543. * @inner
  35544. */
  35545. shift: {
  35546. /** @prop {number} order=100 - Index used to define the order of execution */
  35547. order: 100,
  35548. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35549. enabled: true,
  35550. /** @prop {ModifierFn} */
  35551. fn: shift
  35552. },
  35553. /**
  35554. * The `offset` modifier can shift your popper on both its axis.
  35555. *
  35556. * It accepts the following units:
  35557. * - `px` or unit-less, interpreted as pixels
  35558. * - `%` or `%r`, percentage relative to the length of the reference element
  35559. * - `%p`, percentage relative to the length of the popper element
  35560. * - `vw`, CSS viewport width unit
  35561. * - `vh`, CSS viewport height unit
  35562. *
  35563. * For length is intended the main axis relative to the placement of the popper.<br />
  35564. * This means that if the placement is `top` or `bottom`, the length will be the
  35565. * `width`. In case of `left` or `right`, it will be the `height`.
  35566. *
  35567. * You can provide a single value (as `Number` or `String`), or a pair of values
  35568. * as `String` divided by a comma or one (or more) white spaces.<br />
  35569. * The latter is a deprecated method because it leads to confusion and will be
  35570. * removed in v2.<br />
  35571. * Additionally, it accepts additions and subtractions between different units.
  35572. * Note that multiplications and divisions aren't supported.
  35573. *
  35574. * Valid examples are:
  35575. * ```
  35576. * 10
  35577. * '10%'
  35578. * '10, 10'
  35579. * '10%, 10'
  35580. * '10 + 10%'
  35581. * '10 - 5vh + 3%'
  35582. * '-10px + 5vh, 5px - 6%'
  35583. * ```
  35584. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35585. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35586. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35587. *
  35588. * @memberof modifiers
  35589. * @inner
  35590. */
  35591. offset: {
  35592. /** @prop {number} order=200 - Index used to define the order of execution */
  35593. order: 200,
  35594. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35595. enabled: true,
  35596. /** @prop {ModifierFn} */
  35597. fn: offset,
  35598. /** @prop {Number|String} offset=0
  35599. * The offset value as described in the modifier description
  35600. */
  35601. offset: 0
  35602. },
  35603. /**
  35604. * Modifier used to prevent the popper from being positioned outside the boundary.
  35605. *
  35606. * A scenario exists where the reference itself is not within the boundaries.<br />
  35607. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35608. * In this case we need to decide whether the popper should either:
  35609. *
  35610. * - detach from the reference and remain "trapped" in the boundaries, or
  35611. * - if it should ignore the boundary and "escape with its reference"
  35612. *
  35613. * When `escapeWithReference` is set to`true` and reference is completely
  35614. * outside its boundaries, the popper will overflow (or completely leave)
  35615. * the boundaries in order to remain attached to the edge of the reference.
  35616. *
  35617. * @memberof modifiers
  35618. * @inner
  35619. */
  35620. preventOverflow: {
  35621. /** @prop {number} order=300 - Index used to define the order of execution */
  35622. order: 300,
  35623. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35624. enabled: true,
  35625. /** @prop {ModifierFn} */
  35626. fn: preventOverflow,
  35627. /**
  35628. * @prop {Array} [priority=['left','right','top','bottom']]
  35629. * Popper will try to prevent overflow following these priorities by default,
  35630. * then, it could overflow on the left and on top of the `boundariesElement`
  35631. */
  35632. priority: ['left', 'right', 'top', 'bottom'],
  35633. /**
  35634. * @prop {number} padding=5
  35635. * Amount of pixel used to define a minimum distance between the boundaries
  35636. * and the popper. This makes sure the popper always has a little padding
  35637. * between the edges of its container
  35638. */
  35639. padding: 5,
  35640. /**
  35641. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35642. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35643. * `viewport` or any DOM element.
  35644. */
  35645. boundariesElement: 'scrollParent'
  35646. },
  35647. /**
  35648. * Modifier used to make sure the reference and its popper stay near each other
  35649. * without leaving any gap between the two. Especially useful when the arrow is
  35650. * enabled and you want to ensure that it points to its reference element.
  35651. * It cares only about the first axis. You can still have poppers with margin
  35652. * between the popper and its reference element.
  35653. * @memberof modifiers
  35654. * @inner
  35655. */
  35656. keepTogether: {
  35657. /** @prop {number} order=400 - Index used to define the order of execution */
  35658. order: 400,
  35659. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35660. enabled: true,
  35661. /** @prop {ModifierFn} */
  35662. fn: keepTogether
  35663. },
  35664. /**
  35665. * This modifier is used to move the `arrowElement` of the popper to make
  35666. * sure it is positioned between the reference element and its popper element.
  35667. * It will read the outer size of the `arrowElement` node to detect how many
  35668. * pixels of conjunction are needed.
  35669. *
  35670. * It has no effect if no `arrowElement` is provided.
  35671. * @memberof modifiers
  35672. * @inner
  35673. */
  35674. arrow: {
  35675. /** @prop {number} order=500 - Index used to define the order of execution */
  35676. order: 500,
  35677. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35678. enabled: true,
  35679. /** @prop {ModifierFn} */
  35680. fn: arrow,
  35681. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35682. element: '[x-arrow]'
  35683. },
  35684. /**
  35685. * Modifier used to flip the popper's placement when it starts to overlap its
  35686. * reference element.
  35687. *
  35688. * Requires the `preventOverflow` modifier before it in order to work.
  35689. *
  35690. * **NOTE:** this modifier will interrupt the current update cycle and will
  35691. * restart it if it detects the need to flip the placement.
  35692. * @memberof modifiers
  35693. * @inner
  35694. */
  35695. flip: {
  35696. /** @prop {number} order=600 - Index used to define the order of execution */
  35697. order: 600,
  35698. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35699. enabled: true,
  35700. /** @prop {ModifierFn} */
  35701. fn: flip,
  35702. /**
  35703. * @prop {String|Array} behavior='flip'
  35704. * The behavior used to change the popper's placement. It can be one of
  35705. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35706. * placements (with optional variations)
  35707. */
  35708. behavior: 'flip',
  35709. /**
  35710. * @prop {number} padding=5
  35711. * The popper will flip if it hits the edges of the `boundariesElement`
  35712. */
  35713. padding: 5,
  35714. /**
  35715. * @prop {String|HTMLElement} boundariesElement='viewport'
  35716. * The element which will define the boundaries of the popper position.
  35717. * The popper will never be placed outside of the defined boundaries
  35718. * (except if `keepTogether` is enabled)
  35719. */
  35720. boundariesElement: 'viewport',
  35721. /**
  35722. * @prop {Boolean} flipVariations=false
  35723. * The popper will switch placement variation between `-start` and `-end` when
  35724. * the reference element overlaps its boundaries.
  35725. *
  35726. * The original placement should have a set variation.
  35727. */
  35728. flipVariations: false,
  35729. /**
  35730. * @prop {Boolean} flipVariationsByContent=false
  35731. * The popper will switch placement variation between `-start` and `-end` when
  35732. * the popper element overlaps its reference boundaries.
  35733. *
  35734. * The original placement should have a set variation.
  35735. */
  35736. flipVariationsByContent: false
  35737. },
  35738. /**
  35739. * Modifier used to make the popper flow toward the inner of the reference element.
  35740. * By default, when this modifier is disabled, the popper will be placed outside
  35741. * the reference element.
  35742. * @memberof modifiers
  35743. * @inner
  35744. */
  35745. inner: {
  35746. /** @prop {number} order=700 - Index used to define the order of execution */
  35747. order: 700,
  35748. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  35749. enabled: false,
  35750. /** @prop {ModifierFn} */
  35751. fn: inner
  35752. },
  35753. /**
  35754. * Modifier used to hide the popper when its reference element is outside of the
  35755. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  35756. * be used to hide with a CSS selector the popper when its reference is
  35757. * out of boundaries.
  35758. *
  35759. * Requires the `preventOverflow` modifier before it in order to work.
  35760. * @memberof modifiers
  35761. * @inner
  35762. */
  35763. hide: {
  35764. /** @prop {number} order=800 - Index used to define the order of execution */
  35765. order: 800,
  35766. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35767. enabled: true,
  35768. /** @prop {ModifierFn} */
  35769. fn: hide
  35770. },
  35771. /**
  35772. * Computes the style that will be applied to the popper element to gets
  35773. * properly positioned.
  35774. *
  35775. * Note that this modifier will not touch the DOM, it just prepares the styles
  35776. * so that `applyStyle` modifier can apply it. This separation is useful
  35777. * in case you need to replace `applyStyle` with a custom implementation.
  35778. *
  35779. * This modifier has `850` as `order` value to maintain backward compatibility
  35780. * with previous versions of Popper.js. Expect the modifiers ordering method
  35781. * to change in future major versions of the library.
  35782. *
  35783. * @memberof modifiers
  35784. * @inner
  35785. */
  35786. computeStyle: {
  35787. /** @prop {number} order=850 - Index used to define the order of execution */
  35788. order: 850,
  35789. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35790. enabled: true,
  35791. /** @prop {ModifierFn} */
  35792. fn: computeStyle,
  35793. /**
  35794. * @prop {Boolean} gpuAcceleration=true
  35795. * If true, it uses the CSS 3D transformation to position the popper.
  35796. * Otherwise, it will use the `top` and `left` properties
  35797. */
  35798. gpuAcceleration: true,
  35799. /**
  35800. * @prop {string} [x='bottom']
  35801. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  35802. * Change this if your popper should grow in a direction different from `bottom`
  35803. */
  35804. x: 'bottom',
  35805. /**
  35806. * @prop {string} [x='left']
  35807. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  35808. * Change this if your popper should grow in a direction different from `right`
  35809. */
  35810. y: 'right'
  35811. },
  35812. /**
  35813. * Applies the computed styles to the popper element.
  35814. *
  35815. * All the DOM manipulations are limited to this modifier. This is useful in case
  35816. * you want to integrate Popper.js inside a framework or view library and you
  35817. * want to delegate all the DOM manipulations to it.
  35818. *
  35819. * Note that if you disable this modifier, you must make sure the popper element
  35820. * has its position set to `absolute` before Popper.js can do its work!
  35821. *
  35822. * Just disable this modifier and define your own to achieve the desired effect.
  35823. *
  35824. * @memberof modifiers
  35825. * @inner
  35826. */
  35827. applyStyle: {
  35828. /** @prop {number} order=900 - Index used to define the order of execution */
  35829. order: 900,
  35830. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35831. enabled: true,
  35832. /** @prop {ModifierFn} */
  35833. fn: applyStyle,
  35834. /** @prop {Function} */
  35835. onLoad: applyStyleOnLoad,
  35836. /**
  35837. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  35838. * @prop {Boolean} gpuAcceleration=true
  35839. * If true, it uses the CSS 3D transformation to position the popper.
  35840. * Otherwise, it will use the `top` and `left` properties
  35841. */
  35842. gpuAcceleration: undefined
  35843. }
  35844. };
  35845. /**
  35846. * The `dataObject` is an object containing all the information used by Popper.js.
  35847. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  35848. * @name dataObject
  35849. * @property {Object} data.instance The Popper.js instance
  35850. * @property {String} data.placement Placement applied to popper
  35851. * @property {String} data.originalPlacement Placement originally defined on init
  35852. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  35853. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  35854. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  35855. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  35856. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  35857. * @property {Object} data.boundaries Offsets of the popper boundaries
  35858. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  35859. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  35860. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  35861. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  35862. */
  35863. /**
  35864. * Default options provided to Popper.js constructor.<br />
  35865. * These can be overridden using the `options` argument of Popper.js.<br />
  35866. * To override an option, simply pass an object with the same
  35867. * structure of the `options` object, as the 3rd argument. For example:
  35868. * ```
  35869. * new Popper(ref, pop, {
  35870. * modifiers: {
  35871. * preventOverflow: { enabled: false }
  35872. * }
  35873. * })
  35874. * ```
  35875. * @type {Object}
  35876. * @static
  35877. * @memberof Popper
  35878. */
  35879. var Defaults = {
  35880. /**
  35881. * Popper's placement.
  35882. * @prop {Popper.placements} placement='bottom'
  35883. */
  35884. placement: 'bottom',
  35885. /**
  35886. * Set this to true if you want popper to position it self in 'fixed' mode
  35887. * @prop {Boolean} positionFixed=false
  35888. */
  35889. positionFixed: false,
  35890. /**
  35891. * Whether events (resize, scroll) are initially enabled.
  35892. * @prop {Boolean} eventsEnabled=true
  35893. */
  35894. eventsEnabled: true,
  35895. /**
  35896. * Set to true if you want to automatically remove the popper when
  35897. * you call the `destroy` method.
  35898. * @prop {Boolean} removeOnDestroy=false
  35899. */
  35900. removeOnDestroy: false,
  35901. /**
  35902. * Callback called when the popper is created.<br />
  35903. * By default, it is set to no-op.<br />
  35904. * Access Popper.js instance with `data.instance`.
  35905. * @prop {onCreate}
  35906. */
  35907. onCreate: function onCreate() {},
  35908. /**
  35909. * Callback called when the popper is updated. This callback is not called
  35910. * on the initialization/creation of the popper, but only on subsequent
  35911. * updates.<br />
  35912. * By default, it is set to no-op.<br />
  35913. * Access Popper.js instance with `data.instance`.
  35914. * @prop {onUpdate}
  35915. */
  35916. onUpdate: function onUpdate() {},
  35917. /**
  35918. * List of modifiers used to modify the offsets before they are applied to the popper.
  35919. * They provide most of the functionalities of Popper.js.
  35920. * @prop {modifiers}
  35921. */
  35922. modifiers: modifiers
  35923. };
  35924. /**
  35925. * @callback onCreate
  35926. * @param {dataObject} data
  35927. */
  35928. /**
  35929. * @callback onUpdate
  35930. * @param {dataObject} data
  35931. */
  35932. // Utils
  35933. // Methods
  35934. var Popper = function () {
  35935. /**
  35936. * Creates a new Popper.js instance.
  35937. * @class Popper
  35938. * @param {Element|referenceObject} reference - The reference element used to position the popper
  35939. * @param {Element} popper - The HTML / XML element used as the popper
  35940. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  35941. * @return {Object} instance - The generated Popper.js instance
  35942. */
  35943. function Popper(reference, popper) {
  35944. var _this = this;
  35945. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  35946. classCallCheck(this, Popper);
  35947. this.scheduleUpdate = function () {
  35948. return requestAnimationFrame(_this.update);
  35949. };
  35950. // make update() debounced, so that it only runs at most once-per-tick
  35951. this.update = debounce(this.update.bind(this));
  35952. // with {} we create a new object with the options inside it
  35953. this.options = _extends({}, Popper.Defaults, options);
  35954. // init state
  35955. this.state = {
  35956. isDestroyed: false,
  35957. isCreated: false,
  35958. scrollParents: []
  35959. };
  35960. // get reference and popper elements (allow jQuery wrappers)
  35961. this.reference = reference && reference.jquery ? reference[0] : reference;
  35962. this.popper = popper && popper.jquery ? popper[0] : popper;
  35963. // Deep merge modifiers options
  35964. this.options.modifiers = {};
  35965. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  35966. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  35967. });
  35968. // Refactoring modifiers' list (Object => Array)
  35969. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  35970. return _extends({
  35971. name: name
  35972. }, _this.options.modifiers[name]);
  35973. })
  35974. // sort the modifiers by order
  35975. .sort(function (a, b) {
  35976. return a.order - b.order;
  35977. });
  35978. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  35979. // such code is executed in the same order of its modifier
  35980. // they could add new properties to their options configuration
  35981. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  35982. this.modifiers.forEach(function (modifierOptions) {
  35983. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  35984. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  35985. }
  35986. });
  35987. // fire the first update to position the popper in the right place
  35988. this.update();
  35989. var eventsEnabled = this.options.eventsEnabled;
  35990. if (eventsEnabled) {
  35991. // setup event listeners, they will take care of update the position in specific situations
  35992. this.enableEventListeners();
  35993. }
  35994. this.state.eventsEnabled = eventsEnabled;
  35995. }
  35996. // We can't use class properties because they don't get listed in the
  35997. // class prototype and break stuff like Sinon stubs
  35998. createClass(Popper, [{
  35999. key: 'update',
  36000. value: function update$$1() {
  36001. return update.call(this);
  36002. }
  36003. }, {
  36004. key: 'destroy',
  36005. value: function destroy$$1() {
  36006. return destroy.call(this);
  36007. }
  36008. }, {
  36009. key: 'enableEventListeners',
  36010. value: function enableEventListeners$$1() {
  36011. return enableEventListeners.call(this);
  36012. }
  36013. }, {
  36014. key: 'disableEventListeners',
  36015. value: function disableEventListeners$$1() {
  36016. return disableEventListeners.call(this);
  36017. }
  36018. /**
  36019. * Schedules an update. It will run on the next UI update available.
  36020. * @method scheduleUpdate
  36021. * @memberof Popper
  36022. */
  36023. /**
  36024. * Collection of utilities useful when writing custom modifiers.
  36025. * Starting from version 1.7, this method is available only if you
  36026. * include `popper-utils.js` before `popper.js`.
  36027. *
  36028. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36029. * and will be removed in v2! Use the PopperUtils module directly instead.
  36030. * Due to the high instability of the methods contained in Utils, we can't
  36031. * guarantee them to follow semver. Use them at your own risk!
  36032. * @static
  36033. * @private
  36034. * @type {Object}
  36035. * @deprecated since version 1.8
  36036. * @member Utils
  36037. * @memberof Popper
  36038. */
  36039. }]);
  36040. return Popper;
  36041. }();
  36042. /**
  36043. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36044. * and lets you use it as replacement of a real DOM node.<br />
  36045. * You can use this method to position a popper relatively to a set of coordinates
  36046. * in case you don't have a DOM node to use as reference.
  36047. *
  36048. * ```
  36049. * new Popper(referenceObject, popperNode);
  36050. * ```
  36051. *
  36052. * NB: This feature isn't supported in Internet Explorer 10.
  36053. * @name referenceObject
  36054. * @property {Function} data.getBoundingClientRect
  36055. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36056. * @property {number} data.clientWidth
  36057. * An ES6 getter that will return the width of the virtual reference element.
  36058. * @property {number} data.clientHeight
  36059. * An ES6 getter that will return the height of the virtual reference element.
  36060. */
  36061. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36062. Popper.placements = placements;
  36063. Popper.Defaults = Defaults;
  36064. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36065. //# sourceMappingURL=popper.js.map
  36066. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36067. /***/ }),
  36068. /***/ "./node_modules/process/browser.js":
  36069. /*!*****************************************!*\
  36070. !*** ./node_modules/process/browser.js ***!
  36071. \*****************************************/
  36072. /*! no static exports found */
  36073. /***/ (function(module, exports) {
  36074. // shim for using process in browser
  36075. var process = module.exports = {};
  36076. // cached from whatever global is present so that test runners that stub it
  36077. // don't break things. But we need to wrap it in a try catch in case it is
  36078. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36079. // function because try/catches deoptimize in certain engines.
  36080. var cachedSetTimeout;
  36081. var cachedClearTimeout;
  36082. function defaultSetTimout() {
  36083. throw new Error('setTimeout has not been defined');
  36084. }
  36085. function defaultClearTimeout () {
  36086. throw new Error('clearTimeout has not been defined');
  36087. }
  36088. (function () {
  36089. try {
  36090. if (typeof setTimeout === 'function') {
  36091. cachedSetTimeout = setTimeout;
  36092. } else {
  36093. cachedSetTimeout = defaultSetTimout;
  36094. }
  36095. } catch (e) {
  36096. cachedSetTimeout = defaultSetTimout;
  36097. }
  36098. try {
  36099. if (typeof clearTimeout === 'function') {
  36100. cachedClearTimeout = clearTimeout;
  36101. } else {
  36102. cachedClearTimeout = defaultClearTimeout;
  36103. }
  36104. } catch (e) {
  36105. cachedClearTimeout = defaultClearTimeout;
  36106. }
  36107. } ())
  36108. function runTimeout(fun) {
  36109. if (cachedSetTimeout === setTimeout) {
  36110. //normal enviroments in sane situations
  36111. return setTimeout(fun, 0);
  36112. }
  36113. // if setTimeout wasn't available but was latter defined
  36114. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36115. cachedSetTimeout = setTimeout;
  36116. return setTimeout(fun, 0);
  36117. }
  36118. try {
  36119. // when when somebody has screwed with setTimeout but no I.E. maddness
  36120. return cachedSetTimeout(fun, 0);
  36121. } catch(e){
  36122. try {
  36123. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36124. return cachedSetTimeout.call(null, fun, 0);
  36125. } catch(e){
  36126. // 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
  36127. return cachedSetTimeout.call(this, fun, 0);
  36128. }
  36129. }
  36130. }
  36131. function runClearTimeout(marker) {
  36132. if (cachedClearTimeout === clearTimeout) {
  36133. //normal enviroments in sane situations
  36134. return clearTimeout(marker);
  36135. }
  36136. // if clearTimeout wasn't available but was latter defined
  36137. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36138. cachedClearTimeout = clearTimeout;
  36139. return clearTimeout(marker);
  36140. }
  36141. try {
  36142. // when when somebody has screwed with setTimeout but no I.E. maddness
  36143. return cachedClearTimeout(marker);
  36144. } catch (e){
  36145. try {
  36146. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36147. return cachedClearTimeout.call(null, marker);
  36148. } catch (e){
  36149. // 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.
  36150. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36151. return cachedClearTimeout.call(this, marker);
  36152. }
  36153. }
  36154. }
  36155. var queue = [];
  36156. var draining = false;
  36157. var currentQueue;
  36158. var queueIndex = -1;
  36159. function cleanUpNextTick() {
  36160. if (!draining || !currentQueue) {
  36161. return;
  36162. }
  36163. draining = false;
  36164. if (currentQueue.length) {
  36165. queue = currentQueue.concat(queue);
  36166. } else {
  36167. queueIndex = -1;
  36168. }
  36169. if (queue.length) {
  36170. drainQueue();
  36171. }
  36172. }
  36173. function drainQueue() {
  36174. if (draining) {
  36175. return;
  36176. }
  36177. var timeout = runTimeout(cleanUpNextTick);
  36178. draining = true;
  36179. var len = queue.length;
  36180. while(len) {
  36181. currentQueue = queue;
  36182. queue = [];
  36183. while (++queueIndex < len) {
  36184. if (currentQueue) {
  36185. currentQueue[queueIndex].run();
  36186. }
  36187. }
  36188. queueIndex = -1;
  36189. len = queue.length;
  36190. }
  36191. currentQueue = null;
  36192. draining = false;
  36193. runClearTimeout(timeout);
  36194. }
  36195. process.nextTick = function (fun) {
  36196. var args = new Array(arguments.length - 1);
  36197. if (arguments.length > 1) {
  36198. for (var i = 1; i < arguments.length; i++) {
  36199. args[i - 1] = arguments[i];
  36200. }
  36201. }
  36202. queue.push(new Item(fun, args));
  36203. if (queue.length === 1 && !draining) {
  36204. runTimeout(drainQueue);
  36205. }
  36206. };
  36207. // v8 likes predictible objects
  36208. function Item(fun, array) {
  36209. this.fun = fun;
  36210. this.array = array;
  36211. }
  36212. Item.prototype.run = function () {
  36213. this.fun.apply(null, this.array);
  36214. };
  36215. process.title = 'browser';
  36216. process.browser = true;
  36217. process.env = {};
  36218. process.argv = [];
  36219. process.version = ''; // empty string to avoid regexp issues
  36220. process.versions = {};
  36221. function noop() {}
  36222. process.on = noop;
  36223. process.addListener = noop;
  36224. process.once = noop;
  36225. process.off = noop;
  36226. process.removeListener = noop;
  36227. process.removeAllListeners = noop;
  36228. process.emit = noop;
  36229. process.prependListener = noop;
  36230. process.prependOnceListener = noop;
  36231. process.listeners = function (name) { return [] }
  36232. process.binding = function (name) {
  36233. throw new Error('process.binding is not supported');
  36234. };
  36235. process.cwd = function () { return '/' };
  36236. process.chdir = function (dir) {
  36237. throw new Error('process.chdir is not supported');
  36238. };
  36239. process.umask = function() { return 0; };
  36240. /***/ }),
  36241. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36242. /*!***************************************************!*\
  36243. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36244. \***************************************************/
  36245. /*! no static exports found */
  36246. /***/ (function(module, exports, __webpack_require__) {
  36247. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36248. * Pusher JavaScript Library v5.0.3
  36249. * https://pusher.com/
  36250. *
  36251. * Copyright 2017, Pusher
  36252. * Released under the MIT licence.
  36253. */
  36254. (function webpackUniversalModuleDefinition(root, factory) {
  36255. if(true)
  36256. module.exports = factory();
  36257. else {}
  36258. })(window, function() {
  36259. return /******/ (function(modules) { // webpackBootstrap
  36260. /******/ // The module cache
  36261. /******/ var installedModules = {};
  36262. /******/
  36263. /******/ // The require function
  36264. /******/ function __webpack_require__(moduleId) {
  36265. /******/
  36266. /******/ // Check if module is in cache
  36267. /******/ if(installedModules[moduleId]) {
  36268. /******/ return installedModules[moduleId].exports;
  36269. /******/ }
  36270. /******/ // Create a new module (and put it into the cache)
  36271. /******/ var module = installedModules[moduleId] = {
  36272. /******/ i: moduleId,
  36273. /******/ l: false,
  36274. /******/ exports: {}
  36275. /******/ };
  36276. /******/
  36277. /******/ // Execute the module function
  36278. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36279. /******/
  36280. /******/ // Flag the module as loaded
  36281. /******/ module.l = true;
  36282. /******/
  36283. /******/ // Return the exports of the module
  36284. /******/ return module.exports;
  36285. /******/ }
  36286. /******/
  36287. /******/
  36288. /******/ // expose the modules object (__webpack_modules__)
  36289. /******/ __webpack_require__.m = modules;
  36290. /******/
  36291. /******/ // expose the module cache
  36292. /******/ __webpack_require__.c = installedModules;
  36293. /******/
  36294. /******/ // define getter function for harmony exports
  36295. /******/ __webpack_require__.d = function(exports, name, getter) {
  36296. /******/ if(!__webpack_require__.o(exports, name)) {
  36297. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36298. /******/ }
  36299. /******/ };
  36300. /******/
  36301. /******/ // define __esModule on exports
  36302. /******/ __webpack_require__.r = function(exports) {
  36303. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36304. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36305. /******/ }
  36306. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36307. /******/ };
  36308. /******/
  36309. /******/ // create a fake namespace object
  36310. /******/ // mode & 1: value is a module id, require it
  36311. /******/ // mode & 2: merge all properties of value into the ns
  36312. /******/ // mode & 4: return value when already ns object
  36313. /******/ // mode & 8|1: behave like require
  36314. /******/ __webpack_require__.t = function(value, mode) {
  36315. /******/ if(mode & 1) value = __webpack_require__(value);
  36316. /******/ if(mode & 8) return value;
  36317. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36318. /******/ var ns = Object.create(null);
  36319. /******/ __webpack_require__.r(ns);
  36320. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36321. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36322. /******/ return ns;
  36323. /******/ };
  36324. /******/
  36325. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36326. /******/ __webpack_require__.n = function(module) {
  36327. /******/ var getter = module && module.__esModule ?
  36328. /******/ function getDefault() { return module['default']; } :
  36329. /******/ function getModuleExports() { return module; };
  36330. /******/ __webpack_require__.d(getter, 'a', getter);
  36331. /******/ return getter;
  36332. /******/ };
  36333. /******/
  36334. /******/ // Object.prototype.hasOwnProperty.call
  36335. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36336. /******/
  36337. /******/ // __webpack_public_path__
  36338. /******/ __webpack_require__.p = "";
  36339. /******/
  36340. /******/
  36341. /******/ // Load entry module and return exports
  36342. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36343. /******/ })
  36344. /************************************************************************/
  36345. /******/ ([
  36346. /* 0 */
  36347. /***/ (function(module, exports, __webpack_require__) {
  36348. (function(nacl) {
  36349. 'use strict';
  36350. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36351. // Public domain.
  36352. //
  36353. // Implementation derived from TweetNaCl version 20140427.
  36354. // See for details: http://tweetnacl.cr.yp.to/
  36355. var gf = function(init) {
  36356. var i, r = new Float64Array(16);
  36357. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36358. return r;
  36359. };
  36360. // Pluggable, initialized in high-level API below.
  36361. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36362. var _0 = new Uint8Array(16);
  36363. var _9 = new Uint8Array(32); _9[0] = 9;
  36364. var gf0 = gf(),
  36365. gf1 = gf([1]),
  36366. _121665 = gf([0xdb41, 1]),
  36367. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36368. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36369. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36370. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36371. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36372. function ts64(x, i, h, l) {
  36373. x[i] = (h >> 24) & 0xff;
  36374. x[i+1] = (h >> 16) & 0xff;
  36375. x[i+2] = (h >> 8) & 0xff;
  36376. x[i+3] = h & 0xff;
  36377. x[i+4] = (l >> 24) & 0xff;
  36378. x[i+5] = (l >> 16) & 0xff;
  36379. x[i+6] = (l >> 8) & 0xff;
  36380. x[i+7] = l & 0xff;
  36381. }
  36382. function vn(x, xi, y, yi, n) {
  36383. var i,d = 0;
  36384. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36385. return (1 & ((d - 1) >>> 8)) - 1;
  36386. }
  36387. function crypto_verify_16(x, xi, y, yi) {
  36388. return vn(x,xi,y,yi,16);
  36389. }
  36390. function crypto_verify_32(x, xi, y, yi) {
  36391. return vn(x,xi,y,yi,32);
  36392. }
  36393. function core_salsa20(o, p, k, c) {
  36394. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36395. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36396. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36397. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36398. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36399. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36400. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36401. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36402. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36403. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36404. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36405. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36406. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36407. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36408. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36409. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36410. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36411. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36412. x15 = j15, u;
  36413. for (var i = 0; i < 20; i += 2) {
  36414. u = x0 + x12 | 0;
  36415. x4 ^= u<<7 | u>>>(32-7);
  36416. u = x4 + x0 | 0;
  36417. x8 ^= u<<9 | u>>>(32-9);
  36418. u = x8 + x4 | 0;
  36419. x12 ^= u<<13 | u>>>(32-13);
  36420. u = x12 + x8 | 0;
  36421. x0 ^= u<<18 | u>>>(32-18);
  36422. u = x5 + x1 | 0;
  36423. x9 ^= u<<7 | u>>>(32-7);
  36424. u = x9 + x5 | 0;
  36425. x13 ^= u<<9 | u>>>(32-9);
  36426. u = x13 + x9 | 0;
  36427. x1 ^= u<<13 | u>>>(32-13);
  36428. u = x1 + x13 | 0;
  36429. x5 ^= u<<18 | u>>>(32-18);
  36430. u = x10 + x6 | 0;
  36431. x14 ^= u<<7 | u>>>(32-7);
  36432. u = x14 + x10 | 0;
  36433. x2 ^= u<<9 | u>>>(32-9);
  36434. u = x2 + x14 | 0;
  36435. x6 ^= u<<13 | u>>>(32-13);
  36436. u = x6 + x2 | 0;
  36437. x10 ^= u<<18 | u>>>(32-18);
  36438. u = x15 + x11 | 0;
  36439. x3 ^= u<<7 | u>>>(32-7);
  36440. u = x3 + x15 | 0;
  36441. x7 ^= u<<9 | u>>>(32-9);
  36442. u = x7 + x3 | 0;
  36443. x11 ^= u<<13 | u>>>(32-13);
  36444. u = x11 + x7 | 0;
  36445. x15 ^= u<<18 | u>>>(32-18);
  36446. u = x0 + x3 | 0;
  36447. x1 ^= u<<7 | u>>>(32-7);
  36448. u = x1 + x0 | 0;
  36449. x2 ^= u<<9 | u>>>(32-9);
  36450. u = x2 + x1 | 0;
  36451. x3 ^= u<<13 | u>>>(32-13);
  36452. u = x3 + x2 | 0;
  36453. x0 ^= u<<18 | u>>>(32-18);
  36454. u = x5 + x4 | 0;
  36455. x6 ^= u<<7 | u>>>(32-7);
  36456. u = x6 + x5 | 0;
  36457. x7 ^= u<<9 | u>>>(32-9);
  36458. u = x7 + x6 | 0;
  36459. x4 ^= u<<13 | u>>>(32-13);
  36460. u = x4 + x7 | 0;
  36461. x5 ^= u<<18 | u>>>(32-18);
  36462. u = x10 + x9 | 0;
  36463. x11 ^= u<<7 | u>>>(32-7);
  36464. u = x11 + x10 | 0;
  36465. x8 ^= u<<9 | u>>>(32-9);
  36466. u = x8 + x11 | 0;
  36467. x9 ^= u<<13 | u>>>(32-13);
  36468. u = x9 + x8 | 0;
  36469. x10 ^= u<<18 | u>>>(32-18);
  36470. u = x15 + x14 | 0;
  36471. x12 ^= u<<7 | u>>>(32-7);
  36472. u = x12 + x15 | 0;
  36473. x13 ^= u<<9 | u>>>(32-9);
  36474. u = x13 + x12 | 0;
  36475. x14 ^= u<<13 | u>>>(32-13);
  36476. u = x14 + x13 | 0;
  36477. x15 ^= u<<18 | u>>>(32-18);
  36478. }
  36479. x0 = x0 + j0 | 0;
  36480. x1 = x1 + j1 | 0;
  36481. x2 = x2 + j2 | 0;
  36482. x3 = x3 + j3 | 0;
  36483. x4 = x4 + j4 | 0;
  36484. x5 = x5 + j5 | 0;
  36485. x6 = x6 + j6 | 0;
  36486. x7 = x7 + j7 | 0;
  36487. x8 = x8 + j8 | 0;
  36488. x9 = x9 + j9 | 0;
  36489. x10 = x10 + j10 | 0;
  36490. x11 = x11 + j11 | 0;
  36491. x12 = x12 + j12 | 0;
  36492. x13 = x13 + j13 | 0;
  36493. x14 = x14 + j14 | 0;
  36494. x15 = x15 + j15 | 0;
  36495. o[ 0] = x0 >>> 0 & 0xff;
  36496. o[ 1] = x0 >>> 8 & 0xff;
  36497. o[ 2] = x0 >>> 16 & 0xff;
  36498. o[ 3] = x0 >>> 24 & 0xff;
  36499. o[ 4] = x1 >>> 0 & 0xff;
  36500. o[ 5] = x1 >>> 8 & 0xff;
  36501. o[ 6] = x1 >>> 16 & 0xff;
  36502. o[ 7] = x1 >>> 24 & 0xff;
  36503. o[ 8] = x2 >>> 0 & 0xff;
  36504. o[ 9] = x2 >>> 8 & 0xff;
  36505. o[10] = x2 >>> 16 & 0xff;
  36506. o[11] = x2 >>> 24 & 0xff;
  36507. o[12] = x3 >>> 0 & 0xff;
  36508. o[13] = x3 >>> 8 & 0xff;
  36509. o[14] = x3 >>> 16 & 0xff;
  36510. o[15] = x3 >>> 24 & 0xff;
  36511. o[16] = x4 >>> 0 & 0xff;
  36512. o[17] = x4 >>> 8 & 0xff;
  36513. o[18] = x4 >>> 16 & 0xff;
  36514. o[19] = x4 >>> 24 & 0xff;
  36515. o[20] = x5 >>> 0 & 0xff;
  36516. o[21] = x5 >>> 8 & 0xff;
  36517. o[22] = x5 >>> 16 & 0xff;
  36518. o[23] = x5 >>> 24 & 0xff;
  36519. o[24] = x6 >>> 0 & 0xff;
  36520. o[25] = x6 >>> 8 & 0xff;
  36521. o[26] = x6 >>> 16 & 0xff;
  36522. o[27] = x6 >>> 24 & 0xff;
  36523. o[28] = x7 >>> 0 & 0xff;
  36524. o[29] = x7 >>> 8 & 0xff;
  36525. o[30] = x7 >>> 16 & 0xff;
  36526. o[31] = x7 >>> 24 & 0xff;
  36527. o[32] = x8 >>> 0 & 0xff;
  36528. o[33] = x8 >>> 8 & 0xff;
  36529. o[34] = x8 >>> 16 & 0xff;
  36530. o[35] = x8 >>> 24 & 0xff;
  36531. o[36] = x9 >>> 0 & 0xff;
  36532. o[37] = x9 >>> 8 & 0xff;
  36533. o[38] = x9 >>> 16 & 0xff;
  36534. o[39] = x9 >>> 24 & 0xff;
  36535. o[40] = x10 >>> 0 & 0xff;
  36536. o[41] = x10 >>> 8 & 0xff;
  36537. o[42] = x10 >>> 16 & 0xff;
  36538. o[43] = x10 >>> 24 & 0xff;
  36539. o[44] = x11 >>> 0 & 0xff;
  36540. o[45] = x11 >>> 8 & 0xff;
  36541. o[46] = x11 >>> 16 & 0xff;
  36542. o[47] = x11 >>> 24 & 0xff;
  36543. o[48] = x12 >>> 0 & 0xff;
  36544. o[49] = x12 >>> 8 & 0xff;
  36545. o[50] = x12 >>> 16 & 0xff;
  36546. o[51] = x12 >>> 24 & 0xff;
  36547. o[52] = x13 >>> 0 & 0xff;
  36548. o[53] = x13 >>> 8 & 0xff;
  36549. o[54] = x13 >>> 16 & 0xff;
  36550. o[55] = x13 >>> 24 & 0xff;
  36551. o[56] = x14 >>> 0 & 0xff;
  36552. o[57] = x14 >>> 8 & 0xff;
  36553. o[58] = x14 >>> 16 & 0xff;
  36554. o[59] = x14 >>> 24 & 0xff;
  36555. o[60] = x15 >>> 0 & 0xff;
  36556. o[61] = x15 >>> 8 & 0xff;
  36557. o[62] = x15 >>> 16 & 0xff;
  36558. o[63] = x15 >>> 24 & 0xff;
  36559. }
  36560. function core_hsalsa20(o,p,k,c) {
  36561. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36562. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36563. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36564. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36565. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36566. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36567. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36568. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36569. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36570. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36571. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36572. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36573. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36574. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36575. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36576. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36577. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36578. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36579. x15 = j15, u;
  36580. for (var i = 0; i < 20; i += 2) {
  36581. u = x0 + x12 | 0;
  36582. x4 ^= u<<7 | u>>>(32-7);
  36583. u = x4 + x0 | 0;
  36584. x8 ^= u<<9 | u>>>(32-9);
  36585. u = x8 + x4 | 0;
  36586. x12 ^= u<<13 | u>>>(32-13);
  36587. u = x12 + x8 | 0;
  36588. x0 ^= u<<18 | u>>>(32-18);
  36589. u = x5 + x1 | 0;
  36590. x9 ^= u<<7 | u>>>(32-7);
  36591. u = x9 + x5 | 0;
  36592. x13 ^= u<<9 | u>>>(32-9);
  36593. u = x13 + x9 | 0;
  36594. x1 ^= u<<13 | u>>>(32-13);
  36595. u = x1 + x13 | 0;
  36596. x5 ^= u<<18 | u>>>(32-18);
  36597. u = x10 + x6 | 0;
  36598. x14 ^= u<<7 | u>>>(32-7);
  36599. u = x14 + x10 | 0;
  36600. x2 ^= u<<9 | u>>>(32-9);
  36601. u = x2 + x14 | 0;
  36602. x6 ^= u<<13 | u>>>(32-13);
  36603. u = x6 + x2 | 0;
  36604. x10 ^= u<<18 | u>>>(32-18);
  36605. u = x15 + x11 | 0;
  36606. x3 ^= u<<7 | u>>>(32-7);
  36607. u = x3 + x15 | 0;
  36608. x7 ^= u<<9 | u>>>(32-9);
  36609. u = x7 + x3 | 0;
  36610. x11 ^= u<<13 | u>>>(32-13);
  36611. u = x11 + x7 | 0;
  36612. x15 ^= u<<18 | u>>>(32-18);
  36613. u = x0 + x3 | 0;
  36614. x1 ^= u<<7 | u>>>(32-7);
  36615. u = x1 + x0 | 0;
  36616. x2 ^= u<<9 | u>>>(32-9);
  36617. u = x2 + x1 | 0;
  36618. x3 ^= u<<13 | u>>>(32-13);
  36619. u = x3 + x2 | 0;
  36620. x0 ^= u<<18 | u>>>(32-18);
  36621. u = x5 + x4 | 0;
  36622. x6 ^= u<<7 | u>>>(32-7);
  36623. u = x6 + x5 | 0;
  36624. x7 ^= u<<9 | u>>>(32-9);
  36625. u = x7 + x6 | 0;
  36626. x4 ^= u<<13 | u>>>(32-13);
  36627. u = x4 + x7 | 0;
  36628. x5 ^= u<<18 | u>>>(32-18);
  36629. u = x10 + x9 | 0;
  36630. x11 ^= u<<7 | u>>>(32-7);
  36631. u = x11 + x10 | 0;
  36632. x8 ^= u<<9 | u>>>(32-9);
  36633. u = x8 + x11 | 0;
  36634. x9 ^= u<<13 | u>>>(32-13);
  36635. u = x9 + x8 | 0;
  36636. x10 ^= u<<18 | u>>>(32-18);
  36637. u = x15 + x14 | 0;
  36638. x12 ^= u<<7 | u>>>(32-7);
  36639. u = x12 + x15 | 0;
  36640. x13 ^= u<<9 | u>>>(32-9);
  36641. u = x13 + x12 | 0;
  36642. x14 ^= u<<13 | u>>>(32-13);
  36643. u = x14 + x13 | 0;
  36644. x15 ^= u<<18 | u>>>(32-18);
  36645. }
  36646. o[ 0] = x0 >>> 0 & 0xff;
  36647. o[ 1] = x0 >>> 8 & 0xff;
  36648. o[ 2] = x0 >>> 16 & 0xff;
  36649. o[ 3] = x0 >>> 24 & 0xff;
  36650. o[ 4] = x5 >>> 0 & 0xff;
  36651. o[ 5] = x5 >>> 8 & 0xff;
  36652. o[ 6] = x5 >>> 16 & 0xff;
  36653. o[ 7] = x5 >>> 24 & 0xff;
  36654. o[ 8] = x10 >>> 0 & 0xff;
  36655. o[ 9] = x10 >>> 8 & 0xff;
  36656. o[10] = x10 >>> 16 & 0xff;
  36657. o[11] = x10 >>> 24 & 0xff;
  36658. o[12] = x15 >>> 0 & 0xff;
  36659. o[13] = x15 >>> 8 & 0xff;
  36660. o[14] = x15 >>> 16 & 0xff;
  36661. o[15] = x15 >>> 24 & 0xff;
  36662. o[16] = x6 >>> 0 & 0xff;
  36663. o[17] = x6 >>> 8 & 0xff;
  36664. o[18] = x6 >>> 16 & 0xff;
  36665. o[19] = x6 >>> 24 & 0xff;
  36666. o[20] = x7 >>> 0 & 0xff;
  36667. o[21] = x7 >>> 8 & 0xff;
  36668. o[22] = x7 >>> 16 & 0xff;
  36669. o[23] = x7 >>> 24 & 0xff;
  36670. o[24] = x8 >>> 0 & 0xff;
  36671. o[25] = x8 >>> 8 & 0xff;
  36672. o[26] = x8 >>> 16 & 0xff;
  36673. o[27] = x8 >>> 24 & 0xff;
  36674. o[28] = x9 >>> 0 & 0xff;
  36675. o[29] = x9 >>> 8 & 0xff;
  36676. o[30] = x9 >>> 16 & 0xff;
  36677. o[31] = x9 >>> 24 & 0xff;
  36678. }
  36679. function crypto_core_salsa20(out,inp,k,c) {
  36680. core_salsa20(out,inp,k,c);
  36681. }
  36682. function crypto_core_hsalsa20(out,inp,k,c) {
  36683. core_hsalsa20(out,inp,k,c);
  36684. }
  36685. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36686. // "expand 32-byte k"
  36687. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36688. var z = new Uint8Array(16), x = new Uint8Array(64);
  36689. var u, i;
  36690. for (i = 0; i < 16; i++) z[i] = 0;
  36691. for (i = 0; i < 8; i++) z[i] = n[i];
  36692. while (b >= 64) {
  36693. crypto_core_salsa20(x,z,k,sigma);
  36694. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36695. u = 1;
  36696. for (i = 8; i < 16; i++) {
  36697. u = u + (z[i] & 0xff) | 0;
  36698. z[i] = u & 0xff;
  36699. u >>>= 8;
  36700. }
  36701. b -= 64;
  36702. cpos += 64;
  36703. mpos += 64;
  36704. }
  36705. if (b > 0) {
  36706. crypto_core_salsa20(x,z,k,sigma);
  36707. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36708. }
  36709. return 0;
  36710. }
  36711. function crypto_stream_salsa20(c,cpos,b,n,k) {
  36712. var z = new Uint8Array(16), x = new Uint8Array(64);
  36713. var u, i;
  36714. for (i = 0; i < 16; i++) z[i] = 0;
  36715. for (i = 0; i < 8; i++) z[i] = n[i];
  36716. while (b >= 64) {
  36717. crypto_core_salsa20(x,z,k,sigma);
  36718. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  36719. u = 1;
  36720. for (i = 8; i < 16; i++) {
  36721. u = u + (z[i] & 0xff) | 0;
  36722. z[i] = u & 0xff;
  36723. u >>>= 8;
  36724. }
  36725. b -= 64;
  36726. cpos += 64;
  36727. }
  36728. if (b > 0) {
  36729. crypto_core_salsa20(x,z,k,sigma);
  36730. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  36731. }
  36732. return 0;
  36733. }
  36734. function crypto_stream(c,cpos,d,n,k) {
  36735. var s = new Uint8Array(32);
  36736. crypto_core_hsalsa20(s,n,k,sigma);
  36737. var sn = new Uint8Array(8);
  36738. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36739. return crypto_stream_salsa20(c,cpos,d,sn,s);
  36740. }
  36741. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  36742. var s = new Uint8Array(32);
  36743. crypto_core_hsalsa20(s,n,k,sigma);
  36744. var sn = new Uint8Array(8);
  36745. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  36746. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  36747. }
  36748. /*
  36749. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  36750. * https://github.com/floodyberry/poly1305-donna
  36751. */
  36752. var poly1305 = function(key) {
  36753. this.buffer = new Uint8Array(16);
  36754. this.r = new Uint16Array(10);
  36755. this.h = new Uint16Array(10);
  36756. this.pad = new Uint16Array(8);
  36757. this.leftover = 0;
  36758. this.fin = 0;
  36759. var t0, t1, t2, t3, t4, t5, t6, t7;
  36760. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  36761. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36762. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  36763. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36764. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  36765. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  36766. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36767. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  36768. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36769. this.r[9] = ((t7 >>> 5)) & 0x007f;
  36770. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  36771. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  36772. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  36773. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  36774. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  36775. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  36776. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  36777. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  36778. };
  36779. poly1305.prototype.blocks = function(m, mpos, bytes) {
  36780. var hibit = this.fin ? 0 : (1 << 11);
  36781. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  36782. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  36783. var h0 = this.h[0],
  36784. h1 = this.h[1],
  36785. h2 = this.h[2],
  36786. h3 = this.h[3],
  36787. h4 = this.h[4],
  36788. h5 = this.h[5],
  36789. h6 = this.h[6],
  36790. h7 = this.h[7],
  36791. h8 = this.h[8],
  36792. h9 = this.h[9];
  36793. var r0 = this.r[0],
  36794. r1 = this.r[1],
  36795. r2 = this.r[2],
  36796. r3 = this.r[3],
  36797. r4 = this.r[4],
  36798. r5 = this.r[5],
  36799. r6 = this.r[6],
  36800. r7 = this.r[7],
  36801. r8 = this.r[8],
  36802. r9 = this.r[9];
  36803. while (bytes >= 16) {
  36804. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  36805. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  36806. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  36807. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  36808. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  36809. h5 += ((t4 >>> 1)) & 0x1fff;
  36810. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  36811. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  36812. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  36813. h9 += ((t7 >>> 5)) | hibit;
  36814. c = 0;
  36815. d0 = c;
  36816. d0 += h0 * r0;
  36817. d0 += h1 * (5 * r9);
  36818. d0 += h2 * (5 * r8);
  36819. d0 += h3 * (5 * r7);
  36820. d0 += h4 * (5 * r6);
  36821. c = (d0 >>> 13); d0 &= 0x1fff;
  36822. d0 += h5 * (5 * r5);
  36823. d0 += h6 * (5 * r4);
  36824. d0 += h7 * (5 * r3);
  36825. d0 += h8 * (5 * r2);
  36826. d0 += h9 * (5 * r1);
  36827. c += (d0 >>> 13); d0 &= 0x1fff;
  36828. d1 = c;
  36829. d1 += h0 * r1;
  36830. d1 += h1 * r0;
  36831. d1 += h2 * (5 * r9);
  36832. d1 += h3 * (5 * r8);
  36833. d1 += h4 * (5 * r7);
  36834. c = (d1 >>> 13); d1 &= 0x1fff;
  36835. d1 += h5 * (5 * r6);
  36836. d1 += h6 * (5 * r5);
  36837. d1 += h7 * (5 * r4);
  36838. d1 += h8 * (5 * r3);
  36839. d1 += h9 * (5 * r2);
  36840. c += (d1 >>> 13); d1 &= 0x1fff;
  36841. d2 = c;
  36842. d2 += h0 * r2;
  36843. d2 += h1 * r1;
  36844. d2 += h2 * r0;
  36845. d2 += h3 * (5 * r9);
  36846. d2 += h4 * (5 * r8);
  36847. c = (d2 >>> 13); d2 &= 0x1fff;
  36848. d2 += h5 * (5 * r7);
  36849. d2 += h6 * (5 * r6);
  36850. d2 += h7 * (5 * r5);
  36851. d2 += h8 * (5 * r4);
  36852. d2 += h9 * (5 * r3);
  36853. c += (d2 >>> 13); d2 &= 0x1fff;
  36854. d3 = c;
  36855. d3 += h0 * r3;
  36856. d3 += h1 * r2;
  36857. d3 += h2 * r1;
  36858. d3 += h3 * r0;
  36859. d3 += h4 * (5 * r9);
  36860. c = (d3 >>> 13); d3 &= 0x1fff;
  36861. d3 += h5 * (5 * r8);
  36862. d3 += h6 * (5 * r7);
  36863. d3 += h7 * (5 * r6);
  36864. d3 += h8 * (5 * r5);
  36865. d3 += h9 * (5 * r4);
  36866. c += (d3 >>> 13); d3 &= 0x1fff;
  36867. d4 = c;
  36868. d4 += h0 * r4;
  36869. d4 += h1 * r3;
  36870. d4 += h2 * r2;
  36871. d4 += h3 * r1;
  36872. d4 += h4 * r0;
  36873. c = (d4 >>> 13); d4 &= 0x1fff;
  36874. d4 += h5 * (5 * r9);
  36875. d4 += h6 * (5 * r8);
  36876. d4 += h7 * (5 * r7);
  36877. d4 += h8 * (5 * r6);
  36878. d4 += h9 * (5 * r5);
  36879. c += (d4 >>> 13); d4 &= 0x1fff;
  36880. d5 = c;
  36881. d5 += h0 * r5;
  36882. d5 += h1 * r4;
  36883. d5 += h2 * r3;
  36884. d5 += h3 * r2;
  36885. d5 += h4 * r1;
  36886. c = (d5 >>> 13); d5 &= 0x1fff;
  36887. d5 += h5 * r0;
  36888. d5 += h6 * (5 * r9);
  36889. d5 += h7 * (5 * r8);
  36890. d5 += h8 * (5 * r7);
  36891. d5 += h9 * (5 * r6);
  36892. c += (d5 >>> 13); d5 &= 0x1fff;
  36893. d6 = c;
  36894. d6 += h0 * r6;
  36895. d6 += h1 * r5;
  36896. d6 += h2 * r4;
  36897. d6 += h3 * r3;
  36898. d6 += h4 * r2;
  36899. c = (d6 >>> 13); d6 &= 0x1fff;
  36900. d6 += h5 * r1;
  36901. d6 += h6 * r0;
  36902. d6 += h7 * (5 * r9);
  36903. d6 += h8 * (5 * r8);
  36904. d6 += h9 * (5 * r7);
  36905. c += (d6 >>> 13); d6 &= 0x1fff;
  36906. d7 = c;
  36907. d7 += h0 * r7;
  36908. d7 += h1 * r6;
  36909. d7 += h2 * r5;
  36910. d7 += h3 * r4;
  36911. d7 += h4 * r3;
  36912. c = (d7 >>> 13); d7 &= 0x1fff;
  36913. d7 += h5 * r2;
  36914. d7 += h6 * r1;
  36915. d7 += h7 * r0;
  36916. d7 += h8 * (5 * r9);
  36917. d7 += h9 * (5 * r8);
  36918. c += (d7 >>> 13); d7 &= 0x1fff;
  36919. d8 = c;
  36920. d8 += h0 * r8;
  36921. d8 += h1 * r7;
  36922. d8 += h2 * r6;
  36923. d8 += h3 * r5;
  36924. d8 += h4 * r4;
  36925. c = (d8 >>> 13); d8 &= 0x1fff;
  36926. d8 += h5 * r3;
  36927. d8 += h6 * r2;
  36928. d8 += h7 * r1;
  36929. d8 += h8 * r0;
  36930. d8 += h9 * (5 * r9);
  36931. c += (d8 >>> 13); d8 &= 0x1fff;
  36932. d9 = c;
  36933. d9 += h0 * r9;
  36934. d9 += h1 * r8;
  36935. d9 += h2 * r7;
  36936. d9 += h3 * r6;
  36937. d9 += h4 * r5;
  36938. c = (d9 >>> 13); d9 &= 0x1fff;
  36939. d9 += h5 * r4;
  36940. d9 += h6 * r3;
  36941. d9 += h7 * r2;
  36942. d9 += h8 * r1;
  36943. d9 += h9 * r0;
  36944. c += (d9 >>> 13); d9 &= 0x1fff;
  36945. c = (((c << 2) + c)) | 0;
  36946. c = (c + d0) | 0;
  36947. d0 = c & 0x1fff;
  36948. c = (c >>> 13);
  36949. d1 += c;
  36950. h0 = d0;
  36951. h1 = d1;
  36952. h2 = d2;
  36953. h3 = d3;
  36954. h4 = d4;
  36955. h5 = d5;
  36956. h6 = d6;
  36957. h7 = d7;
  36958. h8 = d8;
  36959. h9 = d9;
  36960. mpos += 16;
  36961. bytes -= 16;
  36962. }
  36963. this.h[0] = h0;
  36964. this.h[1] = h1;
  36965. this.h[2] = h2;
  36966. this.h[3] = h3;
  36967. this.h[4] = h4;
  36968. this.h[5] = h5;
  36969. this.h[6] = h6;
  36970. this.h[7] = h7;
  36971. this.h[8] = h8;
  36972. this.h[9] = h9;
  36973. };
  36974. poly1305.prototype.finish = function(mac, macpos) {
  36975. var g = new Uint16Array(10);
  36976. var c, mask, f, i;
  36977. if (this.leftover) {
  36978. i = this.leftover;
  36979. this.buffer[i++] = 1;
  36980. for (; i < 16; i++) this.buffer[i] = 0;
  36981. this.fin = 1;
  36982. this.blocks(this.buffer, 0, 16);
  36983. }
  36984. c = this.h[1] >>> 13;
  36985. this.h[1] &= 0x1fff;
  36986. for (i = 2; i < 10; i++) {
  36987. this.h[i] += c;
  36988. c = this.h[i] >>> 13;
  36989. this.h[i] &= 0x1fff;
  36990. }
  36991. this.h[0] += (c * 5);
  36992. c = this.h[0] >>> 13;
  36993. this.h[0] &= 0x1fff;
  36994. this.h[1] += c;
  36995. c = this.h[1] >>> 13;
  36996. this.h[1] &= 0x1fff;
  36997. this.h[2] += c;
  36998. g[0] = this.h[0] + 5;
  36999. c = g[0] >>> 13;
  37000. g[0] &= 0x1fff;
  37001. for (i = 1; i < 10; i++) {
  37002. g[i] = this.h[i] + c;
  37003. c = g[i] >>> 13;
  37004. g[i] &= 0x1fff;
  37005. }
  37006. g[9] -= (1 << 13);
  37007. mask = (c ^ 1) - 1;
  37008. for (i = 0; i < 10; i++) g[i] &= mask;
  37009. mask = ~mask;
  37010. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37011. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37012. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37013. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37014. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37015. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37016. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37017. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37018. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37019. f = this.h[0] + this.pad[0];
  37020. this.h[0] = f & 0xffff;
  37021. for (i = 1; i < 8; i++) {
  37022. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37023. this.h[i] = f & 0xffff;
  37024. }
  37025. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37026. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37027. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37028. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37029. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37030. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37031. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37032. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37033. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37034. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37035. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37036. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37037. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37038. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37039. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37040. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37041. };
  37042. poly1305.prototype.update = function(m, mpos, bytes) {
  37043. var i, want;
  37044. if (this.leftover) {
  37045. want = (16 - this.leftover);
  37046. if (want > bytes)
  37047. want = bytes;
  37048. for (i = 0; i < want; i++)
  37049. this.buffer[this.leftover + i] = m[mpos+i];
  37050. bytes -= want;
  37051. mpos += want;
  37052. this.leftover += want;
  37053. if (this.leftover < 16)
  37054. return;
  37055. this.blocks(this.buffer, 0, 16);
  37056. this.leftover = 0;
  37057. }
  37058. if (bytes >= 16) {
  37059. want = bytes - (bytes % 16);
  37060. this.blocks(m, mpos, want);
  37061. mpos += want;
  37062. bytes -= want;
  37063. }
  37064. if (bytes) {
  37065. for (i = 0; i < bytes; i++)
  37066. this.buffer[this.leftover + i] = m[mpos+i];
  37067. this.leftover += bytes;
  37068. }
  37069. };
  37070. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37071. var s = new poly1305(k);
  37072. s.update(m, mpos, n);
  37073. s.finish(out, outpos);
  37074. return 0;
  37075. }
  37076. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37077. var x = new Uint8Array(16);
  37078. crypto_onetimeauth(x,0,m,mpos,n,k);
  37079. return crypto_verify_16(h,hpos,x,0);
  37080. }
  37081. function crypto_secretbox(c,m,d,n,k) {
  37082. var i;
  37083. if (d < 32) return -1;
  37084. crypto_stream_xor(c,0,m,0,d,n,k);
  37085. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37086. for (i = 0; i < 16; i++) c[i] = 0;
  37087. return 0;
  37088. }
  37089. function crypto_secretbox_open(m,c,d,n,k) {
  37090. var i;
  37091. var x = new Uint8Array(32);
  37092. if (d < 32) return -1;
  37093. crypto_stream(x,0,32,n,k);
  37094. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37095. crypto_stream_xor(m,0,c,0,d,n,k);
  37096. for (i = 0; i < 32; i++) m[i] = 0;
  37097. return 0;
  37098. }
  37099. function set25519(r, a) {
  37100. var i;
  37101. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37102. }
  37103. function car25519(o) {
  37104. var i, v, c = 1;
  37105. for (i = 0; i < 16; i++) {
  37106. v = o[i] + c + 65535;
  37107. c = Math.floor(v / 65536);
  37108. o[i] = v - c * 65536;
  37109. }
  37110. o[0] += c-1 + 37 * (c-1);
  37111. }
  37112. function sel25519(p, q, b) {
  37113. var t, c = ~(b-1);
  37114. for (var i = 0; i < 16; i++) {
  37115. t = c & (p[i] ^ q[i]);
  37116. p[i] ^= t;
  37117. q[i] ^= t;
  37118. }
  37119. }
  37120. function pack25519(o, n) {
  37121. var i, j, b;
  37122. var m = gf(), t = gf();
  37123. for (i = 0; i < 16; i++) t[i] = n[i];
  37124. car25519(t);
  37125. car25519(t);
  37126. car25519(t);
  37127. for (j = 0; j < 2; j++) {
  37128. m[0] = t[0] - 0xffed;
  37129. for (i = 1; i < 15; i++) {
  37130. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37131. m[i-1] &= 0xffff;
  37132. }
  37133. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37134. b = (m[15]>>16) & 1;
  37135. m[14] &= 0xffff;
  37136. sel25519(t, m, 1-b);
  37137. }
  37138. for (i = 0; i < 16; i++) {
  37139. o[2*i] = t[i] & 0xff;
  37140. o[2*i+1] = t[i]>>8;
  37141. }
  37142. }
  37143. function neq25519(a, b) {
  37144. var c = new Uint8Array(32), d = new Uint8Array(32);
  37145. pack25519(c, a);
  37146. pack25519(d, b);
  37147. return crypto_verify_32(c, 0, d, 0);
  37148. }
  37149. function par25519(a) {
  37150. var d = new Uint8Array(32);
  37151. pack25519(d, a);
  37152. return d[0] & 1;
  37153. }
  37154. function unpack25519(o, n) {
  37155. var i;
  37156. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37157. o[15] &= 0x7fff;
  37158. }
  37159. function A(o, a, b) {
  37160. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37161. }
  37162. function Z(o, a, b) {
  37163. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37164. }
  37165. function M(o, a, b) {
  37166. var v, c,
  37167. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37168. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37169. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37170. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37171. b0 = b[0],
  37172. b1 = b[1],
  37173. b2 = b[2],
  37174. b3 = b[3],
  37175. b4 = b[4],
  37176. b5 = b[5],
  37177. b6 = b[6],
  37178. b7 = b[7],
  37179. b8 = b[8],
  37180. b9 = b[9],
  37181. b10 = b[10],
  37182. b11 = b[11],
  37183. b12 = b[12],
  37184. b13 = b[13],
  37185. b14 = b[14],
  37186. b15 = b[15];
  37187. v = a[0];
  37188. t0 += v * b0;
  37189. t1 += v * b1;
  37190. t2 += v * b2;
  37191. t3 += v * b3;
  37192. t4 += v * b4;
  37193. t5 += v * b5;
  37194. t6 += v * b6;
  37195. t7 += v * b7;
  37196. t8 += v * b8;
  37197. t9 += v * b9;
  37198. t10 += v * b10;
  37199. t11 += v * b11;
  37200. t12 += v * b12;
  37201. t13 += v * b13;
  37202. t14 += v * b14;
  37203. t15 += v * b15;
  37204. v = a[1];
  37205. t1 += v * b0;
  37206. t2 += v * b1;
  37207. t3 += v * b2;
  37208. t4 += v * b3;
  37209. t5 += v * b4;
  37210. t6 += v * b5;
  37211. t7 += v * b6;
  37212. t8 += v * b7;
  37213. t9 += v * b8;
  37214. t10 += v * b9;
  37215. t11 += v * b10;
  37216. t12 += v * b11;
  37217. t13 += v * b12;
  37218. t14 += v * b13;
  37219. t15 += v * b14;
  37220. t16 += v * b15;
  37221. v = a[2];
  37222. t2 += v * b0;
  37223. t3 += v * b1;
  37224. t4 += v * b2;
  37225. t5 += v * b3;
  37226. t6 += v * b4;
  37227. t7 += v * b5;
  37228. t8 += v * b6;
  37229. t9 += v * b7;
  37230. t10 += v * b8;
  37231. t11 += v * b9;
  37232. t12 += v * b10;
  37233. t13 += v * b11;
  37234. t14 += v * b12;
  37235. t15 += v * b13;
  37236. t16 += v * b14;
  37237. t17 += v * b15;
  37238. v = a[3];
  37239. t3 += v * b0;
  37240. t4 += v * b1;
  37241. t5 += v * b2;
  37242. t6 += v * b3;
  37243. t7 += v * b4;
  37244. t8 += v * b5;
  37245. t9 += v * b6;
  37246. t10 += v * b7;
  37247. t11 += v * b8;
  37248. t12 += v * b9;
  37249. t13 += v * b10;
  37250. t14 += v * b11;
  37251. t15 += v * b12;
  37252. t16 += v * b13;
  37253. t17 += v * b14;
  37254. t18 += v * b15;
  37255. v = a[4];
  37256. t4 += v * b0;
  37257. t5 += v * b1;
  37258. t6 += v * b2;
  37259. t7 += v * b3;
  37260. t8 += v * b4;
  37261. t9 += v * b5;
  37262. t10 += v * b6;
  37263. t11 += v * b7;
  37264. t12 += v * b8;
  37265. t13 += v * b9;
  37266. t14 += v * b10;
  37267. t15 += v * b11;
  37268. t16 += v * b12;
  37269. t17 += v * b13;
  37270. t18 += v * b14;
  37271. t19 += v * b15;
  37272. v = a[5];
  37273. t5 += v * b0;
  37274. t6 += v * b1;
  37275. t7 += v * b2;
  37276. t8 += v * b3;
  37277. t9 += v * b4;
  37278. t10 += v * b5;
  37279. t11 += v * b6;
  37280. t12 += v * b7;
  37281. t13 += v * b8;
  37282. t14 += v * b9;
  37283. t15 += v * b10;
  37284. t16 += v * b11;
  37285. t17 += v * b12;
  37286. t18 += v * b13;
  37287. t19 += v * b14;
  37288. t20 += v * b15;
  37289. v = a[6];
  37290. t6 += v * b0;
  37291. t7 += v * b1;
  37292. t8 += v * b2;
  37293. t9 += v * b3;
  37294. t10 += v * b4;
  37295. t11 += v * b5;
  37296. t12 += v * b6;
  37297. t13 += v * b7;
  37298. t14 += v * b8;
  37299. t15 += v * b9;
  37300. t16 += v * b10;
  37301. t17 += v * b11;
  37302. t18 += v * b12;
  37303. t19 += v * b13;
  37304. t20 += v * b14;
  37305. t21 += v * b15;
  37306. v = a[7];
  37307. t7 += v * b0;
  37308. t8 += v * b1;
  37309. t9 += v * b2;
  37310. t10 += v * b3;
  37311. t11 += v * b4;
  37312. t12 += v * b5;
  37313. t13 += v * b6;
  37314. t14 += v * b7;
  37315. t15 += v * b8;
  37316. t16 += v * b9;
  37317. t17 += v * b10;
  37318. t18 += v * b11;
  37319. t19 += v * b12;
  37320. t20 += v * b13;
  37321. t21 += v * b14;
  37322. t22 += v * b15;
  37323. v = a[8];
  37324. t8 += v * b0;
  37325. t9 += v * b1;
  37326. t10 += v * b2;
  37327. t11 += v * b3;
  37328. t12 += v * b4;
  37329. t13 += v * b5;
  37330. t14 += v * b6;
  37331. t15 += v * b7;
  37332. t16 += v * b8;
  37333. t17 += v * b9;
  37334. t18 += v * b10;
  37335. t19 += v * b11;
  37336. t20 += v * b12;
  37337. t21 += v * b13;
  37338. t22 += v * b14;
  37339. t23 += v * b15;
  37340. v = a[9];
  37341. t9 += v * b0;
  37342. t10 += v * b1;
  37343. t11 += v * b2;
  37344. t12 += v * b3;
  37345. t13 += v * b4;
  37346. t14 += v * b5;
  37347. t15 += v * b6;
  37348. t16 += v * b7;
  37349. t17 += v * b8;
  37350. t18 += v * b9;
  37351. t19 += v * b10;
  37352. t20 += v * b11;
  37353. t21 += v * b12;
  37354. t22 += v * b13;
  37355. t23 += v * b14;
  37356. t24 += v * b15;
  37357. v = a[10];
  37358. t10 += v * b0;
  37359. t11 += v * b1;
  37360. t12 += v * b2;
  37361. t13 += v * b3;
  37362. t14 += v * b4;
  37363. t15 += v * b5;
  37364. t16 += v * b6;
  37365. t17 += v * b7;
  37366. t18 += v * b8;
  37367. t19 += v * b9;
  37368. t20 += v * b10;
  37369. t21 += v * b11;
  37370. t22 += v * b12;
  37371. t23 += v * b13;
  37372. t24 += v * b14;
  37373. t25 += v * b15;
  37374. v = a[11];
  37375. t11 += v * b0;
  37376. t12 += v * b1;
  37377. t13 += v * b2;
  37378. t14 += v * b3;
  37379. t15 += v * b4;
  37380. t16 += v * b5;
  37381. t17 += v * b6;
  37382. t18 += v * b7;
  37383. t19 += v * b8;
  37384. t20 += v * b9;
  37385. t21 += v * b10;
  37386. t22 += v * b11;
  37387. t23 += v * b12;
  37388. t24 += v * b13;
  37389. t25 += v * b14;
  37390. t26 += v * b15;
  37391. v = a[12];
  37392. t12 += v * b0;
  37393. t13 += v * b1;
  37394. t14 += v * b2;
  37395. t15 += v * b3;
  37396. t16 += v * b4;
  37397. t17 += v * b5;
  37398. t18 += v * b6;
  37399. t19 += v * b7;
  37400. t20 += v * b8;
  37401. t21 += v * b9;
  37402. t22 += v * b10;
  37403. t23 += v * b11;
  37404. t24 += v * b12;
  37405. t25 += v * b13;
  37406. t26 += v * b14;
  37407. t27 += v * b15;
  37408. v = a[13];
  37409. t13 += v * b0;
  37410. t14 += v * b1;
  37411. t15 += v * b2;
  37412. t16 += v * b3;
  37413. t17 += v * b4;
  37414. t18 += v * b5;
  37415. t19 += v * b6;
  37416. t20 += v * b7;
  37417. t21 += v * b8;
  37418. t22 += v * b9;
  37419. t23 += v * b10;
  37420. t24 += v * b11;
  37421. t25 += v * b12;
  37422. t26 += v * b13;
  37423. t27 += v * b14;
  37424. t28 += v * b15;
  37425. v = a[14];
  37426. t14 += v * b0;
  37427. t15 += v * b1;
  37428. t16 += v * b2;
  37429. t17 += v * b3;
  37430. t18 += v * b4;
  37431. t19 += v * b5;
  37432. t20 += v * b6;
  37433. t21 += v * b7;
  37434. t22 += v * b8;
  37435. t23 += v * b9;
  37436. t24 += v * b10;
  37437. t25 += v * b11;
  37438. t26 += v * b12;
  37439. t27 += v * b13;
  37440. t28 += v * b14;
  37441. t29 += v * b15;
  37442. v = a[15];
  37443. t15 += v * b0;
  37444. t16 += v * b1;
  37445. t17 += v * b2;
  37446. t18 += v * b3;
  37447. t19 += v * b4;
  37448. t20 += v * b5;
  37449. t21 += v * b6;
  37450. t22 += v * b7;
  37451. t23 += v * b8;
  37452. t24 += v * b9;
  37453. t25 += v * b10;
  37454. t26 += v * b11;
  37455. t27 += v * b12;
  37456. t28 += v * b13;
  37457. t29 += v * b14;
  37458. t30 += v * b15;
  37459. t0 += 38 * t16;
  37460. t1 += 38 * t17;
  37461. t2 += 38 * t18;
  37462. t3 += 38 * t19;
  37463. t4 += 38 * t20;
  37464. t5 += 38 * t21;
  37465. t6 += 38 * t22;
  37466. t7 += 38 * t23;
  37467. t8 += 38 * t24;
  37468. t9 += 38 * t25;
  37469. t10 += 38 * t26;
  37470. t11 += 38 * t27;
  37471. t12 += 38 * t28;
  37472. t13 += 38 * t29;
  37473. t14 += 38 * t30;
  37474. // t15 left as is
  37475. // first car
  37476. c = 1;
  37477. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37478. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37479. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37480. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37481. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37482. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37483. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37484. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37485. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37486. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37487. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37488. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37489. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37490. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37491. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37492. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37493. t0 += c-1 + 37 * (c-1);
  37494. // second car
  37495. c = 1;
  37496. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37497. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37498. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37499. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37500. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37501. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37502. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37503. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37504. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37505. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37506. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37507. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37508. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37509. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37510. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37511. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37512. t0 += c-1 + 37 * (c-1);
  37513. o[ 0] = t0;
  37514. o[ 1] = t1;
  37515. o[ 2] = t2;
  37516. o[ 3] = t3;
  37517. o[ 4] = t4;
  37518. o[ 5] = t5;
  37519. o[ 6] = t6;
  37520. o[ 7] = t7;
  37521. o[ 8] = t8;
  37522. o[ 9] = t9;
  37523. o[10] = t10;
  37524. o[11] = t11;
  37525. o[12] = t12;
  37526. o[13] = t13;
  37527. o[14] = t14;
  37528. o[15] = t15;
  37529. }
  37530. function S(o, a) {
  37531. M(o, a, a);
  37532. }
  37533. function inv25519(o, i) {
  37534. var c = gf();
  37535. var a;
  37536. for (a = 0; a < 16; a++) c[a] = i[a];
  37537. for (a = 253; a >= 0; a--) {
  37538. S(c, c);
  37539. if(a !== 2 && a !== 4) M(c, c, i);
  37540. }
  37541. for (a = 0; a < 16; a++) o[a] = c[a];
  37542. }
  37543. function pow2523(o, i) {
  37544. var c = gf();
  37545. var a;
  37546. for (a = 0; a < 16; a++) c[a] = i[a];
  37547. for (a = 250; a >= 0; a--) {
  37548. S(c, c);
  37549. if(a !== 1) M(c, c, i);
  37550. }
  37551. for (a = 0; a < 16; a++) o[a] = c[a];
  37552. }
  37553. function crypto_scalarmult(q, n, p) {
  37554. var z = new Uint8Array(32);
  37555. var x = new Float64Array(80), r, i;
  37556. var a = gf(), b = gf(), c = gf(),
  37557. d = gf(), e = gf(), f = gf();
  37558. for (i = 0; i < 31; i++) z[i] = n[i];
  37559. z[31]=(n[31]&127)|64;
  37560. z[0]&=248;
  37561. unpack25519(x,p);
  37562. for (i = 0; i < 16; i++) {
  37563. b[i]=x[i];
  37564. d[i]=a[i]=c[i]=0;
  37565. }
  37566. a[0]=d[0]=1;
  37567. for (i=254; i>=0; --i) {
  37568. r=(z[i>>>3]>>>(i&7))&1;
  37569. sel25519(a,b,r);
  37570. sel25519(c,d,r);
  37571. A(e,a,c);
  37572. Z(a,a,c);
  37573. A(c,b,d);
  37574. Z(b,b,d);
  37575. S(d,e);
  37576. S(f,a);
  37577. M(a,c,a);
  37578. M(c,b,e);
  37579. A(e,a,c);
  37580. Z(a,a,c);
  37581. S(b,a);
  37582. Z(c,d,f);
  37583. M(a,c,_121665);
  37584. A(a,a,d);
  37585. M(c,c,a);
  37586. M(a,d,f);
  37587. M(d,b,x);
  37588. S(b,e);
  37589. sel25519(a,b,r);
  37590. sel25519(c,d,r);
  37591. }
  37592. for (i = 0; i < 16; i++) {
  37593. x[i+16]=a[i];
  37594. x[i+32]=c[i];
  37595. x[i+48]=b[i];
  37596. x[i+64]=d[i];
  37597. }
  37598. var x32 = x.subarray(32);
  37599. var x16 = x.subarray(16);
  37600. inv25519(x32,x32);
  37601. M(x16,x16,x32);
  37602. pack25519(q,x16);
  37603. return 0;
  37604. }
  37605. function crypto_scalarmult_base(q, n) {
  37606. return crypto_scalarmult(q, n, _9);
  37607. }
  37608. function crypto_box_keypair(y, x) {
  37609. randombytes(x, 32);
  37610. return crypto_scalarmult_base(y, x);
  37611. }
  37612. function crypto_box_beforenm(k, y, x) {
  37613. var s = new Uint8Array(32);
  37614. crypto_scalarmult(s, x, y);
  37615. return crypto_core_hsalsa20(k, _0, s, sigma);
  37616. }
  37617. var crypto_box_afternm = crypto_secretbox;
  37618. var crypto_box_open_afternm = crypto_secretbox_open;
  37619. function crypto_box(c, m, d, n, y, x) {
  37620. var k = new Uint8Array(32);
  37621. crypto_box_beforenm(k, y, x);
  37622. return crypto_box_afternm(c, m, d, n, k);
  37623. }
  37624. function crypto_box_open(m, c, d, n, y, x) {
  37625. var k = new Uint8Array(32);
  37626. crypto_box_beforenm(k, y, x);
  37627. return crypto_box_open_afternm(m, c, d, n, k);
  37628. }
  37629. var K = [
  37630. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37631. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37632. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37633. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37634. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37635. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37636. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37637. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37638. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37639. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37640. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37641. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37642. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37643. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37644. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37645. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37646. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37647. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37648. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37649. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37650. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37651. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37652. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37653. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37654. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37655. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37656. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37657. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37658. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37659. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37660. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37661. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37662. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37663. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37664. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37665. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37666. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37667. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37668. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37669. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37670. ];
  37671. function crypto_hashblocks_hl(hh, hl, m, n) {
  37672. var wh = new Int32Array(16), wl = new Int32Array(16),
  37673. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37674. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37675. th, tl, i, j, h, l, a, b, c, d;
  37676. var ah0 = hh[0],
  37677. ah1 = hh[1],
  37678. ah2 = hh[2],
  37679. ah3 = hh[3],
  37680. ah4 = hh[4],
  37681. ah5 = hh[5],
  37682. ah6 = hh[6],
  37683. ah7 = hh[7],
  37684. al0 = hl[0],
  37685. al1 = hl[1],
  37686. al2 = hl[2],
  37687. al3 = hl[3],
  37688. al4 = hl[4],
  37689. al5 = hl[5],
  37690. al6 = hl[6],
  37691. al7 = hl[7];
  37692. var pos = 0;
  37693. while (n >= 128) {
  37694. for (i = 0; i < 16; i++) {
  37695. j = 8 * i + pos;
  37696. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37697. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37698. }
  37699. for (i = 0; i < 80; i++) {
  37700. bh0 = ah0;
  37701. bh1 = ah1;
  37702. bh2 = ah2;
  37703. bh3 = ah3;
  37704. bh4 = ah4;
  37705. bh5 = ah5;
  37706. bh6 = ah6;
  37707. bh7 = ah7;
  37708. bl0 = al0;
  37709. bl1 = al1;
  37710. bl2 = al2;
  37711. bl3 = al3;
  37712. bl4 = al4;
  37713. bl5 = al5;
  37714. bl6 = al6;
  37715. bl7 = al7;
  37716. // add
  37717. h = ah7;
  37718. l = al7;
  37719. a = l & 0xffff; b = l >>> 16;
  37720. c = h & 0xffff; d = h >>> 16;
  37721. // Sigma1
  37722. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  37723. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  37724. a += l & 0xffff; b += l >>> 16;
  37725. c += h & 0xffff; d += h >>> 16;
  37726. // Ch
  37727. h = (ah4 & ah5) ^ (~ah4 & ah6);
  37728. l = (al4 & al5) ^ (~al4 & al6);
  37729. a += l & 0xffff; b += l >>> 16;
  37730. c += h & 0xffff; d += h >>> 16;
  37731. // K
  37732. h = K[i*2];
  37733. l = K[i*2+1];
  37734. a += l & 0xffff; b += l >>> 16;
  37735. c += h & 0xffff; d += h >>> 16;
  37736. // w
  37737. h = wh[i%16];
  37738. l = wl[i%16];
  37739. a += l & 0xffff; b += l >>> 16;
  37740. c += h & 0xffff; d += h >>> 16;
  37741. b += a >>> 16;
  37742. c += b >>> 16;
  37743. d += c >>> 16;
  37744. th = c & 0xffff | d << 16;
  37745. tl = a & 0xffff | b << 16;
  37746. // add
  37747. h = th;
  37748. l = tl;
  37749. a = l & 0xffff; b = l >>> 16;
  37750. c = h & 0xffff; d = h >>> 16;
  37751. // Sigma0
  37752. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  37753. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  37754. a += l & 0xffff; b += l >>> 16;
  37755. c += h & 0xffff; d += h >>> 16;
  37756. // Maj
  37757. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  37758. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  37759. a += l & 0xffff; b += l >>> 16;
  37760. c += h & 0xffff; d += h >>> 16;
  37761. b += a >>> 16;
  37762. c += b >>> 16;
  37763. d += c >>> 16;
  37764. bh7 = (c & 0xffff) | (d << 16);
  37765. bl7 = (a & 0xffff) | (b << 16);
  37766. // add
  37767. h = bh3;
  37768. l = bl3;
  37769. a = l & 0xffff; b = l >>> 16;
  37770. c = h & 0xffff; d = h >>> 16;
  37771. h = th;
  37772. l = tl;
  37773. a += l & 0xffff; b += l >>> 16;
  37774. c += h & 0xffff; d += h >>> 16;
  37775. b += a >>> 16;
  37776. c += b >>> 16;
  37777. d += c >>> 16;
  37778. bh3 = (c & 0xffff) | (d << 16);
  37779. bl3 = (a & 0xffff) | (b << 16);
  37780. ah1 = bh0;
  37781. ah2 = bh1;
  37782. ah3 = bh2;
  37783. ah4 = bh3;
  37784. ah5 = bh4;
  37785. ah6 = bh5;
  37786. ah7 = bh6;
  37787. ah0 = bh7;
  37788. al1 = bl0;
  37789. al2 = bl1;
  37790. al3 = bl2;
  37791. al4 = bl3;
  37792. al5 = bl4;
  37793. al6 = bl5;
  37794. al7 = bl6;
  37795. al0 = bl7;
  37796. if (i%16 === 15) {
  37797. for (j = 0; j < 16; j++) {
  37798. // add
  37799. h = wh[j];
  37800. l = wl[j];
  37801. a = l & 0xffff; b = l >>> 16;
  37802. c = h & 0xffff; d = h >>> 16;
  37803. h = wh[(j+9)%16];
  37804. l = wl[(j+9)%16];
  37805. a += l & 0xffff; b += l >>> 16;
  37806. c += h & 0xffff; d += h >>> 16;
  37807. // sigma0
  37808. th = wh[(j+1)%16];
  37809. tl = wl[(j+1)%16];
  37810. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  37811. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  37812. a += l & 0xffff; b += l >>> 16;
  37813. c += h & 0xffff; d += h >>> 16;
  37814. // sigma1
  37815. th = wh[(j+14)%16];
  37816. tl = wl[(j+14)%16];
  37817. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  37818. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  37819. a += l & 0xffff; b += l >>> 16;
  37820. c += h & 0xffff; d += h >>> 16;
  37821. b += a >>> 16;
  37822. c += b >>> 16;
  37823. d += c >>> 16;
  37824. wh[j] = (c & 0xffff) | (d << 16);
  37825. wl[j] = (a & 0xffff) | (b << 16);
  37826. }
  37827. }
  37828. }
  37829. // add
  37830. h = ah0;
  37831. l = al0;
  37832. a = l & 0xffff; b = l >>> 16;
  37833. c = h & 0xffff; d = h >>> 16;
  37834. h = hh[0];
  37835. l = hl[0];
  37836. a += l & 0xffff; b += l >>> 16;
  37837. c += h & 0xffff; d += h >>> 16;
  37838. b += a >>> 16;
  37839. c += b >>> 16;
  37840. d += c >>> 16;
  37841. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  37842. hl[0] = al0 = (a & 0xffff) | (b << 16);
  37843. h = ah1;
  37844. l = al1;
  37845. a = l & 0xffff; b = l >>> 16;
  37846. c = h & 0xffff; d = h >>> 16;
  37847. h = hh[1];
  37848. l = hl[1];
  37849. a += l & 0xffff; b += l >>> 16;
  37850. c += h & 0xffff; d += h >>> 16;
  37851. b += a >>> 16;
  37852. c += b >>> 16;
  37853. d += c >>> 16;
  37854. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  37855. hl[1] = al1 = (a & 0xffff) | (b << 16);
  37856. h = ah2;
  37857. l = al2;
  37858. a = l & 0xffff; b = l >>> 16;
  37859. c = h & 0xffff; d = h >>> 16;
  37860. h = hh[2];
  37861. l = hl[2];
  37862. a += l & 0xffff; b += l >>> 16;
  37863. c += h & 0xffff; d += h >>> 16;
  37864. b += a >>> 16;
  37865. c += b >>> 16;
  37866. d += c >>> 16;
  37867. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  37868. hl[2] = al2 = (a & 0xffff) | (b << 16);
  37869. h = ah3;
  37870. l = al3;
  37871. a = l & 0xffff; b = l >>> 16;
  37872. c = h & 0xffff; d = h >>> 16;
  37873. h = hh[3];
  37874. l = hl[3];
  37875. a += l & 0xffff; b += l >>> 16;
  37876. c += h & 0xffff; d += h >>> 16;
  37877. b += a >>> 16;
  37878. c += b >>> 16;
  37879. d += c >>> 16;
  37880. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  37881. hl[3] = al3 = (a & 0xffff) | (b << 16);
  37882. h = ah4;
  37883. l = al4;
  37884. a = l & 0xffff; b = l >>> 16;
  37885. c = h & 0xffff; d = h >>> 16;
  37886. h = hh[4];
  37887. l = hl[4];
  37888. a += l & 0xffff; b += l >>> 16;
  37889. c += h & 0xffff; d += h >>> 16;
  37890. b += a >>> 16;
  37891. c += b >>> 16;
  37892. d += c >>> 16;
  37893. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  37894. hl[4] = al4 = (a & 0xffff) | (b << 16);
  37895. h = ah5;
  37896. l = al5;
  37897. a = l & 0xffff; b = l >>> 16;
  37898. c = h & 0xffff; d = h >>> 16;
  37899. h = hh[5];
  37900. l = hl[5];
  37901. a += l & 0xffff; b += l >>> 16;
  37902. c += h & 0xffff; d += h >>> 16;
  37903. b += a >>> 16;
  37904. c += b >>> 16;
  37905. d += c >>> 16;
  37906. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  37907. hl[5] = al5 = (a & 0xffff) | (b << 16);
  37908. h = ah6;
  37909. l = al6;
  37910. a = l & 0xffff; b = l >>> 16;
  37911. c = h & 0xffff; d = h >>> 16;
  37912. h = hh[6];
  37913. l = hl[6];
  37914. a += l & 0xffff; b += l >>> 16;
  37915. c += h & 0xffff; d += h >>> 16;
  37916. b += a >>> 16;
  37917. c += b >>> 16;
  37918. d += c >>> 16;
  37919. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  37920. hl[6] = al6 = (a & 0xffff) | (b << 16);
  37921. h = ah7;
  37922. l = al7;
  37923. a = l & 0xffff; b = l >>> 16;
  37924. c = h & 0xffff; d = h >>> 16;
  37925. h = hh[7];
  37926. l = hl[7];
  37927. a += l & 0xffff; b += l >>> 16;
  37928. c += h & 0xffff; d += h >>> 16;
  37929. b += a >>> 16;
  37930. c += b >>> 16;
  37931. d += c >>> 16;
  37932. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  37933. hl[7] = al7 = (a & 0xffff) | (b << 16);
  37934. pos += 128;
  37935. n -= 128;
  37936. }
  37937. return n;
  37938. }
  37939. function crypto_hash(out, m, n) {
  37940. var hh = new Int32Array(8),
  37941. hl = new Int32Array(8),
  37942. x = new Uint8Array(256),
  37943. i, b = n;
  37944. hh[0] = 0x6a09e667;
  37945. hh[1] = 0xbb67ae85;
  37946. hh[2] = 0x3c6ef372;
  37947. hh[3] = 0xa54ff53a;
  37948. hh[4] = 0x510e527f;
  37949. hh[5] = 0x9b05688c;
  37950. hh[6] = 0x1f83d9ab;
  37951. hh[7] = 0x5be0cd19;
  37952. hl[0] = 0xf3bcc908;
  37953. hl[1] = 0x84caa73b;
  37954. hl[2] = 0xfe94f82b;
  37955. hl[3] = 0x5f1d36f1;
  37956. hl[4] = 0xade682d1;
  37957. hl[5] = 0x2b3e6c1f;
  37958. hl[6] = 0xfb41bd6b;
  37959. hl[7] = 0x137e2179;
  37960. crypto_hashblocks_hl(hh, hl, m, n);
  37961. n %= 128;
  37962. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  37963. x[n] = 128;
  37964. n = 256-128*(n<112?1:0);
  37965. x[n-9] = 0;
  37966. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  37967. crypto_hashblocks_hl(hh, hl, x, n);
  37968. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  37969. return 0;
  37970. }
  37971. function add(p, q) {
  37972. var a = gf(), b = gf(), c = gf(),
  37973. d = gf(), e = gf(), f = gf(),
  37974. g = gf(), h = gf(), t = gf();
  37975. Z(a, p[1], p[0]);
  37976. Z(t, q[1], q[0]);
  37977. M(a, a, t);
  37978. A(b, p[0], p[1]);
  37979. A(t, q[0], q[1]);
  37980. M(b, b, t);
  37981. M(c, p[3], q[3]);
  37982. M(c, c, D2);
  37983. M(d, p[2], q[2]);
  37984. A(d, d, d);
  37985. Z(e, b, a);
  37986. Z(f, d, c);
  37987. A(g, d, c);
  37988. A(h, b, a);
  37989. M(p[0], e, f);
  37990. M(p[1], h, g);
  37991. M(p[2], g, f);
  37992. M(p[3], e, h);
  37993. }
  37994. function cswap(p, q, b) {
  37995. var i;
  37996. for (i = 0; i < 4; i++) {
  37997. sel25519(p[i], q[i], b);
  37998. }
  37999. }
  38000. function pack(r, p) {
  38001. var tx = gf(), ty = gf(), zi = gf();
  38002. inv25519(zi, p[2]);
  38003. M(tx, p[0], zi);
  38004. M(ty, p[1], zi);
  38005. pack25519(r, ty);
  38006. r[31] ^= par25519(tx) << 7;
  38007. }
  38008. function scalarmult(p, q, s) {
  38009. var b, i;
  38010. set25519(p[0], gf0);
  38011. set25519(p[1], gf1);
  38012. set25519(p[2], gf1);
  38013. set25519(p[3], gf0);
  38014. for (i = 255; i >= 0; --i) {
  38015. b = (s[(i/8)|0] >> (i&7)) & 1;
  38016. cswap(p, q, b);
  38017. add(q, p);
  38018. add(p, p);
  38019. cswap(p, q, b);
  38020. }
  38021. }
  38022. function scalarbase(p, s) {
  38023. var q = [gf(), gf(), gf(), gf()];
  38024. set25519(q[0], X);
  38025. set25519(q[1], Y);
  38026. set25519(q[2], gf1);
  38027. M(q[3], X, Y);
  38028. scalarmult(p, q, s);
  38029. }
  38030. function crypto_sign_keypair(pk, sk, seeded) {
  38031. var d = new Uint8Array(64);
  38032. var p = [gf(), gf(), gf(), gf()];
  38033. var i;
  38034. if (!seeded) randombytes(sk, 32);
  38035. crypto_hash(d, sk, 32);
  38036. d[0] &= 248;
  38037. d[31] &= 127;
  38038. d[31] |= 64;
  38039. scalarbase(p, d);
  38040. pack(pk, p);
  38041. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38042. return 0;
  38043. }
  38044. 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]);
  38045. function modL(r, x) {
  38046. var carry, i, j, k;
  38047. for (i = 63; i >= 32; --i) {
  38048. carry = 0;
  38049. for (j = i - 32, k = i - 12; j < k; ++j) {
  38050. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38051. carry = (x[j] + 128) >> 8;
  38052. x[j] -= carry * 256;
  38053. }
  38054. x[j] += carry;
  38055. x[i] = 0;
  38056. }
  38057. carry = 0;
  38058. for (j = 0; j < 32; j++) {
  38059. x[j] += carry - (x[31] >> 4) * L[j];
  38060. carry = x[j] >> 8;
  38061. x[j] &= 255;
  38062. }
  38063. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38064. for (i = 0; i < 32; i++) {
  38065. x[i+1] += x[i] >> 8;
  38066. r[i] = x[i] & 255;
  38067. }
  38068. }
  38069. function reduce(r) {
  38070. var x = new Float64Array(64), i;
  38071. for (i = 0; i < 64; i++) x[i] = r[i];
  38072. for (i = 0; i < 64; i++) r[i] = 0;
  38073. modL(r, x);
  38074. }
  38075. // Note: difference from C - smlen returned, not passed as argument.
  38076. function crypto_sign(sm, m, n, sk) {
  38077. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38078. var i, j, x = new Float64Array(64);
  38079. var p = [gf(), gf(), gf(), gf()];
  38080. crypto_hash(d, sk, 32);
  38081. d[0] &= 248;
  38082. d[31] &= 127;
  38083. d[31] |= 64;
  38084. var smlen = n + 64;
  38085. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38086. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38087. crypto_hash(r, sm.subarray(32), n+32);
  38088. reduce(r);
  38089. scalarbase(p, r);
  38090. pack(sm, p);
  38091. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38092. crypto_hash(h, sm, n + 64);
  38093. reduce(h);
  38094. for (i = 0; i < 64; i++) x[i] = 0;
  38095. for (i = 0; i < 32; i++) x[i] = r[i];
  38096. for (i = 0; i < 32; i++) {
  38097. for (j = 0; j < 32; j++) {
  38098. x[i+j] += h[i] * d[j];
  38099. }
  38100. }
  38101. modL(sm.subarray(32), x);
  38102. return smlen;
  38103. }
  38104. function unpackneg(r, p) {
  38105. var t = gf(), chk = gf(), num = gf(),
  38106. den = gf(), den2 = gf(), den4 = gf(),
  38107. den6 = gf();
  38108. set25519(r[2], gf1);
  38109. unpack25519(r[1], p);
  38110. S(num, r[1]);
  38111. M(den, num, D);
  38112. Z(num, num, r[2]);
  38113. A(den, r[2], den);
  38114. S(den2, den);
  38115. S(den4, den2);
  38116. M(den6, den4, den2);
  38117. M(t, den6, num);
  38118. M(t, t, den);
  38119. pow2523(t, t);
  38120. M(t, t, num);
  38121. M(t, t, den);
  38122. M(t, t, den);
  38123. M(r[0], t, den);
  38124. S(chk, r[0]);
  38125. M(chk, chk, den);
  38126. if (neq25519(chk, num)) M(r[0], r[0], I);
  38127. S(chk, r[0]);
  38128. M(chk, chk, den);
  38129. if (neq25519(chk, num)) return -1;
  38130. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38131. M(r[3], r[0], r[1]);
  38132. return 0;
  38133. }
  38134. function crypto_sign_open(m, sm, n, pk) {
  38135. var i, mlen;
  38136. var t = new Uint8Array(32), h = new Uint8Array(64);
  38137. var p = [gf(), gf(), gf(), gf()],
  38138. q = [gf(), gf(), gf(), gf()];
  38139. mlen = -1;
  38140. if (n < 64) return -1;
  38141. if (unpackneg(q, pk)) return -1;
  38142. for (i = 0; i < n; i++) m[i] = sm[i];
  38143. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38144. crypto_hash(h, m, n);
  38145. reduce(h);
  38146. scalarmult(p, q, h);
  38147. scalarbase(q, sm.subarray(32));
  38148. add(p, q);
  38149. pack(t, p);
  38150. n -= 64;
  38151. if (crypto_verify_32(sm, 0, t, 0)) {
  38152. for (i = 0; i < n; i++) m[i] = 0;
  38153. return -1;
  38154. }
  38155. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38156. mlen = n;
  38157. return mlen;
  38158. }
  38159. var crypto_secretbox_KEYBYTES = 32,
  38160. crypto_secretbox_NONCEBYTES = 24,
  38161. crypto_secretbox_ZEROBYTES = 32,
  38162. crypto_secretbox_BOXZEROBYTES = 16,
  38163. crypto_scalarmult_BYTES = 32,
  38164. crypto_scalarmult_SCALARBYTES = 32,
  38165. crypto_box_PUBLICKEYBYTES = 32,
  38166. crypto_box_SECRETKEYBYTES = 32,
  38167. crypto_box_BEFORENMBYTES = 32,
  38168. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38169. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38170. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38171. crypto_sign_BYTES = 64,
  38172. crypto_sign_PUBLICKEYBYTES = 32,
  38173. crypto_sign_SECRETKEYBYTES = 64,
  38174. crypto_sign_SEEDBYTES = 32,
  38175. crypto_hash_BYTES = 64;
  38176. nacl.lowlevel = {
  38177. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38178. crypto_stream_xor: crypto_stream_xor,
  38179. crypto_stream: crypto_stream,
  38180. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38181. crypto_stream_salsa20: crypto_stream_salsa20,
  38182. crypto_onetimeauth: crypto_onetimeauth,
  38183. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38184. crypto_verify_16: crypto_verify_16,
  38185. crypto_verify_32: crypto_verify_32,
  38186. crypto_secretbox: crypto_secretbox,
  38187. crypto_secretbox_open: crypto_secretbox_open,
  38188. crypto_scalarmult: crypto_scalarmult,
  38189. crypto_scalarmult_base: crypto_scalarmult_base,
  38190. crypto_box_beforenm: crypto_box_beforenm,
  38191. crypto_box_afternm: crypto_box_afternm,
  38192. crypto_box: crypto_box,
  38193. crypto_box_open: crypto_box_open,
  38194. crypto_box_keypair: crypto_box_keypair,
  38195. crypto_hash: crypto_hash,
  38196. crypto_sign: crypto_sign,
  38197. crypto_sign_keypair: crypto_sign_keypair,
  38198. crypto_sign_open: crypto_sign_open,
  38199. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38200. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38201. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38202. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38203. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38204. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38205. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38206. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38207. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38208. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38209. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38210. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38211. crypto_sign_BYTES: crypto_sign_BYTES,
  38212. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38213. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38214. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38215. crypto_hash_BYTES: crypto_hash_BYTES
  38216. };
  38217. /* High-level API */
  38218. function checkLengths(k, n) {
  38219. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38220. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38221. }
  38222. function checkBoxLengths(pk, sk) {
  38223. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38224. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38225. }
  38226. function checkArrayTypes() {
  38227. for (var i = 0; i < arguments.length; i++) {
  38228. if (!(arguments[i] instanceof Uint8Array))
  38229. throw new TypeError('unexpected type, use Uint8Array');
  38230. }
  38231. }
  38232. function cleanup(arr) {
  38233. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38234. }
  38235. nacl.randomBytes = function(n) {
  38236. var b = new Uint8Array(n);
  38237. randombytes(b, n);
  38238. return b;
  38239. };
  38240. nacl.secretbox = function(msg, nonce, key) {
  38241. checkArrayTypes(msg, nonce, key);
  38242. checkLengths(key, nonce);
  38243. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38244. var c = new Uint8Array(m.length);
  38245. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38246. crypto_secretbox(c, m, m.length, nonce, key);
  38247. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38248. };
  38249. nacl.secretbox.open = function(box, nonce, key) {
  38250. checkArrayTypes(box, nonce, key);
  38251. checkLengths(key, nonce);
  38252. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38253. var m = new Uint8Array(c.length);
  38254. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38255. if (c.length < 32) return null;
  38256. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38257. return m.subarray(crypto_secretbox_ZEROBYTES);
  38258. };
  38259. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38260. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38261. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38262. nacl.scalarMult = function(n, p) {
  38263. checkArrayTypes(n, p);
  38264. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38265. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38266. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38267. crypto_scalarmult(q, n, p);
  38268. return q;
  38269. };
  38270. nacl.scalarMult.base = function(n) {
  38271. checkArrayTypes(n);
  38272. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38273. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38274. crypto_scalarmult_base(q, n);
  38275. return q;
  38276. };
  38277. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38278. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38279. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38280. var k = nacl.box.before(publicKey, secretKey);
  38281. return nacl.secretbox(msg, nonce, k);
  38282. };
  38283. nacl.box.before = function(publicKey, secretKey) {
  38284. checkArrayTypes(publicKey, secretKey);
  38285. checkBoxLengths(publicKey, secretKey);
  38286. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38287. crypto_box_beforenm(k, publicKey, secretKey);
  38288. return k;
  38289. };
  38290. nacl.box.after = nacl.secretbox;
  38291. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38292. var k = nacl.box.before(publicKey, secretKey);
  38293. return nacl.secretbox.open(msg, nonce, k);
  38294. };
  38295. nacl.box.open.after = nacl.secretbox.open;
  38296. nacl.box.keyPair = function() {
  38297. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38298. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38299. crypto_box_keypair(pk, sk);
  38300. return {publicKey: pk, secretKey: sk};
  38301. };
  38302. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38303. checkArrayTypes(secretKey);
  38304. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38305. throw new Error('bad secret key size');
  38306. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38307. crypto_scalarmult_base(pk, secretKey);
  38308. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38309. };
  38310. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38311. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38312. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38313. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38314. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38315. nacl.sign = function(msg, secretKey) {
  38316. checkArrayTypes(msg, secretKey);
  38317. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38318. throw new Error('bad secret key size');
  38319. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38320. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38321. return signedMsg;
  38322. };
  38323. nacl.sign.open = function(signedMsg, publicKey) {
  38324. checkArrayTypes(signedMsg, publicKey);
  38325. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38326. throw new Error('bad public key size');
  38327. var tmp = new Uint8Array(signedMsg.length);
  38328. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38329. if (mlen < 0) return null;
  38330. var m = new Uint8Array(mlen);
  38331. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38332. return m;
  38333. };
  38334. nacl.sign.detached = function(msg, secretKey) {
  38335. var signedMsg = nacl.sign(msg, secretKey);
  38336. var sig = new Uint8Array(crypto_sign_BYTES);
  38337. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38338. return sig;
  38339. };
  38340. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38341. checkArrayTypes(msg, sig, publicKey);
  38342. if (sig.length !== crypto_sign_BYTES)
  38343. throw new Error('bad signature size');
  38344. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38345. throw new Error('bad public key size');
  38346. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38347. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38348. var i;
  38349. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38350. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38351. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38352. };
  38353. nacl.sign.keyPair = function() {
  38354. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38355. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38356. crypto_sign_keypair(pk, sk);
  38357. return {publicKey: pk, secretKey: sk};
  38358. };
  38359. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38360. checkArrayTypes(secretKey);
  38361. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38362. throw new Error('bad secret key size');
  38363. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38364. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38365. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38366. };
  38367. nacl.sign.keyPair.fromSeed = function(seed) {
  38368. checkArrayTypes(seed);
  38369. if (seed.length !== crypto_sign_SEEDBYTES)
  38370. throw new Error('bad seed size');
  38371. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38372. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38373. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38374. crypto_sign_keypair(pk, sk, true);
  38375. return {publicKey: pk, secretKey: sk};
  38376. };
  38377. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38378. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38379. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38380. nacl.sign.signatureLength = crypto_sign_BYTES;
  38381. nacl.hash = function(msg) {
  38382. checkArrayTypes(msg);
  38383. var h = new Uint8Array(crypto_hash_BYTES);
  38384. crypto_hash(h, msg, msg.length);
  38385. return h;
  38386. };
  38387. nacl.hash.hashLength = crypto_hash_BYTES;
  38388. nacl.verify = function(x, y) {
  38389. checkArrayTypes(x, y);
  38390. // Zero length arguments are considered not equal.
  38391. if (x.length === 0 || y.length === 0) return false;
  38392. if (x.length !== y.length) return false;
  38393. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38394. };
  38395. nacl.setPRNG = function(fn) {
  38396. randombytes = fn;
  38397. };
  38398. (function() {
  38399. // Initialize PRNG if environment provides CSPRNG.
  38400. // If not, methods calling randombytes will throw.
  38401. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38402. if (crypto && crypto.getRandomValues) {
  38403. // Browsers.
  38404. var QUOTA = 65536;
  38405. nacl.setPRNG(function(x, n) {
  38406. var i, v = new Uint8Array(n);
  38407. for (i = 0; i < n; i += QUOTA) {
  38408. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38409. }
  38410. for (i = 0; i < n; i++) x[i] = v[i];
  38411. cleanup(v);
  38412. });
  38413. } else if (true) {
  38414. // Node.js.
  38415. crypto = __webpack_require__(3);
  38416. if (crypto && crypto.randomBytes) {
  38417. nacl.setPRNG(function(x, n) {
  38418. var i, v = crypto.randomBytes(n);
  38419. for (i = 0; i < n; i++) x[i] = v[i];
  38420. cleanup(v);
  38421. });
  38422. }
  38423. }
  38424. })();
  38425. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38426. /***/ }),
  38427. /* 1 */
  38428. /***/ (function(module, exports, __webpack_require__) {
  38429. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38430. // Public domain.
  38431. (function(root, f) {
  38432. 'use strict';
  38433. if ( true && module.exports) module.exports = f();
  38434. else if (root.nacl) root.nacl.util = f();
  38435. else {
  38436. root.nacl = {};
  38437. root.nacl.util = f();
  38438. }
  38439. }(this, function() {
  38440. 'use strict';
  38441. var util = {};
  38442. function validateBase64(s) {
  38443. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38444. throw new TypeError('invalid encoding');
  38445. }
  38446. }
  38447. util.decodeUTF8 = function(s) {
  38448. if (typeof s !== 'string') throw new TypeError('expected string');
  38449. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38450. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38451. return b;
  38452. };
  38453. util.encodeUTF8 = function(arr) {
  38454. var i, s = [];
  38455. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38456. return decodeURIComponent(escape(s.join('')));
  38457. };
  38458. if (typeof atob === 'undefined') {
  38459. // Node.js
  38460. if (typeof Buffer.from !== 'undefined') {
  38461. // Node v6 and later
  38462. util.encodeBase64 = function (arr) { // v6 and later
  38463. return Buffer.from(arr).toString('base64');
  38464. };
  38465. util.decodeBase64 = function (s) {
  38466. validateBase64(s);
  38467. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38468. };
  38469. } else {
  38470. // Node earlier than v6
  38471. util.encodeBase64 = function (arr) { // v6 and later
  38472. return (new Buffer(arr)).toString('base64');
  38473. };
  38474. util.decodeBase64 = function(s) {
  38475. validateBase64(s);
  38476. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38477. };
  38478. }
  38479. } else {
  38480. // Browsers
  38481. util.encodeBase64 = function(arr) {
  38482. var i, s = [], len = arr.length;
  38483. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38484. return btoa(s.join(''));
  38485. };
  38486. util.decodeBase64 = function(s) {
  38487. validateBase64(s);
  38488. var i, d = atob(s), b = new Uint8Array(d.length);
  38489. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38490. return b;
  38491. };
  38492. }
  38493. return util;
  38494. }));
  38495. /***/ }),
  38496. /* 2 */
  38497. /***/ (function(module, exports, __webpack_require__) {
  38498. // required so we don't have to do require('pusher').default etc.
  38499. module.exports = __webpack_require__(4).default;
  38500. /***/ }),
  38501. /* 3 */
  38502. /***/ (function(module, exports) {
  38503. /* (ignored) */
  38504. /***/ }),
  38505. /* 4 */
  38506. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38507. "use strict";
  38508. __webpack_require__.r(__webpack_exports__);
  38509. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38510. var ScriptReceiverFactory = (function () {
  38511. function ScriptReceiverFactory(prefix, name) {
  38512. this.lastId = 0;
  38513. this.prefix = prefix;
  38514. this.name = name;
  38515. }
  38516. ScriptReceiverFactory.prototype.create = function (callback) {
  38517. this.lastId++;
  38518. var number = this.lastId;
  38519. var id = this.prefix + number;
  38520. var name = this.name + "[" + number + "]";
  38521. var called = false;
  38522. var callbackWrapper = function () {
  38523. if (!called) {
  38524. callback.apply(null, arguments);
  38525. called = true;
  38526. }
  38527. };
  38528. this[number] = callbackWrapper;
  38529. return { number: number, id: id, name: name, callback: callbackWrapper };
  38530. };
  38531. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38532. delete this[receiver.number];
  38533. };
  38534. return ScriptReceiverFactory;
  38535. }());
  38536. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38537. // CONCATENATED MODULE: ./src/core/defaults.ts
  38538. var Defaults = {
  38539. VERSION: "5.0.3",
  38540. PROTOCOL: 7,
  38541. host: 'ws.pusherapp.com',
  38542. ws_port: 80,
  38543. wss_port: 443,
  38544. ws_path: '',
  38545. sockjs_host: 'sockjs.pusher.com',
  38546. sockjs_http_port: 80,
  38547. sockjs_https_port: 443,
  38548. sockjs_path: '/pusher',
  38549. stats_host: 'stats.pusher.com',
  38550. channel_auth_endpoint: '/pusher/auth',
  38551. channel_auth_transport: 'ajax',
  38552. activity_timeout: 120000,
  38553. pong_timeout: 30000,
  38554. unavailable_timeout: 10000,
  38555. cdn_http: "http://js.pusher.com",
  38556. cdn_https: "https://js.pusher.com",
  38557. dependency_suffix: ""
  38558. };
  38559. /* harmony default export */ var defaults = (Defaults);
  38560. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38561. var dependency_loader_DependencyLoader = (function () {
  38562. function DependencyLoader(options) {
  38563. this.options = options;
  38564. this.receivers = options.receivers || ScriptReceivers;
  38565. this.loading = {};
  38566. }
  38567. DependencyLoader.prototype.load = function (name, options, callback) {
  38568. var self = this;
  38569. if (self.loading[name] && self.loading[name].length > 0) {
  38570. self.loading[name].push(callback);
  38571. }
  38572. else {
  38573. self.loading[name] = [callback];
  38574. var request = runtime.createScriptRequest(self.getPath(name, options));
  38575. var receiver = self.receivers.create(function (error) {
  38576. self.receivers.remove(receiver);
  38577. if (self.loading[name]) {
  38578. var callbacks = self.loading[name];
  38579. delete self.loading[name];
  38580. var successCallback = function (wasSuccessful) {
  38581. if (!wasSuccessful) {
  38582. request.cleanup();
  38583. }
  38584. };
  38585. for (var i = 0; i < callbacks.length; i++) {
  38586. callbacks[i](error, successCallback);
  38587. }
  38588. }
  38589. });
  38590. request.send(receiver);
  38591. }
  38592. };
  38593. DependencyLoader.prototype.getRoot = function (options) {
  38594. var cdn;
  38595. var protocol = runtime.getDocument().location.protocol;
  38596. if ((options && options.useTLS) || protocol === "https:") {
  38597. cdn = this.options.cdn_https;
  38598. }
  38599. else {
  38600. cdn = this.options.cdn_http;
  38601. }
  38602. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38603. };
  38604. DependencyLoader.prototype.getPath = function (name, options) {
  38605. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38606. };
  38607. ;
  38608. return DependencyLoader;
  38609. }());
  38610. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38611. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38612. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38613. var Dependencies = new dependency_loader({
  38614. cdn_http: defaults.cdn_http,
  38615. cdn_https: defaults.cdn_https,
  38616. version: defaults.VERSION,
  38617. suffix: defaults.dependency_suffix,
  38618. receivers: DependenciesReceivers
  38619. });
  38620. // CONCATENATED MODULE: ./src/core/base64.ts
  38621. function encode(s) {
  38622. return btoa(utob(s));
  38623. }
  38624. var fromCharCode = String.fromCharCode;
  38625. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38626. var b64tab = {};
  38627. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38628. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38629. }
  38630. var cb_utob = function (c) {
  38631. var cc = c.charCodeAt(0);
  38632. return cc < 0x80
  38633. ? c
  38634. : cc < 0x800
  38635. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38636. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38637. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38638. fromCharCode(0x80 | (cc & 0x3f));
  38639. };
  38640. var utob = function (u) {
  38641. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38642. };
  38643. var cb_encode = function (ccc) {
  38644. var padlen = [0, 2, 1][ccc.length % 3];
  38645. var ord = (ccc.charCodeAt(0) << 16) |
  38646. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38647. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38648. var chars = [
  38649. b64chars.charAt(ord >>> 18),
  38650. b64chars.charAt((ord >>> 12) & 63),
  38651. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38652. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38653. ];
  38654. return chars.join('');
  38655. };
  38656. var btoa = window.btoa ||
  38657. function (b) {
  38658. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38659. };
  38660. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38661. var Timer = (function () {
  38662. function Timer(set, clear, delay, callback) {
  38663. var _this = this;
  38664. this.clear = clear;
  38665. this.timer = set(function () {
  38666. if (_this.timer) {
  38667. _this.timer = callback(_this.timer);
  38668. }
  38669. }, delay);
  38670. }
  38671. Timer.prototype.isRunning = function () {
  38672. return this.timer !== null;
  38673. };
  38674. Timer.prototype.ensureAborted = function () {
  38675. if (this.timer) {
  38676. this.clear(this.timer);
  38677. this.timer = null;
  38678. }
  38679. };
  38680. return Timer;
  38681. }());
  38682. /* harmony default export */ var abstract_timer = (Timer);
  38683. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38684. var __extends = (undefined && undefined.__extends) || (function () {
  38685. var extendStatics = function (d, b) {
  38686. extendStatics = Object.setPrototypeOf ||
  38687. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38688. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38689. return extendStatics(d, b);
  38690. };
  38691. return function (d, b) {
  38692. extendStatics(d, b);
  38693. function __() { this.constructor = d; }
  38694. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38695. };
  38696. })();
  38697. function timers_clearTimeout(timer) {
  38698. window.clearTimeout(timer);
  38699. }
  38700. function timers_clearInterval(timer) {
  38701. window.clearInterval(timer);
  38702. }
  38703. var OneOffTimer = (function (_super) {
  38704. __extends(OneOffTimer, _super);
  38705. function OneOffTimer(delay, callback) {
  38706. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  38707. callback();
  38708. return null;
  38709. }) || this;
  38710. }
  38711. return OneOffTimer;
  38712. }(abstract_timer));
  38713. var PeriodicTimer = (function (_super) {
  38714. __extends(PeriodicTimer, _super);
  38715. function PeriodicTimer(delay, callback) {
  38716. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  38717. callback();
  38718. return timer;
  38719. }) || this;
  38720. }
  38721. return PeriodicTimer;
  38722. }(abstract_timer));
  38723. // CONCATENATED MODULE: ./src/core/util.ts
  38724. var Util = {
  38725. now: function () {
  38726. if (Date.now) {
  38727. return Date.now();
  38728. }
  38729. else {
  38730. return new Date().valueOf();
  38731. }
  38732. },
  38733. defer: function (callback) {
  38734. return new OneOffTimer(0, callback);
  38735. },
  38736. method: function (name) {
  38737. var args = [];
  38738. for (var _i = 1; _i < arguments.length; _i++) {
  38739. args[_i - 1] = arguments[_i];
  38740. }
  38741. var boundArguments = Array.prototype.slice.call(arguments, 1);
  38742. return function (object) {
  38743. return object[name].apply(object, boundArguments.concat(arguments));
  38744. };
  38745. }
  38746. };
  38747. /* harmony default export */ var util = (Util);
  38748. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  38749. function extend(target) {
  38750. var sources = [];
  38751. for (var _i = 1; _i < arguments.length; _i++) {
  38752. sources[_i - 1] = arguments[_i];
  38753. }
  38754. for (var i = 0; i < sources.length; i++) {
  38755. var extensions = sources[i];
  38756. for (var property in extensions) {
  38757. if (extensions[property] && extensions[property].constructor &&
  38758. extensions[property].constructor === Object) {
  38759. target[property] = extend(target[property] || {}, extensions[property]);
  38760. }
  38761. else {
  38762. target[property] = extensions[property];
  38763. }
  38764. }
  38765. }
  38766. return target;
  38767. }
  38768. function stringify() {
  38769. var m = ["Pusher"];
  38770. for (var i = 0; i < arguments.length; i++) {
  38771. if (typeof arguments[i] === "string") {
  38772. m.push(arguments[i]);
  38773. }
  38774. else {
  38775. m.push(safeJSONStringify(arguments[i]));
  38776. }
  38777. }
  38778. return m.join(" : ");
  38779. }
  38780. function arrayIndexOf(array, item) {
  38781. var nativeIndexOf = Array.prototype.indexOf;
  38782. if (array === null) {
  38783. return -1;
  38784. }
  38785. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  38786. return array.indexOf(item);
  38787. }
  38788. for (var i = 0, l = array.length; i < l; i++) {
  38789. if (array[i] === item) {
  38790. return i;
  38791. }
  38792. }
  38793. return -1;
  38794. }
  38795. function objectApply(object, f) {
  38796. for (var key in object) {
  38797. if (Object.prototype.hasOwnProperty.call(object, key)) {
  38798. f(object[key], key, object);
  38799. }
  38800. }
  38801. }
  38802. function keys(object) {
  38803. var keys = [];
  38804. objectApply(object, function (_, key) {
  38805. keys.push(key);
  38806. });
  38807. return keys;
  38808. }
  38809. function values(object) {
  38810. var values = [];
  38811. objectApply(object, function (value) {
  38812. values.push(value);
  38813. });
  38814. return values;
  38815. }
  38816. function apply(array, f, context) {
  38817. for (var i = 0; i < array.length; i++) {
  38818. f.call(context || window, array[i], i, array);
  38819. }
  38820. }
  38821. function map(array, f) {
  38822. var result = [];
  38823. for (var i = 0; i < array.length; i++) {
  38824. result.push(f(array[i], i, array, result));
  38825. }
  38826. return result;
  38827. }
  38828. function mapObject(object, f) {
  38829. var result = {};
  38830. objectApply(object, function (value, key) {
  38831. result[key] = f(value);
  38832. });
  38833. return result;
  38834. }
  38835. function filter(array, test) {
  38836. test = test || function (value) { return !!value; };
  38837. var result = [];
  38838. for (var i = 0; i < array.length; i++) {
  38839. if (test(array[i], i, array, result)) {
  38840. result.push(array[i]);
  38841. }
  38842. }
  38843. return result;
  38844. }
  38845. function filterObject(object, test) {
  38846. var result = {};
  38847. objectApply(object, function (value, key) {
  38848. if ((test && test(value, key, object, result)) || Boolean(value)) {
  38849. result[key] = value;
  38850. }
  38851. });
  38852. return result;
  38853. }
  38854. function flatten(object) {
  38855. var result = [];
  38856. objectApply(object, function (value, key) {
  38857. result.push([key, value]);
  38858. });
  38859. return result;
  38860. }
  38861. function any(array, test) {
  38862. for (var i = 0; i < array.length; i++) {
  38863. if (test(array[i], i, array)) {
  38864. return true;
  38865. }
  38866. }
  38867. return false;
  38868. }
  38869. function collections_all(array, test) {
  38870. for (var i = 0; i < array.length; i++) {
  38871. if (!test(array[i], i, array)) {
  38872. return false;
  38873. }
  38874. }
  38875. return true;
  38876. }
  38877. function encodeParamsObject(data) {
  38878. return mapObject(data, function (value) {
  38879. if (typeof value === "object") {
  38880. value = safeJSONStringify(value);
  38881. }
  38882. return encodeURIComponent(encode(value.toString()));
  38883. });
  38884. }
  38885. function buildQueryString(data) {
  38886. var params = filterObject(data, function (value) {
  38887. return value !== undefined;
  38888. });
  38889. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  38890. return query;
  38891. }
  38892. function decycleObject(object) {
  38893. var objects = [], paths = [];
  38894. return (function derez(value, path) {
  38895. var i, name, nu;
  38896. switch (typeof value) {
  38897. case 'object':
  38898. if (!value) {
  38899. return null;
  38900. }
  38901. for (i = 0; i < objects.length; i += 1) {
  38902. if (objects[i] === value) {
  38903. return { $ref: paths[i] };
  38904. }
  38905. }
  38906. objects.push(value);
  38907. paths.push(path);
  38908. if (Object.prototype.toString.apply(value) === '[object Array]') {
  38909. nu = [];
  38910. for (i = 0; i < value.length; i += 1) {
  38911. nu[i] = derez(value[i], path + '[' + i + ']');
  38912. }
  38913. }
  38914. else {
  38915. nu = {};
  38916. for (name in value) {
  38917. if (Object.prototype.hasOwnProperty.call(value, name)) {
  38918. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  38919. }
  38920. }
  38921. }
  38922. return nu;
  38923. case 'number':
  38924. case 'string':
  38925. case 'boolean':
  38926. return value;
  38927. }
  38928. }(object, '$'));
  38929. }
  38930. function safeJSONStringify(source) {
  38931. try {
  38932. return JSON.stringify(source);
  38933. }
  38934. catch (e) {
  38935. return JSON.stringify(decycleObject(source));
  38936. }
  38937. }
  38938. // CONCATENATED MODULE: ./src/core/logger.ts
  38939. var logger_Logger = (function () {
  38940. function Logger() {
  38941. this.globalLog = function (message) {
  38942. if (window.console && window.console.log) {
  38943. window.console.log(message);
  38944. }
  38945. };
  38946. }
  38947. Logger.prototype.debug = function () {
  38948. var args = [];
  38949. for (var _i = 0; _i < arguments.length; _i++) {
  38950. args[_i] = arguments[_i];
  38951. }
  38952. this.log(this.globalLog, args);
  38953. };
  38954. Logger.prototype.warn = function () {
  38955. var args = [];
  38956. for (var _i = 0; _i < arguments.length; _i++) {
  38957. args[_i] = arguments[_i];
  38958. }
  38959. this.log(this.globalLogWarn, args);
  38960. };
  38961. Logger.prototype.error = function () {
  38962. var args = [];
  38963. for (var _i = 0; _i < arguments.length; _i++) {
  38964. args[_i] = arguments[_i];
  38965. }
  38966. this.log(this.globalLogError, args);
  38967. };
  38968. Logger.prototype.globalLogWarn = function (message) {
  38969. if (window.console && window.console.warn) {
  38970. window.console.warn(message);
  38971. }
  38972. else {
  38973. this.globalLog(message);
  38974. }
  38975. };
  38976. Logger.prototype.globalLogError = function (message) {
  38977. if (window.console && window.console.error) {
  38978. window.console.error(message);
  38979. }
  38980. else {
  38981. this.globalLogWarn(message);
  38982. }
  38983. };
  38984. Logger.prototype.log = function (defaultLoggingFunction) {
  38985. var args = [];
  38986. for (var _i = 1; _i < arguments.length; _i++) {
  38987. args[_i - 1] = arguments[_i];
  38988. }
  38989. var message = stringify.apply(this, arguments);
  38990. if (core_pusher.log) {
  38991. core_pusher.log(message);
  38992. }
  38993. else if (core_pusher.logToConsole) {
  38994. var log = defaultLoggingFunction.bind(this);
  38995. log(message);
  38996. }
  38997. };
  38998. return Logger;
  38999. }());
  39000. /* harmony default export */ var logger = (new logger_Logger());
  39001. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39002. var urlStore = {
  39003. baseUrl: "https://pusher.com",
  39004. urls: {
  39005. authenticationEndpoint: {
  39006. path: "/docs/authenticating_users",
  39007. },
  39008. javascriptQuickStart: {
  39009. path: "/docs/javascript_quick_start"
  39010. },
  39011. triggeringClientEvents: {
  39012. path: "/docs/client_api_guide/client_events#trigger-events"
  39013. }
  39014. }
  39015. };
  39016. var buildLogSuffix = function (key) {
  39017. var urlPrefix = "See:";
  39018. var urlObj = urlStore.urls[key];
  39019. if (!urlObj)
  39020. return "";
  39021. var url;
  39022. if (urlObj.fullUrl) {
  39023. url = urlObj.fullUrl;
  39024. }
  39025. else if (urlObj.path) {
  39026. url = urlStore.baseUrl + urlObj.path;
  39027. }
  39028. if (!url)
  39029. return "";
  39030. return urlPrefix + " " + url;
  39031. };
  39032. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39033. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39034. var ajax = function (context, socketId, callback) {
  39035. var self = this, xhr;
  39036. xhr = runtime.createXHR();
  39037. xhr.open("POST", self.options.authEndpoint, true);
  39038. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39039. for (var headerName in this.authOptions.headers) {
  39040. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39041. }
  39042. xhr.onreadystatechange = function () {
  39043. if (xhr.readyState === 4) {
  39044. if (xhr.status === 200) {
  39045. var data, parsed = false;
  39046. try {
  39047. data = JSON.parse(xhr.responseText);
  39048. parsed = true;
  39049. }
  39050. catch (e) {
  39051. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39052. }
  39053. if (parsed) {
  39054. callback(false, data);
  39055. }
  39056. }
  39057. else {
  39058. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39059. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39060. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39061. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39062. callback(true, xhr.status);
  39063. }
  39064. }
  39065. };
  39066. xhr.send(this.composeQuery(socketId));
  39067. return xhr;
  39068. };
  39069. /* harmony default export */ var xhr_auth = (ajax);
  39070. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39071. var jsonp = function (context, socketId, callback) {
  39072. if (this.authOptions.headers !== undefined) {
  39073. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39074. }
  39075. var callbackName = context.nextAuthCallbackID.toString();
  39076. context.nextAuthCallbackID++;
  39077. var document = context.getDocument();
  39078. var script = document.createElement("script");
  39079. context.auth_callbacks[callbackName] = function (data) {
  39080. callback(false, data);
  39081. };
  39082. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39083. script.src = this.options.authEndpoint +
  39084. '?callback=' +
  39085. encodeURIComponent(callback_name) +
  39086. '&' +
  39087. this.composeQuery(socketId);
  39088. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39089. head.insertBefore(script, head.firstChild);
  39090. };
  39091. /* harmony default export */ var jsonp_auth = (jsonp);
  39092. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39093. var ScriptRequest = (function () {
  39094. function ScriptRequest(src) {
  39095. this.src = src;
  39096. }
  39097. ScriptRequest.prototype.send = function (receiver) {
  39098. var self = this;
  39099. var errorString = "Error loading " + self.src;
  39100. self.script = document.createElement("script");
  39101. self.script.id = receiver.id;
  39102. self.script.src = self.src;
  39103. self.script.type = "text/javascript";
  39104. self.script.charset = "UTF-8";
  39105. if (self.script.addEventListener) {
  39106. self.script.onerror = function () {
  39107. receiver.callback(errorString);
  39108. };
  39109. self.script.onload = function () {
  39110. receiver.callback(null);
  39111. };
  39112. }
  39113. else {
  39114. self.script.onreadystatechange = function () {
  39115. if (self.script.readyState === 'loaded' ||
  39116. self.script.readyState === 'complete') {
  39117. receiver.callback(null);
  39118. }
  39119. };
  39120. }
  39121. if (self.script.async === undefined && document.attachEvent &&
  39122. /opera/i.test(navigator.userAgent)) {
  39123. self.errorScript = document.createElement("script");
  39124. self.errorScript.id = receiver.id + "_error";
  39125. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39126. self.script.async = self.errorScript.async = false;
  39127. }
  39128. else {
  39129. self.script.async = true;
  39130. }
  39131. var head = document.getElementsByTagName('head')[0];
  39132. head.insertBefore(self.script, head.firstChild);
  39133. if (self.errorScript) {
  39134. head.insertBefore(self.errorScript, self.script.nextSibling);
  39135. }
  39136. };
  39137. ScriptRequest.prototype.cleanup = function () {
  39138. if (this.script) {
  39139. this.script.onload = this.script.onerror = null;
  39140. this.script.onreadystatechange = null;
  39141. }
  39142. if (this.script && this.script.parentNode) {
  39143. this.script.parentNode.removeChild(this.script);
  39144. }
  39145. if (this.errorScript && this.errorScript.parentNode) {
  39146. this.errorScript.parentNode.removeChild(this.errorScript);
  39147. }
  39148. this.script = null;
  39149. this.errorScript = null;
  39150. };
  39151. return ScriptRequest;
  39152. }());
  39153. /* harmony default export */ var script_request = (ScriptRequest);
  39154. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39155. var jsonp_request_JSONPRequest = (function () {
  39156. function JSONPRequest(url, data) {
  39157. this.url = url;
  39158. this.data = data;
  39159. }
  39160. JSONPRequest.prototype.send = function (receiver) {
  39161. if (this.request) {
  39162. return;
  39163. }
  39164. var query = buildQueryString(this.data);
  39165. var url = this.url + "/" + receiver.number + "?" + query;
  39166. this.request = runtime.createScriptRequest(url);
  39167. this.request.send(receiver);
  39168. };
  39169. JSONPRequest.prototype.cleanup = function () {
  39170. if (this.request) {
  39171. this.request.cleanup();
  39172. }
  39173. };
  39174. return JSONPRequest;
  39175. }());
  39176. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39177. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39178. var getAgent = function (sender, useTLS) {
  39179. return function (data, callback) {
  39180. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39181. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39182. var request = runtime.createJSONPRequest(url, data);
  39183. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39184. ScriptReceivers.remove(receiver);
  39185. request.cleanup();
  39186. if (result && result.host) {
  39187. sender.host = result.host;
  39188. }
  39189. if (callback) {
  39190. callback(error, result);
  39191. }
  39192. });
  39193. request.send(receiver);
  39194. };
  39195. };
  39196. var jsonp_timeline_jsonp = {
  39197. name: 'jsonp',
  39198. getAgent: getAgent
  39199. };
  39200. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39201. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39202. function getGenericURL(baseScheme, params, path) {
  39203. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39204. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39205. return scheme + "://" + host + path;
  39206. }
  39207. function getGenericPath(key, queryString) {
  39208. var path = "/app/" + key;
  39209. var query = "?protocol=" + defaults.PROTOCOL +
  39210. "&client=js" +
  39211. "&version=" + defaults.VERSION +
  39212. (queryString ? ("&" + queryString) : "");
  39213. return path + query;
  39214. }
  39215. var ws = {
  39216. getInitial: function (key, params) {
  39217. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39218. return getGenericURL("ws", params, path);
  39219. }
  39220. };
  39221. var http = {
  39222. getInitial: function (key, params) {
  39223. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39224. return getGenericURL("http", params, path);
  39225. }
  39226. };
  39227. var sockjs = {
  39228. getInitial: function (key, params) {
  39229. return getGenericURL("http", params, params.httpPath || "/pusher");
  39230. },
  39231. getPath: function (key, params) {
  39232. return getGenericPath(key);
  39233. }
  39234. };
  39235. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39236. var callback_registry_CallbackRegistry = (function () {
  39237. function CallbackRegistry() {
  39238. this._callbacks = {};
  39239. }
  39240. CallbackRegistry.prototype.get = function (name) {
  39241. return this._callbacks[prefix(name)];
  39242. };
  39243. CallbackRegistry.prototype.add = function (name, callback, context) {
  39244. var prefixedEventName = prefix(name);
  39245. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39246. this._callbacks[prefixedEventName].push({
  39247. fn: callback,
  39248. context: context
  39249. });
  39250. };
  39251. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39252. if (!name && !callback && !context) {
  39253. this._callbacks = {};
  39254. return;
  39255. }
  39256. var names = name ? [prefix(name)] : keys(this._callbacks);
  39257. if (callback || context) {
  39258. this.removeCallback(names, callback, context);
  39259. }
  39260. else {
  39261. this.removeAllCallbacks(names);
  39262. }
  39263. };
  39264. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39265. apply(names, function (name) {
  39266. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39267. return (callback && callback !== binding.fn) ||
  39268. (context && context !== binding.context);
  39269. });
  39270. if (this._callbacks[name].length === 0) {
  39271. delete this._callbacks[name];
  39272. }
  39273. }, this);
  39274. };
  39275. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39276. apply(names, function (name) {
  39277. delete this._callbacks[name];
  39278. }, this);
  39279. };
  39280. return CallbackRegistry;
  39281. }());
  39282. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39283. function prefix(name) {
  39284. return "_" + name;
  39285. }
  39286. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39287. var dispatcher_Dispatcher = (function () {
  39288. function Dispatcher(failThrough) {
  39289. this.callbacks = new callback_registry();
  39290. this.global_callbacks = [];
  39291. this.failThrough = failThrough;
  39292. }
  39293. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39294. this.callbacks.add(eventName, callback, context);
  39295. return this;
  39296. };
  39297. Dispatcher.prototype.bind_global = function (callback) {
  39298. this.global_callbacks.push(callback);
  39299. return this;
  39300. };
  39301. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39302. this.callbacks.remove(eventName, callback, context);
  39303. return this;
  39304. };
  39305. Dispatcher.prototype.unbind_global = function (callback) {
  39306. if (!callback) {
  39307. this.global_callbacks = [];
  39308. return this;
  39309. }
  39310. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39311. return this;
  39312. };
  39313. Dispatcher.prototype.unbind_all = function () {
  39314. this.unbind();
  39315. this.unbind_global();
  39316. return this;
  39317. };
  39318. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39319. for (var i = 0; i < this.global_callbacks.length; i++) {
  39320. this.global_callbacks[i](eventName, data);
  39321. }
  39322. var callbacks = this.callbacks.get(eventName);
  39323. var args = [];
  39324. if (metadata) {
  39325. args.push(data, metadata);
  39326. }
  39327. else if (data) {
  39328. args.push(data);
  39329. }
  39330. if (callbacks && callbacks.length > 0) {
  39331. for (var i = 0; i < callbacks.length; i++) {
  39332. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39333. }
  39334. }
  39335. else if (this.failThrough) {
  39336. this.failThrough(eventName, data);
  39337. }
  39338. return this;
  39339. };
  39340. return Dispatcher;
  39341. }());
  39342. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39343. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39344. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39345. var extendStatics = function (d, b) {
  39346. extendStatics = Object.setPrototypeOf ||
  39347. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39348. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39349. return extendStatics(d, b);
  39350. };
  39351. return function (d, b) {
  39352. extendStatics(d, b);
  39353. function __() { this.constructor = d; }
  39354. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39355. };
  39356. })();
  39357. var transport_connection_TransportConnection = (function (_super) {
  39358. transport_connection_extends(TransportConnection, _super);
  39359. function TransportConnection(hooks, name, priority, key, options) {
  39360. var _this = _super.call(this) || this;
  39361. _this.initialize = runtime.transportConnectionInitializer;
  39362. _this.hooks = hooks;
  39363. _this.name = name;
  39364. _this.priority = priority;
  39365. _this.key = key;
  39366. _this.options = options;
  39367. _this.state = "new";
  39368. _this.timeline = options.timeline;
  39369. _this.activityTimeout = options.activityTimeout;
  39370. _this.id = _this.timeline.generateUniqueID();
  39371. return _this;
  39372. }
  39373. TransportConnection.prototype.handlesActivityChecks = function () {
  39374. return Boolean(this.hooks.handlesActivityChecks);
  39375. };
  39376. TransportConnection.prototype.supportsPing = function () {
  39377. return Boolean(this.hooks.supportsPing);
  39378. };
  39379. TransportConnection.prototype.connect = function () {
  39380. var _this = this;
  39381. if (this.socket || this.state !== "initialized") {
  39382. return false;
  39383. }
  39384. var url = this.hooks.urls.getInitial(this.key, this.options);
  39385. try {
  39386. this.socket = this.hooks.getSocket(url, this.options);
  39387. }
  39388. catch (e) {
  39389. util.defer(function () {
  39390. _this.onError(e);
  39391. _this.changeState("closed");
  39392. });
  39393. return false;
  39394. }
  39395. this.bindListeners();
  39396. logger.debug("Connecting", { transport: this.name, url: url });
  39397. this.changeState("connecting");
  39398. return true;
  39399. };
  39400. TransportConnection.prototype.close = function () {
  39401. if (this.socket) {
  39402. this.socket.close();
  39403. return true;
  39404. }
  39405. else {
  39406. return false;
  39407. }
  39408. };
  39409. TransportConnection.prototype.send = function (data) {
  39410. var _this = this;
  39411. if (this.state === "open") {
  39412. util.defer(function () {
  39413. if (_this.socket) {
  39414. _this.socket.send(data);
  39415. }
  39416. });
  39417. return true;
  39418. }
  39419. else {
  39420. return false;
  39421. }
  39422. };
  39423. TransportConnection.prototype.ping = function () {
  39424. if (this.state === "open" && this.supportsPing()) {
  39425. this.socket.ping();
  39426. }
  39427. };
  39428. TransportConnection.prototype.onOpen = function () {
  39429. if (this.hooks.beforeOpen) {
  39430. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39431. }
  39432. this.changeState("open");
  39433. this.socket.onopen = undefined;
  39434. };
  39435. TransportConnection.prototype.onError = function (error) {
  39436. this.emit("error", { type: 'WebSocketError', error: error });
  39437. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39438. };
  39439. TransportConnection.prototype.onClose = function (closeEvent) {
  39440. if (closeEvent) {
  39441. this.changeState("closed", {
  39442. code: closeEvent.code,
  39443. reason: closeEvent.reason,
  39444. wasClean: closeEvent.wasClean
  39445. });
  39446. }
  39447. else {
  39448. this.changeState("closed");
  39449. }
  39450. this.unbindListeners();
  39451. this.socket = undefined;
  39452. };
  39453. TransportConnection.prototype.onMessage = function (message) {
  39454. this.emit("message", message);
  39455. };
  39456. TransportConnection.prototype.onActivity = function () {
  39457. this.emit("activity");
  39458. };
  39459. TransportConnection.prototype.bindListeners = function () {
  39460. var _this = this;
  39461. this.socket.onopen = function () {
  39462. _this.onOpen();
  39463. };
  39464. this.socket.onerror = function (error) {
  39465. _this.onError(error);
  39466. };
  39467. this.socket.onclose = function (closeEvent) {
  39468. _this.onClose(closeEvent);
  39469. };
  39470. this.socket.onmessage = function (message) {
  39471. _this.onMessage(message);
  39472. };
  39473. if (this.supportsPing()) {
  39474. this.socket.onactivity = function () { _this.onActivity(); };
  39475. }
  39476. };
  39477. TransportConnection.prototype.unbindListeners = function () {
  39478. if (this.socket) {
  39479. this.socket.onopen = undefined;
  39480. this.socket.onerror = undefined;
  39481. this.socket.onclose = undefined;
  39482. this.socket.onmessage = undefined;
  39483. if (this.supportsPing()) {
  39484. this.socket.onactivity = undefined;
  39485. }
  39486. }
  39487. };
  39488. TransportConnection.prototype.changeState = function (state, params) {
  39489. this.state = state;
  39490. this.timeline.info(this.buildTimelineMessage({
  39491. state: state,
  39492. params: params
  39493. }));
  39494. this.emit(state, params);
  39495. };
  39496. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39497. return extend({ cid: this.id }, message);
  39498. };
  39499. return TransportConnection;
  39500. }(dispatcher));
  39501. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39502. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39503. var transport_Transport = (function () {
  39504. function Transport(hooks) {
  39505. this.hooks = hooks;
  39506. }
  39507. Transport.prototype.isSupported = function (environment) {
  39508. return this.hooks.isSupported(environment);
  39509. };
  39510. Transport.prototype.createConnection = function (name, priority, key, options) {
  39511. return new transport_connection(this.hooks, name, priority, key, options);
  39512. };
  39513. return Transport;
  39514. }());
  39515. /* harmony default export */ var transports_transport = (transport_Transport);
  39516. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39517. var WSTransport = new transports_transport({
  39518. urls: ws,
  39519. handlesActivityChecks: false,
  39520. supportsPing: false,
  39521. isInitialized: function () {
  39522. return Boolean(runtime.getWebSocketAPI());
  39523. },
  39524. isSupported: function () {
  39525. return Boolean(runtime.getWebSocketAPI());
  39526. },
  39527. getSocket: function (url) {
  39528. return runtime.createWebSocket(url);
  39529. }
  39530. });
  39531. var httpConfiguration = {
  39532. urls: http,
  39533. handlesActivityChecks: false,
  39534. supportsPing: true,
  39535. isInitialized: function () {
  39536. return true;
  39537. }
  39538. };
  39539. var streamingConfiguration = extend({ getSocket: function (url) {
  39540. return runtime.HTTPFactory.createStreamingSocket(url);
  39541. }
  39542. }, httpConfiguration);
  39543. var pollingConfiguration = extend({ getSocket: function (url) {
  39544. return runtime.HTTPFactory.createPollingSocket(url);
  39545. }
  39546. }, httpConfiguration);
  39547. var xhrConfiguration = {
  39548. isSupported: function () {
  39549. return runtime.isXHRSupported();
  39550. }
  39551. };
  39552. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39553. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39554. var Transports = {
  39555. ws: WSTransport,
  39556. xhr_streaming: XHRStreamingTransport,
  39557. xhr_polling: XHRPollingTransport
  39558. };
  39559. /* harmony default export */ var transports = (Transports);
  39560. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39561. var SockJSTransport = new transports_transport({
  39562. file: "sockjs",
  39563. urls: sockjs,
  39564. handlesActivityChecks: true,
  39565. supportsPing: false,
  39566. isSupported: function () {
  39567. return true;
  39568. },
  39569. isInitialized: function () {
  39570. return window.SockJS !== undefined;
  39571. },
  39572. getSocket: function (url, options) {
  39573. return new window.SockJS(url, null, {
  39574. js_path: Dependencies.getPath("sockjs", {
  39575. useTLS: options.useTLS
  39576. }),
  39577. ignore_null_origin: options.ignoreNullOrigin
  39578. });
  39579. },
  39580. beforeOpen: function (socket, path) {
  39581. socket.send(JSON.stringify({
  39582. path: path
  39583. }));
  39584. }
  39585. });
  39586. var xdrConfiguration = {
  39587. isSupported: function (environment) {
  39588. var yes = runtime.isXDRSupported(environment.useTLS);
  39589. return yes;
  39590. }
  39591. };
  39592. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39593. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39594. transports.xdr_streaming = XDRStreamingTransport;
  39595. transports.xdr_polling = XDRPollingTransport;
  39596. transports.sockjs = SockJSTransport;
  39597. /* harmony default export */ var transports_transports = (transports);
  39598. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39599. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39600. var extendStatics = function (d, b) {
  39601. extendStatics = Object.setPrototypeOf ||
  39602. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39603. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39604. return extendStatics(d, b);
  39605. };
  39606. return function (d, b) {
  39607. extendStatics(d, b);
  39608. function __() { this.constructor = d; }
  39609. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39610. };
  39611. })();
  39612. var NetInfo = (function (_super) {
  39613. net_info_extends(NetInfo, _super);
  39614. function NetInfo() {
  39615. var _this = _super.call(this) || this;
  39616. var self = _this;
  39617. if (window.addEventListener !== undefined) {
  39618. window.addEventListener("online", function () {
  39619. self.emit('online');
  39620. }, false);
  39621. window.addEventListener("offline", function () {
  39622. self.emit('offline');
  39623. }, false);
  39624. }
  39625. return _this;
  39626. }
  39627. NetInfo.prototype.isOnline = function () {
  39628. if (window.navigator.onLine === undefined) {
  39629. return true;
  39630. }
  39631. else {
  39632. return window.navigator.onLine;
  39633. }
  39634. };
  39635. return NetInfo;
  39636. }(dispatcher));
  39637. var net_info_Network = new NetInfo();
  39638. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39639. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39640. function AssistantToTheTransportManager(manager, transport, options) {
  39641. this.manager = manager;
  39642. this.transport = transport;
  39643. this.minPingDelay = options.minPingDelay;
  39644. this.maxPingDelay = options.maxPingDelay;
  39645. this.pingDelay = undefined;
  39646. }
  39647. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39648. var _this = this;
  39649. options = extend({}, options, {
  39650. activityTimeout: this.pingDelay
  39651. });
  39652. var connection = this.transport.createConnection(name, priority, key, options);
  39653. var openTimestamp = null;
  39654. var onOpen = function () {
  39655. connection.unbind("open", onOpen);
  39656. connection.bind("closed", onClosed);
  39657. openTimestamp = util.now();
  39658. };
  39659. var onClosed = function (closeEvent) {
  39660. connection.unbind("closed", onClosed);
  39661. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39662. _this.manager.reportDeath();
  39663. }
  39664. else if (!closeEvent.wasClean && openTimestamp) {
  39665. var lifespan = util.now() - openTimestamp;
  39666. if (lifespan < 2 * _this.maxPingDelay) {
  39667. _this.manager.reportDeath();
  39668. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39669. }
  39670. }
  39671. };
  39672. connection.bind("open", onOpen);
  39673. return connection;
  39674. };
  39675. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39676. return this.manager.isAlive() && this.transport.isSupported(environment);
  39677. };
  39678. return AssistantToTheTransportManager;
  39679. }());
  39680. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39681. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39682. var Protocol = {
  39683. decodeMessage: function (messageEvent) {
  39684. try {
  39685. var messageData = JSON.parse(messageEvent.data);
  39686. var pusherEventData = messageData.data;
  39687. if (typeof pusherEventData === 'string') {
  39688. try {
  39689. pusherEventData = JSON.parse(messageData.data);
  39690. }
  39691. catch (e) { }
  39692. }
  39693. var pusherEvent = {
  39694. event: messageData.event,
  39695. channel: messageData.channel,
  39696. data: pusherEventData,
  39697. };
  39698. if (messageData.user_id) {
  39699. pusherEvent.user_id = messageData.user_id;
  39700. }
  39701. return pusherEvent;
  39702. }
  39703. catch (e) {
  39704. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39705. }
  39706. },
  39707. encodeMessage: function (event) {
  39708. return JSON.stringify(event);
  39709. },
  39710. processHandshake: function (messageEvent) {
  39711. var message = Protocol.decodeMessage(messageEvent);
  39712. if (message.event === "pusher:connection_established") {
  39713. if (!message.data.activity_timeout) {
  39714. throw "No activity timeout specified in handshake";
  39715. }
  39716. return {
  39717. action: "connected",
  39718. id: message.data.socket_id,
  39719. activityTimeout: message.data.activity_timeout * 1000
  39720. };
  39721. }
  39722. else if (message.event === "pusher:error") {
  39723. return {
  39724. action: this.getCloseAction(message.data),
  39725. error: this.getCloseError(message.data)
  39726. };
  39727. }
  39728. else {
  39729. throw "Invalid handshake";
  39730. }
  39731. },
  39732. getCloseAction: function (closeEvent) {
  39733. if (closeEvent.code < 4000) {
  39734. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  39735. return "backoff";
  39736. }
  39737. else {
  39738. return null;
  39739. }
  39740. }
  39741. else if (closeEvent.code === 4000) {
  39742. return "tls_only";
  39743. }
  39744. else if (closeEvent.code < 4100) {
  39745. return "refused";
  39746. }
  39747. else if (closeEvent.code < 4200) {
  39748. return "backoff";
  39749. }
  39750. else if (closeEvent.code < 4300) {
  39751. return "retry";
  39752. }
  39753. else {
  39754. return "refused";
  39755. }
  39756. },
  39757. getCloseError: function (closeEvent) {
  39758. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  39759. return {
  39760. type: 'PusherError',
  39761. data: {
  39762. code: closeEvent.code,
  39763. message: closeEvent.reason || closeEvent.message
  39764. }
  39765. };
  39766. }
  39767. else {
  39768. return null;
  39769. }
  39770. }
  39771. };
  39772. /* harmony default export */ var protocol_protocol = (Protocol);
  39773. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  39774. var connection_extends = (undefined && undefined.__extends) || (function () {
  39775. var extendStatics = function (d, b) {
  39776. extendStatics = Object.setPrototypeOf ||
  39777. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39778. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39779. return extendStatics(d, b);
  39780. };
  39781. return function (d, b) {
  39782. extendStatics(d, b);
  39783. function __() { this.constructor = d; }
  39784. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39785. };
  39786. })();
  39787. var connection_Connection = (function (_super) {
  39788. connection_extends(Connection, _super);
  39789. function Connection(id, transport) {
  39790. var _this = _super.call(this) || this;
  39791. _this.id = id;
  39792. _this.transport = transport;
  39793. _this.activityTimeout = transport.activityTimeout;
  39794. _this.bindListeners();
  39795. return _this;
  39796. }
  39797. Connection.prototype.handlesActivityChecks = function () {
  39798. return this.transport.handlesActivityChecks();
  39799. };
  39800. Connection.prototype.send = function (data) {
  39801. return this.transport.send(data);
  39802. };
  39803. Connection.prototype.send_event = function (name, data, channel) {
  39804. var event = { event: name, data: data };
  39805. if (channel) {
  39806. event.channel = channel;
  39807. }
  39808. logger.debug('Event sent', event);
  39809. return this.send(protocol_protocol.encodeMessage(event));
  39810. };
  39811. Connection.prototype.ping = function () {
  39812. if (this.transport.supportsPing()) {
  39813. this.transport.ping();
  39814. }
  39815. else {
  39816. this.send_event('pusher:ping', {});
  39817. }
  39818. };
  39819. Connection.prototype.close = function () {
  39820. this.transport.close();
  39821. };
  39822. Connection.prototype.bindListeners = function () {
  39823. var _this = this;
  39824. var listeners = {
  39825. message: function (messageEvent) {
  39826. var pusherEvent;
  39827. try {
  39828. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  39829. }
  39830. catch (e) {
  39831. _this.emit('error', {
  39832. type: 'MessageParseError',
  39833. error: e,
  39834. data: messageEvent.data
  39835. });
  39836. }
  39837. if (pusherEvent !== undefined) {
  39838. logger.debug('Event recd', pusherEvent);
  39839. switch (pusherEvent.event) {
  39840. case 'pusher:error':
  39841. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  39842. break;
  39843. case 'pusher:ping':
  39844. _this.emit("ping");
  39845. break;
  39846. case 'pusher:pong':
  39847. _this.emit("pong");
  39848. break;
  39849. }
  39850. _this.emit('message', pusherEvent);
  39851. }
  39852. },
  39853. activity: function () {
  39854. _this.emit("activity");
  39855. },
  39856. error: function (error) {
  39857. _this.emit("error", { type: "WebSocketError", error: error });
  39858. },
  39859. closed: function (closeEvent) {
  39860. unbindListeners();
  39861. if (closeEvent && closeEvent.code) {
  39862. _this.handleCloseEvent(closeEvent);
  39863. }
  39864. _this.transport = null;
  39865. _this.emit("closed");
  39866. }
  39867. };
  39868. var unbindListeners = function () {
  39869. objectApply(listeners, function (listener, event) {
  39870. _this.transport.unbind(event, listener);
  39871. });
  39872. };
  39873. objectApply(listeners, function (listener, event) {
  39874. _this.transport.bind(event, listener);
  39875. });
  39876. };
  39877. Connection.prototype.handleCloseEvent = function (closeEvent) {
  39878. var action = protocol_protocol.getCloseAction(closeEvent);
  39879. var error = protocol_protocol.getCloseError(closeEvent);
  39880. if (error) {
  39881. this.emit('error', error);
  39882. }
  39883. if (action) {
  39884. this.emit(action, { action: action, error: error });
  39885. }
  39886. };
  39887. return Connection;
  39888. }(dispatcher));
  39889. /* harmony default export */ var connection_connection = (connection_Connection);
  39890. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  39891. var handshake_Handshake = (function () {
  39892. function Handshake(transport, callback) {
  39893. this.transport = transport;
  39894. this.callback = callback;
  39895. this.bindListeners();
  39896. }
  39897. Handshake.prototype.close = function () {
  39898. this.unbindListeners();
  39899. this.transport.close();
  39900. };
  39901. Handshake.prototype.bindListeners = function () {
  39902. var _this = this;
  39903. this.onMessage = function (m) {
  39904. _this.unbindListeners();
  39905. var result;
  39906. try {
  39907. result = protocol_protocol.processHandshake(m);
  39908. }
  39909. catch (e) {
  39910. _this.finish("error", { error: e });
  39911. _this.transport.close();
  39912. return;
  39913. }
  39914. if (result.action === "connected") {
  39915. _this.finish("connected", {
  39916. connection: new connection_connection(result.id, _this.transport),
  39917. activityTimeout: result.activityTimeout
  39918. });
  39919. }
  39920. else {
  39921. _this.finish(result.action, { error: result.error });
  39922. _this.transport.close();
  39923. }
  39924. };
  39925. this.onClosed = function (closeEvent) {
  39926. _this.unbindListeners();
  39927. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  39928. var error = protocol_protocol.getCloseError(closeEvent);
  39929. _this.finish(action, { error: error });
  39930. };
  39931. this.transport.bind("message", this.onMessage);
  39932. this.transport.bind("closed", this.onClosed);
  39933. };
  39934. Handshake.prototype.unbindListeners = function () {
  39935. this.transport.unbind("message", this.onMessage);
  39936. this.transport.unbind("closed", this.onClosed);
  39937. };
  39938. Handshake.prototype.finish = function (action, params) {
  39939. this.callback(extend({ transport: this.transport, action: action }, params));
  39940. };
  39941. return Handshake;
  39942. }());
  39943. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  39944. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  39945. var pusher_authorizer_PusherAuthorizer = (function () {
  39946. function PusherAuthorizer(channel, options) {
  39947. this.channel = channel;
  39948. var authTransport = options.authTransport;
  39949. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  39950. throw "'" + authTransport + "' is not a recognized auth transport";
  39951. }
  39952. this.type = authTransport;
  39953. this.options = options;
  39954. this.authOptions = (options || {}).auth || {};
  39955. }
  39956. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  39957. var query = 'socket_id=' + encodeURIComponent(socketId) +
  39958. '&channel_name=' + encodeURIComponent(this.channel.name);
  39959. for (var i in this.authOptions.params) {
  39960. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  39961. }
  39962. return query;
  39963. };
  39964. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  39965. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  39966. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  39967. };
  39968. return PusherAuthorizer;
  39969. }());
  39970. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  39971. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  39972. var timeline_sender_TimelineSender = (function () {
  39973. function TimelineSender(timeline, options) {
  39974. this.timeline = timeline;
  39975. this.options = options || {};
  39976. }
  39977. TimelineSender.prototype.send = function (useTLS, callback) {
  39978. if (this.timeline.isEmpty()) {
  39979. return;
  39980. }
  39981. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  39982. };
  39983. return TimelineSender;
  39984. }());
  39985. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  39986. // CONCATENATED MODULE: ./src/core/errors.ts
  39987. var errors_extends = (undefined && undefined.__extends) || (function () {
  39988. var extendStatics = function (d, b) {
  39989. extendStatics = Object.setPrototypeOf ||
  39990. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39991. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39992. return extendStatics(d, b);
  39993. };
  39994. return function (d, b) {
  39995. extendStatics(d, b);
  39996. function __() { this.constructor = d; }
  39997. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39998. };
  39999. })();
  40000. var BadEventName = (function (_super) {
  40001. errors_extends(BadEventName, _super);
  40002. function BadEventName(msg) {
  40003. var _newTarget = this.constructor;
  40004. var _this = _super.call(this, msg) || this;
  40005. Object.setPrototypeOf(_this, _newTarget.prototype);
  40006. return _this;
  40007. }
  40008. return BadEventName;
  40009. }(Error));
  40010. var RequestTimedOut = (function (_super) {
  40011. errors_extends(RequestTimedOut, _super);
  40012. function RequestTimedOut(msg) {
  40013. var _newTarget = this.constructor;
  40014. var _this = _super.call(this, msg) || this;
  40015. Object.setPrototypeOf(_this, _newTarget.prototype);
  40016. return _this;
  40017. }
  40018. return RequestTimedOut;
  40019. }(Error));
  40020. var TransportPriorityTooLow = (function (_super) {
  40021. errors_extends(TransportPriorityTooLow, _super);
  40022. function TransportPriorityTooLow(msg) {
  40023. var _newTarget = this.constructor;
  40024. var _this = _super.call(this, msg) || this;
  40025. Object.setPrototypeOf(_this, _newTarget.prototype);
  40026. return _this;
  40027. }
  40028. return TransportPriorityTooLow;
  40029. }(Error));
  40030. var TransportClosed = (function (_super) {
  40031. errors_extends(TransportClosed, _super);
  40032. function TransportClosed(msg) {
  40033. var _newTarget = this.constructor;
  40034. var _this = _super.call(this, msg) || this;
  40035. Object.setPrototypeOf(_this, _newTarget.prototype);
  40036. return _this;
  40037. }
  40038. return TransportClosed;
  40039. }(Error));
  40040. var UnsupportedFeature = (function (_super) {
  40041. errors_extends(UnsupportedFeature, _super);
  40042. function UnsupportedFeature(msg) {
  40043. var _newTarget = this.constructor;
  40044. var _this = _super.call(this, msg) || this;
  40045. Object.setPrototypeOf(_this, _newTarget.prototype);
  40046. return _this;
  40047. }
  40048. return UnsupportedFeature;
  40049. }(Error));
  40050. var UnsupportedTransport = (function (_super) {
  40051. errors_extends(UnsupportedTransport, _super);
  40052. function UnsupportedTransport(msg) {
  40053. var _newTarget = this.constructor;
  40054. var _this = _super.call(this, msg) || this;
  40055. Object.setPrototypeOf(_this, _newTarget.prototype);
  40056. return _this;
  40057. }
  40058. return UnsupportedTransport;
  40059. }(Error));
  40060. var UnsupportedStrategy = (function (_super) {
  40061. errors_extends(UnsupportedStrategy, _super);
  40062. function UnsupportedStrategy(msg) {
  40063. var _newTarget = this.constructor;
  40064. var _this = _super.call(this, msg) || this;
  40065. Object.setPrototypeOf(_this, _newTarget.prototype);
  40066. return _this;
  40067. }
  40068. return UnsupportedStrategy;
  40069. }(Error));
  40070. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40071. var channel_extends = (undefined && undefined.__extends) || (function () {
  40072. var extendStatics = function (d, b) {
  40073. extendStatics = Object.setPrototypeOf ||
  40074. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40075. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40076. return extendStatics(d, b);
  40077. };
  40078. return function (d, b) {
  40079. extendStatics(d, b);
  40080. function __() { this.constructor = d; }
  40081. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40082. };
  40083. })();
  40084. var channel_Channel = (function (_super) {
  40085. channel_extends(Channel, _super);
  40086. function Channel(name, pusher) {
  40087. var _this = _super.call(this, function (event, data) {
  40088. logger.debug('No callbacks on ' + name + ' for ' + event);
  40089. }) || this;
  40090. _this.name = name;
  40091. _this.pusher = pusher;
  40092. _this.subscribed = false;
  40093. _this.subscriptionPending = false;
  40094. _this.subscriptionCancelled = false;
  40095. return _this;
  40096. }
  40097. Channel.prototype.authorize = function (socketId, callback) {
  40098. return callback(false, {});
  40099. };
  40100. Channel.prototype.trigger = function (event, data) {
  40101. if (event.indexOf("client-") !== 0) {
  40102. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40103. }
  40104. if (!this.subscribed) {
  40105. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40106. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40107. }
  40108. return this.pusher.send_event(event, data, this.name);
  40109. };
  40110. Channel.prototype.disconnect = function () {
  40111. this.subscribed = false;
  40112. this.subscriptionPending = false;
  40113. };
  40114. Channel.prototype.handleEvent = function (event) {
  40115. var eventName = event.event;
  40116. var data = event.data;
  40117. if (eventName === "pusher_internal:subscription_succeeded") {
  40118. this.handleSubscriptionSucceededEvent(event);
  40119. }
  40120. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40121. var metadata = {};
  40122. this.emit(eventName, data, metadata);
  40123. }
  40124. };
  40125. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40126. this.subscriptionPending = false;
  40127. this.subscribed = true;
  40128. if (this.subscriptionCancelled) {
  40129. this.pusher.unsubscribe(this.name);
  40130. }
  40131. else {
  40132. this.emit("pusher:subscription_succeeded", event.data);
  40133. }
  40134. };
  40135. Channel.prototype.subscribe = function () {
  40136. var _this = this;
  40137. if (this.subscribed) {
  40138. return;
  40139. }
  40140. this.subscriptionPending = true;
  40141. this.subscriptionCancelled = false;
  40142. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40143. if (error) {
  40144. logger.error(data);
  40145. _this.emit('pusher:subscription_error', data);
  40146. }
  40147. else {
  40148. _this.pusher.send_event('pusher:subscribe', {
  40149. auth: data.auth,
  40150. channel_data: data.channel_data,
  40151. channel: _this.name
  40152. });
  40153. }
  40154. });
  40155. };
  40156. Channel.prototype.unsubscribe = function () {
  40157. this.subscribed = false;
  40158. this.pusher.send_event('pusher:unsubscribe', {
  40159. channel: this.name
  40160. });
  40161. };
  40162. Channel.prototype.cancelSubscription = function () {
  40163. this.subscriptionCancelled = true;
  40164. };
  40165. Channel.prototype.reinstateSubscription = function () {
  40166. this.subscriptionCancelled = false;
  40167. };
  40168. return Channel;
  40169. }(dispatcher));
  40170. /* harmony default export */ var channels_channel = (channel_Channel);
  40171. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40172. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40173. var extendStatics = function (d, b) {
  40174. extendStatics = Object.setPrototypeOf ||
  40175. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40176. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40177. return extendStatics(d, b);
  40178. };
  40179. return function (d, b) {
  40180. extendStatics(d, b);
  40181. function __() { this.constructor = d; }
  40182. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40183. };
  40184. })();
  40185. var private_channel_PrivateChannel = (function (_super) {
  40186. private_channel_extends(PrivateChannel, _super);
  40187. function PrivateChannel() {
  40188. return _super !== null && _super.apply(this, arguments) || this;
  40189. }
  40190. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40191. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40192. return authorizer.authorize(socketId, callback);
  40193. };
  40194. return PrivateChannel;
  40195. }(channels_channel));
  40196. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40197. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40198. var members_Members = (function () {
  40199. function Members() {
  40200. this.reset();
  40201. }
  40202. Members.prototype.get = function (id) {
  40203. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40204. return {
  40205. id: id,
  40206. info: this.members[id]
  40207. };
  40208. }
  40209. else {
  40210. return null;
  40211. }
  40212. };
  40213. Members.prototype.each = function (callback) {
  40214. var _this = this;
  40215. objectApply(this.members, function (member, id) {
  40216. callback(_this.get(id));
  40217. });
  40218. };
  40219. Members.prototype.setMyID = function (id) {
  40220. this.myID = id;
  40221. };
  40222. Members.prototype.onSubscription = function (subscriptionData) {
  40223. this.members = subscriptionData.presence.hash;
  40224. this.count = subscriptionData.presence.count;
  40225. this.me = this.get(this.myID);
  40226. };
  40227. Members.prototype.addMember = function (memberData) {
  40228. if (this.get(memberData.user_id) === null) {
  40229. this.count++;
  40230. }
  40231. this.members[memberData.user_id] = memberData.user_info;
  40232. return this.get(memberData.user_id);
  40233. };
  40234. Members.prototype.removeMember = function (memberData) {
  40235. var member = this.get(memberData.user_id);
  40236. if (member) {
  40237. delete this.members[memberData.user_id];
  40238. this.count--;
  40239. }
  40240. return member;
  40241. };
  40242. Members.prototype.reset = function () {
  40243. this.members = {};
  40244. this.count = 0;
  40245. this.myID = null;
  40246. this.me = null;
  40247. };
  40248. return Members;
  40249. }());
  40250. /* harmony default export */ var members = (members_Members);
  40251. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40252. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40253. var extendStatics = function (d, b) {
  40254. extendStatics = Object.setPrototypeOf ||
  40255. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40256. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40257. return extendStatics(d, b);
  40258. };
  40259. return function (d, b) {
  40260. extendStatics(d, b);
  40261. function __() { this.constructor = d; }
  40262. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40263. };
  40264. })();
  40265. var presence_channel_PresenceChannel = (function (_super) {
  40266. presence_channel_extends(PresenceChannel, _super);
  40267. function PresenceChannel(name, pusher) {
  40268. var _this = _super.call(this, name, pusher) || this;
  40269. _this.members = new members();
  40270. return _this;
  40271. }
  40272. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40273. var _this = this;
  40274. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40275. if (!error) {
  40276. if (authData.channel_data === undefined) {
  40277. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40278. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40279. ("expected 'channel_data' field. " + suffix));
  40280. callback("Invalid auth response");
  40281. return;
  40282. }
  40283. var channelData = JSON.parse(authData.channel_data);
  40284. _this.members.setMyID(channelData.user_id);
  40285. }
  40286. callback(error, authData);
  40287. });
  40288. };
  40289. PresenceChannel.prototype.handleEvent = function (event) {
  40290. var eventName = event.event;
  40291. if (eventName.indexOf("pusher_internal:") === 0) {
  40292. this.handleInternalEvent(event);
  40293. }
  40294. else {
  40295. var data = event.data;
  40296. var metadata = {};
  40297. if (event.user_id) {
  40298. metadata.user_id = event.user_id;
  40299. }
  40300. this.emit(eventName, data, metadata);
  40301. }
  40302. };
  40303. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40304. var eventName = event.event;
  40305. var data = event.data;
  40306. switch (eventName) {
  40307. case "pusher_internal:subscription_succeeded":
  40308. this.handleSubscriptionSucceededEvent(event);
  40309. break;
  40310. case "pusher_internal:member_added":
  40311. var addedMember = this.members.addMember(data);
  40312. this.emit('pusher:member_added', addedMember);
  40313. break;
  40314. case "pusher_internal:member_removed":
  40315. var removedMember = this.members.removeMember(data);
  40316. if (removedMember) {
  40317. this.emit('pusher:member_removed', removedMember);
  40318. }
  40319. break;
  40320. }
  40321. };
  40322. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40323. this.subscriptionPending = false;
  40324. this.subscribed = true;
  40325. if (this.subscriptionCancelled) {
  40326. this.pusher.unsubscribe(this.name);
  40327. }
  40328. else {
  40329. this.members.onSubscription(event.data);
  40330. this.emit("pusher:subscription_succeeded", this.members);
  40331. }
  40332. };
  40333. PresenceChannel.prototype.disconnect = function () {
  40334. this.members.reset();
  40335. _super.prototype.disconnect.call(this);
  40336. };
  40337. return PresenceChannel;
  40338. }(private_channel));
  40339. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40340. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40341. var nacl_fast = __webpack_require__(0);
  40342. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40343. var nacl_util = __webpack_require__(1);
  40344. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40345. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40346. var extendStatics = function (d, b) {
  40347. extendStatics = Object.setPrototypeOf ||
  40348. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40349. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40350. return extendStatics(d, b);
  40351. };
  40352. return function (d, b) {
  40353. extendStatics(d, b);
  40354. function __() { this.constructor = d; }
  40355. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40356. };
  40357. })();
  40358. var encrypted_channel_EncryptedChannel = (function (_super) {
  40359. encrypted_channel_extends(EncryptedChannel, _super);
  40360. function EncryptedChannel() {
  40361. var _this = _super !== null && _super.apply(this, arguments) || this;
  40362. _this.key = null;
  40363. return _this;
  40364. }
  40365. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40366. var _this = this;
  40367. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40368. if (error) {
  40369. callback(true, authData);
  40370. return;
  40371. }
  40372. var sharedSecret = authData["shared_secret"];
  40373. if (!sharedSecret) {
  40374. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40375. callback(true, errorMsg);
  40376. return;
  40377. }
  40378. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40379. delete authData["shared_secret"];
  40380. callback(false, authData);
  40381. });
  40382. };
  40383. EncryptedChannel.prototype.trigger = function (event, data) {
  40384. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40385. };
  40386. EncryptedChannel.prototype.handleEvent = function (event) {
  40387. var eventName = event.event;
  40388. var data = event.data;
  40389. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40390. _super.prototype.handleEvent.call(this, event);
  40391. return;
  40392. }
  40393. this.handleEncryptedEvent(eventName, data);
  40394. };
  40395. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40396. var _this = this;
  40397. if (!this.key) {
  40398. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40399. return;
  40400. }
  40401. if (!data.ciphertext || !data.nonce) {
  40402. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40403. return;
  40404. }
  40405. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40406. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40407. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40408. return;
  40409. }
  40410. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40411. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40412. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40413. return;
  40414. }
  40415. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40416. if (bytes === null) {
  40417. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40418. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40419. if (error) {
  40420. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40421. return;
  40422. }
  40423. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40424. if (bytes === null) {
  40425. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40426. return;
  40427. }
  40428. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40429. return;
  40430. });
  40431. return;
  40432. }
  40433. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40434. };
  40435. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40436. try {
  40437. this.emit(eventName, JSON.parse(data));
  40438. }
  40439. catch (e) {
  40440. this.emit(eventName, data);
  40441. }
  40442. return this;
  40443. };
  40444. return EncryptedChannel;
  40445. }(private_channel));
  40446. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40447. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40448. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40449. var extendStatics = function (d, b) {
  40450. extendStatics = Object.setPrototypeOf ||
  40451. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40452. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40453. return extendStatics(d, b);
  40454. };
  40455. return function (d, b) {
  40456. extendStatics(d, b);
  40457. function __() { this.constructor = d; }
  40458. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40459. };
  40460. })();
  40461. var connection_manager_ConnectionManager = (function (_super) {
  40462. connection_manager_extends(ConnectionManager, _super);
  40463. function ConnectionManager(key, options) {
  40464. var _this = _super.call(this) || this;
  40465. _this.key = key;
  40466. _this.options = options || {};
  40467. _this.state = "initialized";
  40468. _this.connection = null;
  40469. _this.usingTLS = !!options.useTLS;
  40470. _this.timeline = _this.options.timeline;
  40471. _this.errorCallbacks = _this.buildErrorCallbacks();
  40472. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40473. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40474. var Network = runtime.getNetwork();
  40475. Network.bind("online", function () {
  40476. _this.timeline.info({ netinfo: "online" });
  40477. if (_this.state === "connecting" || _this.state === "unavailable") {
  40478. _this.retryIn(0);
  40479. }
  40480. });
  40481. Network.bind("offline", function () {
  40482. _this.timeline.info({ netinfo: "offline" });
  40483. if (_this.connection) {
  40484. _this.sendActivityCheck();
  40485. }
  40486. });
  40487. _this.updateStrategy();
  40488. return _this;
  40489. }
  40490. ConnectionManager.prototype.connect = function () {
  40491. if (this.connection || this.runner) {
  40492. return;
  40493. }
  40494. if (!this.strategy.isSupported()) {
  40495. this.updateState("failed");
  40496. return;
  40497. }
  40498. this.updateState("connecting");
  40499. this.startConnecting();
  40500. this.setUnavailableTimer();
  40501. };
  40502. ;
  40503. ConnectionManager.prototype.send = function (data) {
  40504. if (this.connection) {
  40505. return this.connection.send(data);
  40506. }
  40507. else {
  40508. return false;
  40509. }
  40510. };
  40511. ;
  40512. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40513. if (this.connection) {
  40514. return this.connection.send_event(name, data, channel);
  40515. }
  40516. else {
  40517. return false;
  40518. }
  40519. };
  40520. ;
  40521. ConnectionManager.prototype.disconnect = function () {
  40522. this.disconnectInternally();
  40523. this.updateState("disconnected");
  40524. };
  40525. ;
  40526. ConnectionManager.prototype.isUsingTLS = function () {
  40527. return this.usingTLS;
  40528. };
  40529. ;
  40530. ConnectionManager.prototype.startConnecting = function () {
  40531. var _this = this;
  40532. var callback = function (error, handshake) {
  40533. if (error) {
  40534. _this.runner = _this.strategy.connect(0, callback);
  40535. }
  40536. else {
  40537. if (handshake.action === "error") {
  40538. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40539. _this.timeline.error({ handshakeError: handshake.error });
  40540. }
  40541. else {
  40542. _this.abortConnecting();
  40543. _this.handshakeCallbacks[handshake.action](handshake);
  40544. }
  40545. }
  40546. };
  40547. this.runner = this.strategy.connect(0, callback);
  40548. };
  40549. ;
  40550. ConnectionManager.prototype.abortConnecting = function () {
  40551. if (this.runner) {
  40552. this.runner.abort();
  40553. this.runner = null;
  40554. }
  40555. };
  40556. ;
  40557. ConnectionManager.prototype.disconnectInternally = function () {
  40558. this.abortConnecting();
  40559. this.clearRetryTimer();
  40560. this.clearUnavailableTimer();
  40561. if (this.connection) {
  40562. var connection = this.abandonConnection();
  40563. connection.close();
  40564. }
  40565. };
  40566. ;
  40567. ConnectionManager.prototype.updateStrategy = function () {
  40568. this.strategy = this.options.getStrategy({
  40569. key: this.key,
  40570. timeline: this.timeline,
  40571. useTLS: this.usingTLS
  40572. });
  40573. };
  40574. ;
  40575. ConnectionManager.prototype.retryIn = function (delay) {
  40576. var _this = this;
  40577. this.timeline.info({ action: "retry", delay: delay });
  40578. if (delay > 0) {
  40579. this.emit("connecting_in", Math.round(delay / 1000));
  40580. }
  40581. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40582. _this.disconnectInternally();
  40583. _this.connect();
  40584. });
  40585. };
  40586. ;
  40587. ConnectionManager.prototype.clearRetryTimer = function () {
  40588. if (this.retryTimer) {
  40589. this.retryTimer.ensureAborted();
  40590. this.retryTimer = null;
  40591. }
  40592. };
  40593. ;
  40594. ConnectionManager.prototype.setUnavailableTimer = function () {
  40595. var _this = this;
  40596. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40597. _this.updateState("unavailable");
  40598. });
  40599. };
  40600. ;
  40601. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40602. if (this.unavailableTimer) {
  40603. this.unavailableTimer.ensureAborted();
  40604. }
  40605. };
  40606. ;
  40607. ConnectionManager.prototype.sendActivityCheck = function () {
  40608. var _this = this;
  40609. this.stopActivityCheck();
  40610. this.connection.ping();
  40611. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40612. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40613. _this.retryIn(0);
  40614. });
  40615. };
  40616. ;
  40617. ConnectionManager.prototype.resetActivityCheck = function () {
  40618. var _this = this;
  40619. this.stopActivityCheck();
  40620. if (this.connection && !this.connection.handlesActivityChecks()) {
  40621. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40622. _this.sendActivityCheck();
  40623. });
  40624. }
  40625. };
  40626. ;
  40627. ConnectionManager.prototype.stopActivityCheck = function () {
  40628. if (this.activityTimer) {
  40629. this.activityTimer.ensureAborted();
  40630. }
  40631. };
  40632. ;
  40633. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40634. var _this = this;
  40635. return extend({}, errorCallbacks, {
  40636. message: function (message) {
  40637. _this.resetActivityCheck();
  40638. _this.emit('message', message);
  40639. },
  40640. ping: function () {
  40641. _this.send_event('pusher:pong', {});
  40642. },
  40643. activity: function () {
  40644. _this.resetActivityCheck();
  40645. },
  40646. error: function (error) {
  40647. _this.emit("error", { type: "WebSocketError", error: error });
  40648. },
  40649. closed: function () {
  40650. _this.abandonConnection();
  40651. if (_this.shouldRetry()) {
  40652. _this.retryIn(1000);
  40653. }
  40654. }
  40655. });
  40656. };
  40657. ;
  40658. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40659. var _this = this;
  40660. return extend({}, errorCallbacks, {
  40661. connected: function (handshake) {
  40662. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40663. _this.clearUnavailableTimer();
  40664. _this.setConnection(handshake.connection);
  40665. _this.socket_id = _this.connection.id;
  40666. _this.updateState("connected", { socket_id: _this.socket_id });
  40667. }
  40668. });
  40669. };
  40670. ;
  40671. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40672. var _this = this;
  40673. var withErrorEmitted = function (callback) {
  40674. return function (result) {
  40675. if (result.error) {
  40676. _this.emit("error", { type: "WebSocketError", error: result.error });
  40677. }
  40678. callback(result);
  40679. };
  40680. };
  40681. return {
  40682. tls_only: withErrorEmitted(function () {
  40683. _this.usingTLS = true;
  40684. _this.updateStrategy();
  40685. _this.retryIn(0);
  40686. }),
  40687. refused: withErrorEmitted(function () {
  40688. _this.disconnect();
  40689. }),
  40690. backoff: withErrorEmitted(function () {
  40691. _this.retryIn(1000);
  40692. }),
  40693. retry: withErrorEmitted(function () {
  40694. _this.retryIn(0);
  40695. })
  40696. };
  40697. };
  40698. ;
  40699. ConnectionManager.prototype.setConnection = function (connection) {
  40700. this.connection = connection;
  40701. for (var event in this.connectionCallbacks) {
  40702. this.connection.bind(event, this.connectionCallbacks[event]);
  40703. }
  40704. this.resetActivityCheck();
  40705. };
  40706. ;
  40707. ConnectionManager.prototype.abandonConnection = function () {
  40708. if (!this.connection) {
  40709. return;
  40710. }
  40711. this.stopActivityCheck();
  40712. for (var event in this.connectionCallbacks) {
  40713. this.connection.unbind(event, this.connectionCallbacks[event]);
  40714. }
  40715. var connection = this.connection;
  40716. this.connection = null;
  40717. return connection;
  40718. };
  40719. ConnectionManager.prototype.updateState = function (newState, data) {
  40720. var previousState = this.state;
  40721. this.state = newState;
  40722. if (previousState !== newState) {
  40723. var newStateDescription = newState;
  40724. if (newStateDescription === "connected") {
  40725. newStateDescription += " with new socket ID " + data.socket_id;
  40726. }
  40727. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  40728. this.timeline.info({ state: newState, params: data });
  40729. this.emit('state_change', { previous: previousState, current: newState });
  40730. this.emit(newState, data);
  40731. }
  40732. };
  40733. ConnectionManager.prototype.shouldRetry = function () {
  40734. return this.state === "connecting" || this.state === "connected";
  40735. };
  40736. return ConnectionManager;
  40737. }(dispatcher));
  40738. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  40739. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  40740. var channels_Channels = (function () {
  40741. function Channels() {
  40742. this.channels = {};
  40743. }
  40744. Channels.prototype.add = function (name, pusher) {
  40745. if (!this.channels[name]) {
  40746. this.channels[name] = createChannel(name, pusher);
  40747. }
  40748. return this.channels[name];
  40749. };
  40750. Channels.prototype.all = function () {
  40751. return values(this.channels);
  40752. };
  40753. Channels.prototype.find = function (name) {
  40754. return this.channels[name];
  40755. };
  40756. Channels.prototype.remove = function (name) {
  40757. var channel = this.channels[name];
  40758. delete this.channels[name];
  40759. return channel;
  40760. };
  40761. Channels.prototype.disconnect = function () {
  40762. objectApply(this.channels, function (channel) {
  40763. channel.disconnect();
  40764. });
  40765. };
  40766. return Channels;
  40767. }());
  40768. /* harmony default export */ var channels = (channels_Channels);
  40769. function createChannel(name, pusher) {
  40770. if (name.indexOf('private-encrypted-') === 0) {
  40771. if (false) { var errorMsg; }
  40772. return factory.createEncryptedChannel(name, pusher);
  40773. }
  40774. else if (name.indexOf('private-') === 0) {
  40775. return factory.createPrivateChannel(name, pusher);
  40776. }
  40777. else if (name.indexOf('presence-') === 0) {
  40778. return factory.createPresenceChannel(name, pusher);
  40779. }
  40780. else {
  40781. return factory.createChannel(name, pusher);
  40782. }
  40783. }
  40784. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  40785. var Factory = {
  40786. createChannels: function () {
  40787. return new channels();
  40788. },
  40789. createConnectionManager: function (key, options) {
  40790. return new connection_manager(key, options);
  40791. },
  40792. createChannel: function (name, pusher) {
  40793. return new channels_channel(name, pusher);
  40794. },
  40795. createPrivateChannel: function (name, pusher) {
  40796. return new private_channel(name, pusher);
  40797. },
  40798. createPresenceChannel: function (name, pusher) {
  40799. return new presence_channel(name, pusher);
  40800. },
  40801. createEncryptedChannel: function (name, pusher) {
  40802. return new encrypted_channel(name, pusher);
  40803. },
  40804. createTimelineSender: function (timeline, options) {
  40805. return new timeline_sender(timeline, options);
  40806. },
  40807. createAuthorizer: function (channel, options) {
  40808. if (options.authorizer) {
  40809. return options.authorizer(channel, options);
  40810. }
  40811. return new pusher_authorizer(channel, options);
  40812. },
  40813. createHandshake: function (transport, callback) {
  40814. return new connection_handshake(transport, callback);
  40815. },
  40816. createAssistantToTheTransportManager: function (manager, transport, options) {
  40817. return new assistant_to_the_transport_manager(manager, transport, options);
  40818. }
  40819. };
  40820. /* harmony default export */ var factory = (Factory);
  40821. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  40822. var transport_manager_TransportManager = (function () {
  40823. function TransportManager(options) {
  40824. this.options = options || {};
  40825. this.livesLeft = this.options.lives || Infinity;
  40826. }
  40827. TransportManager.prototype.getAssistant = function (transport) {
  40828. return factory.createAssistantToTheTransportManager(this, transport, {
  40829. minPingDelay: this.options.minPingDelay,
  40830. maxPingDelay: this.options.maxPingDelay
  40831. });
  40832. };
  40833. TransportManager.prototype.isAlive = function () {
  40834. return this.livesLeft > 0;
  40835. };
  40836. TransportManager.prototype.reportDeath = function () {
  40837. this.livesLeft -= 1;
  40838. };
  40839. return TransportManager;
  40840. }());
  40841. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  40842. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  40843. var sequential_strategy_SequentialStrategy = (function () {
  40844. function SequentialStrategy(strategies, options) {
  40845. this.strategies = strategies;
  40846. this.loop = Boolean(options.loop);
  40847. this.failFast = Boolean(options.failFast);
  40848. this.timeout = options.timeout;
  40849. this.timeoutLimit = options.timeoutLimit;
  40850. }
  40851. SequentialStrategy.prototype.isSupported = function () {
  40852. return any(this.strategies, util.method("isSupported"));
  40853. };
  40854. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  40855. var _this = this;
  40856. var strategies = this.strategies;
  40857. var current = 0;
  40858. var timeout = this.timeout;
  40859. var runner = null;
  40860. var tryNextStrategy = function (error, handshake) {
  40861. if (handshake) {
  40862. callback(null, handshake);
  40863. }
  40864. else {
  40865. current = current + 1;
  40866. if (_this.loop) {
  40867. current = current % strategies.length;
  40868. }
  40869. if (current < strategies.length) {
  40870. if (timeout) {
  40871. timeout = timeout * 2;
  40872. if (_this.timeoutLimit) {
  40873. timeout = Math.min(timeout, _this.timeoutLimit);
  40874. }
  40875. }
  40876. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  40877. }
  40878. else {
  40879. callback(true);
  40880. }
  40881. }
  40882. };
  40883. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  40884. return {
  40885. abort: function () {
  40886. runner.abort();
  40887. },
  40888. forceMinPriority: function (p) {
  40889. minPriority = p;
  40890. if (runner) {
  40891. runner.forceMinPriority(p);
  40892. }
  40893. }
  40894. };
  40895. };
  40896. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  40897. var timer = null;
  40898. var runner = null;
  40899. if (options.timeout > 0) {
  40900. timer = new OneOffTimer(options.timeout, function () {
  40901. runner.abort();
  40902. callback(true);
  40903. });
  40904. }
  40905. runner = strategy.connect(minPriority, function (error, handshake) {
  40906. if (error && timer && timer.isRunning() && !options.failFast) {
  40907. return;
  40908. }
  40909. if (timer) {
  40910. timer.ensureAborted();
  40911. }
  40912. callback(error, handshake);
  40913. });
  40914. return {
  40915. abort: function () {
  40916. if (timer) {
  40917. timer.ensureAborted();
  40918. }
  40919. runner.abort();
  40920. },
  40921. forceMinPriority: function (p) {
  40922. runner.forceMinPriority(p);
  40923. }
  40924. };
  40925. };
  40926. return SequentialStrategy;
  40927. }());
  40928. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  40929. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  40930. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  40931. function BestConnectedEverStrategy(strategies) {
  40932. this.strategies = strategies;
  40933. }
  40934. BestConnectedEverStrategy.prototype.isSupported = function () {
  40935. return any(this.strategies, util.method("isSupported"));
  40936. };
  40937. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  40938. return connect(this.strategies, minPriority, function (i, runners) {
  40939. return function (error, handshake) {
  40940. runners[i].error = error;
  40941. if (error) {
  40942. if (allRunnersFailed(runners)) {
  40943. callback(true);
  40944. }
  40945. return;
  40946. }
  40947. apply(runners, function (runner) {
  40948. runner.forceMinPriority(handshake.transport.priority);
  40949. });
  40950. callback(null, handshake);
  40951. };
  40952. });
  40953. };
  40954. return BestConnectedEverStrategy;
  40955. }());
  40956. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  40957. function connect(strategies, minPriority, callbackBuilder) {
  40958. var runners = map(strategies, function (strategy, i, _, rs) {
  40959. return strategy.connect(minPriority, callbackBuilder(i, rs));
  40960. });
  40961. return {
  40962. abort: function () {
  40963. apply(runners, abortRunner);
  40964. },
  40965. forceMinPriority: function (p) {
  40966. apply(runners, function (runner) {
  40967. runner.forceMinPriority(p);
  40968. });
  40969. }
  40970. };
  40971. }
  40972. function allRunnersFailed(runners) {
  40973. return collections_all(runners, function (runner) {
  40974. return Boolean(runner.error);
  40975. });
  40976. }
  40977. function abortRunner(runner) {
  40978. if (!runner.error && !runner.aborted) {
  40979. runner.abort();
  40980. runner.aborted = true;
  40981. }
  40982. }
  40983. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  40984. var cached_strategy_CachedStrategy = (function () {
  40985. function CachedStrategy(strategy, transports, options) {
  40986. this.strategy = strategy;
  40987. this.transports = transports;
  40988. this.ttl = options.ttl || 1800 * 1000;
  40989. this.usingTLS = options.useTLS;
  40990. this.timeline = options.timeline;
  40991. }
  40992. CachedStrategy.prototype.isSupported = function () {
  40993. return this.strategy.isSupported();
  40994. };
  40995. CachedStrategy.prototype.connect = function (minPriority, callback) {
  40996. var usingTLS = this.usingTLS;
  40997. var info = fetchTransportCache(usingTLS);
  40998. var strategies = [this.strategy];
  40999. if (info && info.timestamp + this.ttl >= util.now()) {
  41000. var transport = this.transports[info.transport];
  41001. if (transport) {
  41002. this.timeline.info({
  41003. cached: true,
  41004. transport: info.transport,
  41005. latency: info.latency
  41006. });
  41007. strategies.push(new sequential_strategy([transport], {
  41008. timeout: info.latency * 2 + 1000,
  41009. failFast: true
  41010. }));
  41011. }
  41012. }
  41013. var startTimestamp = util.now();
  41014. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41015. if (error) {
  41016. flushTransportCache(usingTLS);
  41017. if (strategies.length > 0) {
  41018. startTimestamp = util.now();
  41019. runner = strategies.pop().connect(minPriority, cb);
  41020. }
  41021. else {
  41022. callback(error);
  41023. }
  41024. }
  41025. else {
  41026. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41027. callback(null, handshake);
  41028. }
  41029. });
  41030. return {
  41031. abort: function () {
  41032. runner.abort();
  41033. },
  41034. forceMinPriority: function (p) {
  41035. minPriority = p;
  41036. if (runner) {
  41037. runner.forceMinPriority(p);
  41038. }
  41039. }
  41040. };
  41041. };
  41042. return CachedStrategy;
  41043. }());
  41044. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41045. function getTransportCacheKey(usingTLS) {
  41046. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41047. }
  41048. function fetchTransportCache(usingTLS) {
  41049. var storage = runtime.getLocalStorage();
  41050. if (storage) {
  41051. try {
  41052. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41053. if (serializedCache) {
  41054. return JSON.parse(serializedCache);
  41055. }
  41056. }
  41057. catch (e) {
  41058. flushTransportCache(usingTLS);
  41059. }
  41060. }
  41061. return null;
  41062. }
  41063. function storeTransportCache(usingTLS, transport, latency) {
  41064. var storage = runtime.getLocalStorage();
  41065. if (storage) {
  41066. try {
  41067. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41068. timestamp: util.now(),
  41069. transport: transport,
  41070. latency: latency
  41071. });
  41072. }
  41073. catch (e) {
  41074. }
  41075. }
  41076. }
  41077. function flushTransportCache(usingTLS) {
  41078. var storage = runtime.getLocalStorage();
  41079. if (storage) {
  41080. try {
  41081. delete storage[getTransportCacheKey(usingTLS)];
  41082. }
  41083. catch (e) {
  41084. }
  41085. }
  41086. }
  41087. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41088. var delayed_strategy_DelayedStrategy = (function () {
  41089. function DelayedStrategy(strategy, _a) {
  41090. var number = _a.delay;
  41091. this.strategy = strategy;
  41092. this.options = { delay: number };
  41093. }
  41094. DelayedStrategy.prototype.isSupported = function () {
  41095. return this.strategy.isSupported();
  41096. };
  41097. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41098. var strategy = this.strategy;
  41099. var runner;
  41100. var timer = new OneOffTimer(this.options.delay, function () {
  41101. runner = strategy.connect(minPriority, callback);
  41102. });
  41103. return {
  41104. abort: function () {
  41105. timer.ensureAborted();
  41106. if (runner) {
  41107. runner.abort();
  41108. }
  41109. },
  41110. forceMinPriority: function (p) {
  41111. minPriority = p;
  41112. if (runner) {
  41113. runner.forceMinPriority(p);
  41114. }
  41115. }
  41116. };
  41117. };
  41118. return DelayedStrategy;
  41119. }());
  41120. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41121. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41122. var IfStrategy = (function () {
  41123. function IfStrategy(test, trueBranch, falseBranch) {
  41124. this.test = test;
  41125. this.trueBranch = trueBranch;
  41126. this.falseBranch = falseBranch;
  41127. }
  41128. IfStrategy.prototype.isSupported = function () {
  41129. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41130. return branch.isSupported();
  41131. };
  41132. IfStrategy.prototype.connect = function (minPriority, callback) {
  41133. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41134. return branch.connect(minPriority, callback);
  41135. };
  41136. return IfStrategy;
  41137. }());
  41138. /* harmony default export */ var if_strategy = (IfStrategy);
  41139. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41140. var FirstConnectedStrategy = (function () {
  41141. function FirstConnectedStrategy(strategy) {
  41142. this.strategy = strategy;
  41143. }
  41144. FirstConnectedStrategy.prototype.isSupported = function () {
  41145. return this.strategy.isSupported();
  41146. };
  41147. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41148. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41149. if (handshake) {
  41150. runner.abort();
  41151. }
  41152. callback(error, handshake);
  41153. });
  41154. return runner;
  41155. };
  41156. return FirstConnectedStrategy;
  41157. }());
  41158. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41159. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41160. function testSupportsStrategy(strategy) {
  41161. return function () {
  41162. return strategy.isSupported();
  41163. };
  41164. }
  41165. var getDefaultStrategy = function (config, defineTransport) {
  41166. var definedTransports = {};
  41167. function defineTransportStrategy(name, type, priority, options, manager) {
  41168. var transport = defineTransport(config, name, type, priority, options, manager);
  41169. definedTransports[name] = transport;
  41170. return transport;
  41171. }
  41172. var ws_options = {
  41173. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41174. hostTLS: config.wsHost + ":" + config.wssPort,
  41175. httpPath: config.wsPath
  41176. };
  41177. var wss_options = extend({}, ws_options, {
  41178. useTLS: true
  41179. });
  41180. var sockjs_options = {
  41181. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41182. hostTLS: config.httpHost + ":" + config.httpsPort,
  41183. httpPath: config.httpPath
  41184. };
  41185. var timeouts = {
  41186. loop: true,
  41187. timeout: 15000,
  41188. timeoutLimit: 60000
  41189. };
  41190. var ws_manager = new transport_manager({
  41191. lives: 2,
  41192. minPingDelay: 10000,
  41193. maxPingDelay: config.activity_timeout
  41194. });
  41195. var streaming_manager = new transport_manager({
  41196. lives: 2,
  41197. minPingDelay: 10000,
  41198. maxPingDelay: config.activity_timeout
  41199. });
  41200. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41201. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41202. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41203. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41204. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41205. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41206. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41207. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41208. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41209. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41210. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41211. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41212. 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);
  41213. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41214. var wsStrategy;
  41215. if (config.useTLS) {
  41216. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41217. }
  41218. else {
  41219. wsStrategy = new best_connected_ever_strategy([
  41220. ws_loop,
  41221. new delayed_strategy(wss_loop, { delay: 2000 }),
  41222. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41223. ]);
  41224. }
  41225. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41226. ttl: 1800000,
  41227. timeline: config.timeline,
  41228. useTLS: config.useTLS
  41229. });
  41230. };
  41231. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41232. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41233. /* harmony default export */ var transport_connection_initializer = (function () {
  41234. var self = this;
  41235. self.timeline.info(self.buildTimelineMessage({
  41236. transport: self.name + (self.options.useTLS ? "s" : "")
  41237. }));
  41238. if (self.hooks.isInitialized()) {
  41239. self.changeState("initialized");
  41240. }
  41241. else if (self.hooks.file) {
  41242. self.changeState("initializing");
  41243. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41244. if (self.hooks.isInitialized()) {
  41245. self.changeState("initialized");
  41246. callback(true);
  41247. }
  41248. else {
  41249. if (error) {
  41250. self.onError(error);
  41251. }
  41252. self.onClose();
  41253. callback(false);
  41254. }
  41255. });
  41256. }
  41257. else {
  41258. self.onClose();
  41259. }
  41260. });
  41261. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41262. var http_xdomain_request_hooks = {
  41263. getRequest: function (socket) {
  41264. var xdr = new window.XDomainRequest();
  41265. xdr.ontimeout = function () {
  41266. socket.emit("error", new RequestTimedOut());
  41267. socket.close();
  41268. };
  41269. xdr.onerror = function (e) {
  41270. socket.emit("error", e);
  41271. socket.close();
  41272. };
  41273. xdr.onprogress = function () {
  41274. if (xdr.responseText && xdr.responseText.length > 0) {
  41275. socket.onChunk(200, xdr.responseText);
  41276. }
  41277. };
  41278. xdr.onload = function () {
  41279. if (xdr.responseText && xdr.responseText.length > 0) {
  41280. socket.onChunk(200, xdr.responseText);
  41281. }
  41282. socket.emit("finished", 200);
  41283. socket.close();
  41284. };
  41285. return xdr;
  41286. },
  41287. abortRequest: function (xdr) {
  41288. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41289. xdr.abort();
  41290. }
  41291. };
  41292. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41293. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41294. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41295. var extendStatics = function (d, b) {
  41296. extendStatics = Object.setPrototypeOf ||
  41297. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41298. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41299. return extendStatics(d, b);
  41300. };
  41301. return function (d, b) {
  41302. extendStatics(d, b);
  41303. function __() { this.constructor = d; }
  41304. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41305. };
  41306. })();
  41307. var MAX_BUFFER_LENGTH = 256 * 1024;
  41308. var http_request_HTTPRequest = (function (_super) {
  41309. http_request_extends(HTTPRequest, _super);
  41310. function HTTPRequest(hooks, method, url) {
  41311. var _this = _super.call(this) || this;
  41312. _this.hooks = hooks;
  41313. _this.method = method;
  41314. _this.url = url;
  41315. return _this;
  41316. }
  41317. HTTPRequest.prototype.start = function (payload) {
  41318. var _this = this;
  41319. this.position = 0;
  41320. this.xhr = this.hooks.getRequest(this);
  41321. this.unloader = function () {
  41322. _this.close();
  41323. };
  41324. runtime.addUnloadListener(this.unloader);
  41325. this.xhr.open(this.method, this.url, true);
  41326. if (this.xhr.setRequestHeader) {
  41327. this.xhr.setRequestHeader("Content-Type", "application/json");
  41328. }
  41329. this.xhr.send(payload);
  41330. };
  41331. HTTPRequest.prototype.close = function () {
  41332. if (this.unloader) {
  41333. runtime.removeUnloadListener(this.unloader);
  41334. this.unloader = null;
  41335. }
  41336. if (this.xhr) {
  41337. this.hooks.abortRequest(this.xhr);
  41338. this.xhr = null;
  41339. }
  41340. };
  41341. HTTPRequest.prototype.onChunk = function (status, data) {
  41342. while (true) {
  41343. var chunk = this.advanceBuffer(data);
  41344. if (chunk) {
  41345. this.emit("chunk", { status: status, data: chunk });
  41346. }
  41347. else {
  41348. break;
  41349. }
  41350. }
  41351. if (this.isBufferTooLong(data)) {
  41352. this.emit("buffer_too_long");
  41353. }
  41354. };
  41355. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41356. var unreadData = buffer.slice(this.position);
  41357. var endOfLinePosition = unreadData.indexOf("\n");
  41358. if (endOfLinePosition !== -1) {
  41359. this.position += endOfLinePosition + 1;
  41360. return unreadData.slice(0, endOfLinePosition);
  41361. }
  41362. else {
  41363. return null;
  41364. }
  41365. };
  41366. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41367. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41368. };
  41369. return HTTPRequest;
  41370. }(dispatcher));
  41371. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41372. // CONCATENATED MODULE: ./src/core/http/state.ts
  41373. var State;
  41374. (function (State) {
  41375. State[State["CONNECTING"] = 0] = "CONNECTING";
  41376. State[State["OPEN"] = 1] = "OPEN";
  41377. State[State["CLOSED"] = 3] = "CLOSED";
  41378. })(State || (State = {}));
  41379. /* harmony default export */ var state = (State);
  41380. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41381. var autoIncrement = 1;
  41382. var http_socket_HTTPSocket = (function () {
  41383. function HTTPSocket(hooks, url) {
  41384. this.hooks = hooks;
  41385. this.session = randomNumber(1000) + "/" + randomString(8);
  41386. this.location = getLocation(url);
  41387. this.readyState = state.CONNECTING;
  41388. this.openStream();
  41389. }
  41390. HTTPSocket.prototype.send = function (payload) {
  41391. return this.sendRaw(JSON.stringify([payload]));
  41392. };
  41393. HTTPSocket.prototype.ping = function () {
  41394. this.hooks.sendHeartbeat(this);
  41395. };
  41396. HTTPSocket.prototype.close = function (code, reason) {
  41397. this.onClose(code, reason, true);
  41398. };
  41399. HTTPSocket.prototype.sendRaw = function (payload) {
  41400. if (this.readyState === state.OPEN) {
  41401. try {
  41402. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41403. return true;
  41404. }
  41405. catch (e) {
  41406. return false;
  41407. }
  41408. }
  41409. else {
  41410. return false;
  41411. }
  41412. };
  41413. HTTPSocket.prototype.reconnect = function () {
  41414. this.closeStream();
  41415. this.openStream();
  41416. };
  41417. ;
  41418. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41419. this.closeStream();
  41420. this.readyState = state.CLOSED;
  41421. if (this.onclose) {
  41422. this.onclose({
  41423. code: code,
  41424. reason: reason,
  41425. wasClean: wasClean
  41426. });
  41427. }
  41428. };
  41429. HTTPSocket.prototype.onChunk = function (chunk) {
  41430. if (chunk.status !== 200) {
  41431. return;
  41432. }
  41433. if (this.readyState === state.OPEN) {
  41434. this.onActivity();
  41435. }
  41436. var payload;
  41437. var type = chunk.data.slice(0, 1);
  41438. switch (type) {
  41439. case 'o':
  41440. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41441. this.onOpen(payload);
  41442. break;
  41443. case 'a':
  41444. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41445. for (var i = 0; i < payload.length; i++) {
  41446. this.onEvent(payload[i]);
  41447. }
  41448. break;
  41449. case 'm':
  41450. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41451. this.onEvent(payload);
  41452. break;
  41453. case 'h':
  41454. this.hooks.onHeartbeat(this);
  41455. break;
  41456. case 'c':
  41457. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41458. this.onClose(payload[0], payload[1], true);
  41459. break;
  41460. }
  41461. };
  41462. HTTPSocket.prototype.onOpen = function (options) {
  41463. if (this.readyState === state.CONNECTING) {
  41464. if (options && options.hostname) {
  41465. this.location.base = replaceHost(this.location.base, options.hostname);
  41466. }
  41467. this.readyState = state.OPEN;
  41468. if (this.onopen) {
  41469. this.onopen();
  41470. }
  41471. }
  41472. else {
  41473. this.onClose(1006, "Server lost session", true);
  41474. }
  41475. };
  41476. HTTPSocket.prototype.onEvent = function (event) {
  41477. if (this.readyState === state.OPEN && this.onmessage) {
  41478. this.onmessage({ data: event });
  41479. }
  41480. };
  41481. HTTPSocket.prototype.onActivity = function () {
  41482. if (this.onactivity) {
  41483. this.onactivity();
  41484. }
  41485. };
  41486. HTTPSocket.prototype.onError = function (error) {
  41487. if (this.onerror) {
  41488. this.onerror(error);
  41489. }
  41490. };
  41491. HTTPSocket.prototype.openStream = function () {
  41492. var _this = this;
  41493. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41494. this.stream.bind("chunk", function (chunk) {
  41495. _this.onChunk(chunk);
  41496. });
  41497. this.stream.bind("finished", function (status) {
  41498. _this.hooks.onFinished(_this, status);
  41499. });
  41500. this.stream.bind("buffer_too_long", function () {
  41501. _this.reconnect();
  41502. });
  41503. try {
  41504. this.stream.start();
  41505. }
  41506. catch (error) {
  41507. util.defer(function () {
  41508. _this.onError(error);
  41509. _this.onClose(1006, "Could not start streaming", false);
  41510. });
  41511. }
  41512. };
  41513. HTTPSocket.prototype.closeStream = function () {
  41514. if (this.stream) {
  41515. this.stream.unbind_all();
  41516. this.stream.close();
  41517. this.stream = null;
  41518. }
  41519. };
  41520. return HTTPSocket;
  41521. }());
  41522. function getLocation(url) {
  41523. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41524. return {
  41525. base: parts[1],
  41526. queryString: parts[2]
  41527. };
  41528. }
  41529. function getSendURL(url, session) {
  41530. return url.base + "/" + session + "/xhr_send";
  41531. }
  41532. function getUniqueURL(url) {
  41533. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41534. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41535. }
  41536. function replaceHost(url, hostname) {
  41537. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41538. return urlParts[1] + hostname + urlParts[3];
  41539. }
  41540. function randomNumber(max) {
  41541. return Math.floor(Math.random() * max);
  41542. }
  41543. function randomString(length) {
  41544. var result = [];
  41545. for (var i = 0; i < length; i++) {
  41546. result.push(randomNumber(32).toString(32));
  41547. }
  41548. return result.join('');
  41549. }
  41550. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41551. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41552. var http_streaming_socket_hooks = {
  41553. getReceiveURL: function (url, session) {
  41554. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41555. },
  41556. onHeartbeat: function (socket) {
  41557. socket.sendRaw("[]");
  41558. },
  41559. sendHeartbeat: function (socket) {
  41560. socket.sendRaw("[]");
  41561. },
  41562. onFinished: function (socket, status) {
  41563. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41564. }
  41565. };
  41566. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41567. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41568. var http_polling_socket_hooks = {
  41569. getReceiveURL: function (url, session) {
  41570. return url.base + "/" + session + "/xhr" + url.queryString;
  41571. },
  41572. onHeartbeat: function () {
  41573. },
  41574. sendHeartbeat: function (socket) {
  41575. socket.sendRaw("[]");
  41576. },
  41577. onFinished: function (socket, status) {
  41578. if (status === 200) {
  41579. socket.reconnect();
  41580. }
  41581. else {
  41582. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41583. }
  41584. }
  41585. };
  41586. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41587. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41588. var http_xhr_request_hooks = {
  41589. getRequest: function (socket) {
  41590. var Constructor = runtime.getXHRAPI();
  41591. var xhr = new Constructor();
  41592. xhr.onreadystatechange = xhr.onprogress = function () {
  41593. switch (xhr.readyState) {
  41594. case 3:
  41595. if (xhr.responseText && xhr.responseText.length > 0) {
  41596. socket.onChunk(xhr.status, xhr.responseText);
  41597. }
  41598. break;
  41599. case 4:
  41600. if (xhr.responseText && xhr.responseText.length > 0) {
  41601. socket.onChunk(xhr.status, xhr.responseText);
  41602. }
  41603. socket.emit("finished", xhr.status);
  41604. socket.close();
  41605. break;
  41606. }
  41607. };
  41608. return xhr;
  41609. },
  41610. abortRequest: function (xhr) {
  41611. xhr.onreadystatechange = null;
  41612. xhr.abort();
  41613. }
  41614. };
  41615. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41616. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41617. var HTTP = {
  41618. createStreamingSocket: function (url) {
  41619. return this.createSocket(http_streaming_socket, url);
  41620. },
  41621. createPollingSocket: function (url) {
  41622. return this.createSocket(http_polling_socket, url);
  41623. },
  41624. createSocket: function (hooks, url) {
  41625. return new http_socket(hooks, url);
  41626. },
  41627. createXHR: function (method, url) {
  41628. return this.createRequest(http_xhr_request, method, url);
  41629. },
  41630. createRequest: function (hooks, method, url) {
  41631. return new http_request(hooks, method, url);
  41632. }
  41633. };
  41634. /* harmony default export */ var http_http = (HTTP);
  41635. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41636. http_http.createXDR = function (method, url) {
  41637. return this.createRequest(http_xdomain_request, method, url);
  41638. };
  41639. /* harmony default export */ var web_http_http = (http_http);
  41640. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41641. var Runtime = {
  41642. nextAuthCallbackID: 1,
  41643. auth_callbacks: {},
  41644. ScriptReceivers: ScriptReceivers,
  41645. DependenciesReceivers: DependenciesReceivers,
  41646. getDefaultStrategy: default_strategy,
  41647. Transports: transports_transports,
  41648. transportConnectionInitializer: transport_connection_initializer,
  41649. HTTPFactory: web_http_http,
  41650. TimelineTransport: jsonp_timeline,
  41651. getXHRAPI: function () {
  41652. return window.XMLHttpRequest;
  41653. },
  41654. getWebSocketAPI: function () {
  41655. return window.WebSocket || window.MozWebSocket;
  41656. },
  41657. setup: function (PusherClass) {
  41658. var _this = this;
  41659. window.Pusher = PusherClass;
  41660. var initializeOnDocumentBody = function () {
  41661. _this.onDocumentBody(PusherClass.ready);
  41662. };
  41663. if (!window.JSON) {
  41664. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41665. }
  41666. else {
  41667. initializeOnDocumentBody();
  41668. }
  41669. },
  41670. getDocument: function () {
  41671. return document;
  41672. },
  41673. getProtocol: function () {
  41674. return this.getDocument().location.protocol;
  41675. },
  41676. getAuthorizers: function () {
  41677. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41678. },
  41679. onDocumentBody: function (callback) {
  41680. var _this = this;
  41681. if (document.body) {
  41682. callback();
  41683. }
  41684. else {
  41685. setTimeout(function () {
  41686. _this.onDocumentBody(callback);
  41687. }, 0);
  41688. }
  41689. },
  41690. createJSONPRequest: function (url, data) {
  41691. return new jsonp_request(url, data);
  41692. },
  41693. createScriptRequest: function (src) {
  41694. return new script_request(src);
  41695. },
  41696. getLocalStorage: function () {
  41697. try {
  41698. return window.localStorage;
  41699. }
  41700. catch (e) {
  41701. return undefined;
  41702. }
  41703. },
  41704. createXHR: function () {
  41705. if (this.getXHRAPI()) {
  41706. return this.createXMLHttpRequest();
  41707. }
  41708. else {
  41709. return this.createMicrosoftXHR();
  41710. }
  41711. },
  41712. createXMLHttpRequest: function () {
  41713. var Constructor = this.getXHRAPI();
  41714. return new Constructor();
  41715. },
  41716. createMicrosoftXHR: function () {
  41717. return new ActiveXObject("Microsoft.XMLHTTP");
  41718. },
  41719. getNetwork: function () {
  41720. return net_info_Network;
  41721. },
  41722. createWebSocket: function (url) {
  41723. var Constructor = this.getWebSocketAPI();
  41724. return new Constructor(url);
  41725. },
  41726. createSocketRequest: function (method, url) {
  41727. if (this.isXHRSupported()) {
  41728. return this.HTTPFactory.createXHR(method, url);
  41729. }
  41730. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  41731. return this.HTTPFactory.createXDR(method, url);
  41732. }
  41733. else {
  41734. throw "Cross-origin HTTP requests are not supported";
  41735. }
  41736. },
  41737. isXHRSupported: function () {
  41738. var Constructor = this.getXHRAPI();
  41739. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  41740. },
  41741. isXDRSupported: function (useTLS) {
  41742. var protocol = useTLS ? "https:" : "http:";
  41743. var documentProtocol = this.getProtocol();
  41744. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  41745. },
  41746. addUnloadListener: function (listener) {
  41747. if (window.addEventListener !== undefined) {
  41748. window.addEventListener("unload", listener, false);
  41749. }
  41750. else if (window.attachEvent !== undefined) {
  41751. window.attachEvent("onunload", listener);
  41752. }
  41753. },
  41754. removeUnloadListener: function (listener) {
  41755. if (window.addEventListener !== undefined) {
  41756. window.removeEventListener("unload", listener, false);
  41757. }
  41758. else if (window.detachEvent !== undefined) {
  41759. window.detachEvent("onunload", listener);
  41760. }
  41761. }
  41762. };
  41763. /* harmony default export */ var runtime = (Runtime);
  41764. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  41765. var TimelineLevel;
  41766. (function (TimelineLevel) {
  41767. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  41768. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  41769. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  41770. })(TimelineLevel || (TimelineLevel = {}));
  41771. /* harmony default export */ var timeline_level = (TimelineLevel);
  41772. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  41773. var timeline_Timeline = (function () {
  41774. function Timeline(key, session, options) {
  41775. this.key = key;
  41776. this.session = session;
  41777. this.events = [];
  41778. this.options = options || {};
  41779. this.sent = 0;
  41780. this.uniqueID = 0;
  41781. }
  41782. Timeline.prototype.log = function (level, event) {
  41783. if (level <= this.options.level) {
  41784. this.events.push(extend({}, event, { timestamp: util.now() }));
  41785. if (this.options.limit && this.events.length > this.options.limit) {
  41786. this.events.shift();
  41787. }
  41788. }
  41789. };
  41790. Timeline.prototype.error = function (event) {
  41791. this.log(timeline_level.ERROR, event);
  41792. };
  41793. Timeline.prototype.info = function (event) {
  41794. this.log(timeline_level.INFO, event);
  41795. };
  41796. Timeline.prototype.debug = function (event) {
  41797. this.log(timeline_level.DEBUG, event);
  41798. };
  41799. Timeline.prototype.isEmpty = function () {
  41800. return this.events.length === 0;
  41801. };
  41802. Timeline.prototype.send = function (sendfn, callback) {
  41803. var _this = this;
  41804. var data = extend({
  41805. session: this.session,
  41806. bundle: this.sent + 1,
  41807. key: this.key,
  41808. lib: "js",
  41809. version: this.options.version,
  41810. cluster: this.options.cluster,
  41811. features: this.options.features,
  41812. timeline: this.events
  41813. }, this.options.params);
  41814. this.events = [];
  41815. sendfn(data, function (error, result) {
  41816. if (!error) {
  41817. _this.sent++;
  41818. }
  41819. if (callback) {
  41820. callback(error, result);
  41821. }
  41822. });
  41823. return true;
  41824. };
  41825. Timeline.prototype.generateUniqueID = function () {
  41826. this.uniqueID++;
  41827. return this.uniqueID;
  41828. };
  41829. return Timeline;
  41830. }());
  41831. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  41832. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  41833. var transport_strategy_TransportStrategy = (function () {
  41834. function TransportStrategy(name, priority, transport, options) {
  41835. this.name = name;
  41836. this.priority = priority;
  41837. this.transport = transport;
  41838. this.options = options || {};
  41839. }
  41840. TransportStrategy.prototype.isSupported = function () {
  41841. return this.transport.isSupported({
  41842. useTLS: this.options.useTLS
  41843. });
  41844. };
  41845. TransportStrategy.prototype.connect = function (minPriority, callback) {
  41846. var _this = this;
  41847. if (!this.isSupported()) {
  41848. return failAttempt(new UnsupportedStrategy(), callback);
  41849. }
  41850. else if (this.priority < minPriority) {
  41851. return failAttempt(new TransportPriorityTooLow(), callback);
  41852. }
  41853. var connected = false;
  41854. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  41855. var handshake = null;
  41856. var onInitialized = function () {
  41857. transport.unbind("initialized", onInitialized);
  41858. transport.connect();
  41859. };
  41860. var onOpen = function () {
  41861. handshake = factory.createHandshake(transport, function (result) {
  41862. connected = true;
  41863. unbindListeners();
  41864. callback(null, result);
  41865. });
  41866. };
  41867. var onError = function (error) {
  41868. unbindListeners();
  41869. callback(error);
  41870. };
  41871. var onClosed = function () {
  41872. unbindListeners();
  41873. var serializedTransport;
  41874. serializedTransport = safeJSONStringify(transport);
  41875. callback(new TransportClosed(serializedTransport));
  41876. };
  41877. var unbindListeners = function () {
  41878. transport.unbind("initialized", onInitialized);
  41879. transport.unbind("open", onOpen);
  41880. transport.unbind("error", onError);
  41881. transport.unbind("closed", onClosed);
  41882. };
  41883. transport.bind("initialized", onInitialized);
  41884. transport.bind("open", onOpen);
  41885. transport.bind("error", onError);
  41886. transport.bind("closed", onClosed);
  41887. transport.initialize();
  41888. return {
  41889. abort: function () {
  41890. if (connected) {
  41891. return;
  41892. }
  41893. unbindListeners();
  41894. if (handshake) {
  41895. handshake.close();
  41896. }
  41897. else {
  41898. transport.close();
  41899. }
  41900. },
  41901. forceMinPriority: function (p) {
  41902. if (connected) {
  41903. return;
  41904. }
  41905. if (_this.priority < p) {
  41906. if (handshake) {
  41907. handshake.close();
  41908. }
  41909. else {
  41910. transport.close();
  41911. }
  41912. }
  41913. }
  41914. };
  41915. };
  41916. return TransportStrategy;
  41917. }());
  41918. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  41919. function failAttempt(error, callback) {
  41920. util.defer(function () {
  41921. callback(error);
  41922. });
  41923. return {
  41924. abort: function () { },
  41925. forceMinPriority: function () { }
  41926. };
  41927. }
  41928. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  41929. var strategy_builder_Transports = runtime.Transports;
  41930. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  41931. var transportClass = strategy_builder_Transports[type];
  41932. if (!transportClass) {
  41933. throw new UnsupportedTransport(type);
  41934. }
  41935. var enabled = (!config.enabledTransports ||
  41936. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  41937. (!config.disabledTransports ||
  41938. arrayIndexOf(config.disabledTransports, name) === -1);
  41939. var transport;
  41940. if (enabled) {
  41941. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  41942. key: config.key,
  41943. useTLS: config.useTLS,
  41944. timeline: config.timeline,
  41945. ignoreNullOrigin: config.ignoreNullOrigin
  41946. }, options));
  41947. }
  41948. else {
  41949. transport = strategy_builder_UnsupportedStrategy;
  41950. }
  41951. return transport;
  41952. };
  41953. var strategy_builder_UnsupportedStrategy = {
  41954. isSupported: function () {
  41955. return false;
  41956. },
  41957. connect: function (_, callback) {
  41958. var deferred = util.defer(function () {
  41959. callback(new UnsupportedStrategy());
  41960. });
  41961. return {
  41962. abort: function () {
  41963. deferred.ensureAborted();
  41964. },
  41965. forceMinPriority: function () { }
  41966. };
  41967. }
  41968. };
  41969. // CONCATENATED MODULE: ./src/core/config.ts
  41970. var getGlobalConfig = function () {
  41971. return {
  41972. wsHost: defaults.host,
  41973. wsPort: defaults.ws_port,
  41974. wssPort: defaults.wss_port,
  41975. wsPath: defaults.ws_path,
  41976. httpHost: defaults.sockjs_host,
  41977. httpPort: defaults.sockjs_http_port,
  41978. httpsPort: defaults.sockjs_https_port,
  41979. httpPath: defaults.sockjs_path,
  41980. statsHost: defaults.stats_host,
  41981. authEndpoint: defaults.channel_auth_endpoint,
  41982. authTransport: defaults.channel_auth_transport,
  41983. activity_timeout: defaults.activity_timeout,
  41984. pong_timeout: defaults.pong_timeout,
  41985. unavailable_timeout: defaults.unavailable_timeout
  41986. };
  41987. };
  41988. var getClusterConfig = function (clusterName) {
  41989. return {
  41990. wsHost: 'ws-' + clusterName + '.pusher.com',
  41991. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  41992. };
  41993. };
  41994. // CONCATENATED MODULE: ./src/core/pusher.ts
  41995. var pusher_Pusher = (function () {
  41996. function Pusher(app_key, options) {
  41997. var _this = this;
  41998. checkAppKey(app_key);
  41999. options = options || {};
  42000. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42001. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42002. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42003. }
  42004. this.key = app_key;
  42005. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42006. this.channels = factory.createChannels();
  42007. this.global_emitter = new dispatcher();
  42008. this.sessionID = Math.floor(Math.random() * 1000000000);
  42009. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42010. cluster: this.config.cluster,
  42011. features: Pusher.getClientFeatures(),
  42012. params: this.config.timelineParams || {},
  42013. limit: 50,
  42014. level: timeline_level.INFO,
  42015. version: defaults.VERSION
  42016. });
  42017. if (!this.config.disableStats) {
  42018. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42019. host: this.config.statsHost,
  42020. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42021. });
  42022. }
  42023. var getStrategy = function (options) {
  42024. var config = extend({}, _this.config, options);
  42025. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42026. };
  42027. this.connection = factory.createConnectionManager(this.key, extend({
  42028. getStrategy: getStrategy,
  42029. timeline: this.timeline,
  42030. activityTimeout: this.config.activity_timeout,
  42031. pongTimeout: this.config.pong_timeout,
  42032. unavailableTimeout: this.config.unavailable_timeout
  42033. }, this.config, { useTLS: this.shouldUseTLS() }));
  42034. this.connection.bind('connected', function () {
  42035. _this.subscribeAll();
  42036. if (_this.timelineSender) {
  42037. _this.timelineSender.send(_this.connection.isUsingTLS());
  42038. }
  42039. });
  42040. this.connection.bind('message', function (event) {
  42041. var eventName = event.event;
  42042. var internal = eventName.indexOf('pusher_internal:') === 0;
  42043. if (event.channel) {
  42044. var channel = _this.channel(event.channel);
  42045. if (channel) {
  42046. channel.handleEvent(event);
  42047. }
  42048. }
  42049. if (!internal) {
  42050. _this.global_emitter.emit(event.event, event.data);
  42051. }
  42052. });
  42053. this.connection.bind('connecting', function () {
  42054. _this.channels.disconnect();
  42055. });
  42056. this.connection.bind('disconnected', function () {
  42057. _this.channels.disconnect();
  42058. });
  42059. this.connection.bind('error', function (err) {
  42060. logger.warn(err);
  42061. });
  42062. Pusher.instances.push(this);
  42063. this.timeline.info({ instances: Pusher.instances.length });
  42064. if (Pusher.isReady) {
  42065. this.connect();
  42066. }
  42067. }
  42068. Pusher.ready = function () {
  42069. Pusher.isReady = true;
  42070. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42071. Pusher.instances[i].connect();
  42072. }
  42073. };
  42074. Pusher.getClientFeatures = function () {
  42075. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42076. return t.isSupported({});
  42077. }));
  42078. };
  42079. Pusher.prototype.channel = function (name) {
  42080. return this.channels.find(name);
  42081. };
  42082. Pusher.prototype.allChannels = function () {
  42083. return this.channels.all();
  42084. };
  42085. Pusher.prototype.connect = function () {
  42086. this.connection.connect();
  42087. if (this.timelineSender) {
  42088. if (!this.timelineSenderTimer) {
  42089. var usingTLS = this.connection.isUsingTLS();
  42090. var timelineSender = this.timelineSender;
  42091. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42092. timelineSender.send(usingTLS);
  42093. });
  42094. }
  42095. }
  42096. };
  42097. Pusher.prototype.disconnect = function () {
  42098. this.connection.disconnect();
  42099. if (this.timelineSenderTimer) {
  42100. this.timelineSenderTimer.ensureAborted();
  42101. this.timelineSenderTimer = null;
  42102. }
  42103. };
  42104. Pusher.prototype.bind = function (event_name, callback, context) {
  42105. this.global_emitter.bind(event_name, callback, context);
  42106. return this;
  42107. };
  42108. Pusher.prototype.unbind = function (event_name, callback, context) {
  42109. this.global_emitter.unbind(event_name, callback, context);
  42110. return this;
  42111. };
  42112. Pusher.prototype.bind_global = function (callback) {
  42113. this.global_emitter.bind_global(callback);
  42114. return this;
  42115. };
  42116. Pusher.prototype.unbind_global = function (callback) {
  42117. this.global_emitter.unbind_global(callback);
  42118. return this;
  42119. };
  42120. Pusher.prototype.unbind_all = function (callback) {
  42121. this.global_emitter.unbind_all();
  42122. return this;
  42123. };
  42124. Pusher.prototype.subscribeAll = function () {
  42125. var channelName;
  42126. for (channelName in this.channels.channels) {
  42127. if (this.channels.channels.hasOwnProperty(channelName)) {
  42128. this.subscribe(channelName);
  42129. }
  42130. }
  42131. };
  42132. Pusher.prototype.subscribe = function (channel_name) {
  42133. var channel = this.channels.add(channel_name, this);
  42134. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42135. channel.reinstateSubscription();
  42136. }
  42137. else if (!channel.subscriptionPending &&
  42138. this.connection.state === 'connected') {
  42139. channel.subscribe();
  42140. }
  42141. return channel;
  42142. };
  42143. Pusher.prototype.unsubscribe = function (channel_name) {
  42144. var channel = this.channels.find(channel_name);
  42145. if (channel && channel.subscriptionPending) {
  42146. channel.cancelSubscription();
  42147. }
  42148. else {
  42149. channel = this.channels.remove(channel_name);
  42150. if (channel && this.connection.state === 'connected') {
  42151. channel.unsubscribe();
  42152. }
  42153. }
  42154. };
  42155. Pusher.prototype.send_event = function (event_name, data, channel) {
  42156. return this.connection.send_event(event_name, data, channel);
  42157. };
  42158. Pusher.prototype.shouldUseTLS = function () {
  42159. if (runtime.getProtocol() === 'https:') {
  42160. return true;
  42161. }
  42162. else if (this.config.forceTLS === true) {
  42163. return true;
  42164. }
  42165. else {
  42166. return Boolean(this.config.encrypted);
  42167. }
  42168. };
  42169. Pusher.instances = [];
  42170. Pusher.isReady = false;
  42171. Pusher.logToConsole = false;
  42172. Pusher.Runtime = runtime;
  42173. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42174. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42175. Pusher.auth_callbacks = runtime.auth_callbacks;
  42176. return Pusher;
  42177. }());
  42178. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42179. function checkAppKey(key) {
  42180. if (key === null || key === undefined) {
  42181. throw 'You must pass your app key when you instantiate Pusher.';
  42182. }
  42183. }
  42184. runtime.setup(pusher_Pusher);
  42185. /***/ })
  42186. /******/ ]);
  42187. });
  42188. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42189. /***/ }),
  42190. /***/ "./node_modules/setimmediate/setImmediate.js":
  42191. /*!***************************************************!*\
  42192. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42193. \***************************************************/
  42194. /*! no static exports found */
  42195. /***/ (function(module, exports, __webpack_require__) {
  42196. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42197. "use strict";
  42198. if (global.setImmediate) {
  42199. return;
  42200. }
  42201. var nextHandle = 1; // Spec says greater than zero
  42202. var tasksByHandle = {};
  42203. var currentlyRunningATask = false;
  42204. var doc = global.document;
  42205. var registerImmediate;
  42206. function setImmediate(callback) {
  42207. // Callback can either be a function or a string
  42208. if (typeof callback !== "function") {
  42209. callback = new Function("" + callback);
  42210. }
  42211. // Copy function arguments
  42212. var args = new Array(arguments.length - 1);
  42213. for (var i = 0; i < args.length; i++) {
  42214. args[i] = arguments[i + 1];
  42215. }
  42216. // Store and register the task
  42217. var task = { callback: callback, args: args };
  42218. tasksByHandle[nextHandle] = task;
  42219. registerImmediate(nextHandle);
  42220. return nextHandle++;
  42221. }
  42222. function clearImmediate(handle) {
  42223. delete tasksByHandle[handle];
  42224. }
  42225. function run(task) {
  42226. var callback = task.callback;
  42227. var args = task.args;
  42228. switch (args.length) {
  42229. case 0:
  42230. callback();
  42231. break;
  42232. case 1:
  42233. callback(args[0]);
  42234. break;
  42235. case 2:
  42236. callback(args[0], args[1]);
  42237. break;
  42238. case 3:
  42239. callback(args[0], args[1], args[2]);
  42240. break;
  42241. default:
  42242. callback.apply(undefined, args);
  42243. break;
  42244. }
  42245. }
  42246. function runIfPresent(handle) {
  42247. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42248. // So if we're currently running a task, we'll need to delay this invocation.
  42249. if (currentlyRunningATask) {
  42250. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42251. // "too much recursion" error.
  42252. setTimeout(runIfPresent, 0, handle);
  42253. } else {
  42254. var task = tasksByHandle[handle];
  42255. if (task) {
  42256. currentlyRunningATask = true;
  42257. try {
  42258. run(task);
  42259. } finally {
  42260. clearImmediate(handle);
  42261. currentlyRunningATask = false;
  42262. }
  42263. }
  42264. }
  42265. }
  42266. function installNextTickImplementation() {
  42267. registerImmediate = function(handle) {
  42268. process.nextTick(function () { runIfPresent(handle); });
  42269. };
  42270. }
  42271. function canUsePostMessage() {
  42272. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42273. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42274. if (global.postMessage && !global.importScripts) {
  42275. var postMessageIsAsynchronous = true;
  42276. var oldOnMessage = global.onmessage;
  42277. global.onmessage = function() {
  42278. postMessageIsAsynchronous = false;
  42279. };
  42280. global.postMessage("", "*");
  42281. global.onmessage = oldOnMessage;
  42282. return postMessageIsAsynchronous;
  42283. }
  42284. }
  42285. function installPostMessageImplementation() {
  42286. // Installs an event handler on `global` for the `message` event: see
  42287. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42288. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42289. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42290. var onGlobalMessage = function(event) {
  42291. if (event.source === global &&
  42292. typeof event.data === "string" &&
  42293. event.data.indexOf(messagePrefix) === 0) {
  42294. runIfPresent(+event.data.slice(messagePrefix.length));
  42295. }
  42296. };
  42297. if (global.addEventListener) {
  42298. global.addEventListener("message", onGlobalMessage, false);
  42299. } else {
  42300. global.attachEvent("onmessage", onGlobalMessage);
  42301. }
  42302. registerImmediate = function(handle) {
  42303. global.postMessage(messagePrefix + handle, "*");
  42304. };
  42305. }
  42306. function installMessageChannelImplementation() {
  42307. var channel = new MessageChannel();
  42308. channel.port1.onmessage = function(event) {
  42309. var handle = event.data;
  42310. runIfPresent(handle);
  42311. };
  42312. registerImmediate = function(handle) {
  42313. channel.port2.postMessage(handle);
  42314. };
  42315. }
  42316. function installReadyStateChangeImplementation() {
  42317. var html = doc.documentElement;
  42318. registerImmediate = function(handle) {
  42319. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42320. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42321. var script = doc.createElement("script");
  42322. script.onreadystatechange = function () {
  42323. runIfPresent(handle);
  42324. script.onreadystatechange = null;
  42325. html.removeChild(script);
  42326. script = null;
  42327. };
  42328. html.appendChild(script);
  42329. };
  42330. }
  42331. function installSetTimeoutImplementation() {
  42332. registerImmediate = function(handle) {
  42333. setTimeout(runIfPresent, 0, handle);
  42334. };
  42335. }
  42336. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42337. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42338. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42339. // Don't get fooled by e.g. browserify environments.
  42340. if ({}.toString.call(global.process) === "[object process]") {
  42341. // For Node.js before 0.9
  42342. installNextTickImplementation();
  42343. } else if (canUsePostMessage()) {
  42344. // For non-IE10 modern browsers
  42345. installPostMessageImplementation();
  42346. } else if (global.MessageChannel) {
  42347. // For web workers, where supported
  42348. installMessageChannelImplementation();
  42349. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42350. // For IE 6–8
  42351. installReadyStateChangeImplementation();
  42352. } else {
  42353. // For older browsers
  42354. installSetTimeoutImplementation();
  42355. }
  42356. attachTo.setImmediate = setImmediate;
  42357. attachTo.clearImmediate = clearImmediate;
  42358. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42359. /* 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")))
  42360. /***/ }),
  42361. /***/ "./node_modules/timers-browserify/main.js":
  42362. /*!************************************************!*\
  42363. !*** ./node_modules/timers-browserify/main.js ***!
  42364. \************************************************/
  42365. /*! no static exports found */
  42366. /***/ (function(module, exports, __webpack_require__) {
  42367. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42368. (typeof self !== "undefined" && self) ||
  42369. window;
  42370. var apply = Function.prototype.apply;
  42371. // DOM APIs, for completeness
  42372. exports.setTimeout = function() {
  42373. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42374. };
  42375. exports.setInterval = function() {
  42376. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42377. };
  42378. exports.clearTimeout =
  42379. exports.clearInterval = function(timeout) {
  42380. if (timeout) {
  42381. timeout.close();
  42382. }
  42383. };
  42384. function Timeout(id, clearFn) {
  42385. this._id = id;
  42386. this._clearFn = clearFn;
  42387. }
  42388. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42389. Timeout.prototype.close = function() {
  42390. this._clearFn.call(scope, this._id);
  42391. };
  42392. // Does not start the time, just sets up the members needed.
  42393. exports.enroll = function(item, msecs) {
  42394. clearTimeout(item._idleTimeoutId);
  42395. item._idleTimeout = msecs;
  42396. };
  42397. exports.unenroll = function(item) {
  42398. clearTimeout(item._idleTimeoutId);
  42399. item._idleTimeout = -1;
  42400. };
  42401. exports._unrefActive = exports.active = function(item) {
  42402. clearTimeout(item._idleTimeoutId);
  42403. var msecs = item._idleTimeout;
  42404. if (msecs >= 0) {
  42405. item._idleTimeoutId = setTimeout(function onTimeout() {
  42406. if (item._onTimeout)
  42407. item._onTimeout();
  42408. }, msecs);
  42409. }
  42410. };
  42411. // setimmediate attaches itself to the global object
  42412. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42413. // On some exotic environments, it's not clear which object `setimmediate` was
  42414. // able to install onto. Search each possibility in the same order as the
  42415. // `setimmediate` library.
  42416. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42417. (typeof global !== "undefined" && global.setImmediate) ||
  42418. (this && this.setImmediate);
  42419. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42420. (typeof global !== "undefined" && global.clearImmediate) ||
  42421. (this && this.clearImmediate);
  42422. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42423. /***/ }),
  42424. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  42425. /*!*******************************************************************************************************************************************************************************************************************!*\
  42426. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  42427. \*******************************************************************************************************************************************************************************************************************/
  42428. /*! exports provided: render, staticRenderFns */
  42429. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42430. "use strict";
  42431. __webpack_require__.r(__webpack_exports__);
  42432. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42433. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42434. var render = function() {
  42435. var _vm = this
  42436. var _h = _vm.$createElement
  42437. var _c = _vm._self._c || _h
  42438. return _vm._m(0)
  42439. }
  42440. var staticRenderFns = [
  42441. function() {
  42442. var _vm = this
  42443. var _h = _vm.$createElement
  42444. var _c = _vm._self._c || _h
  42445. return _c("div", { staticClass: "container" }, [
  42446. _c("div", { staticClass: "row justify-content-center" }, [
  42447. _c("div", { staticClass: "col-md-8" }, [
  42448. _c("div", { staticClass: "card" }, [
  42449. _c("div", { staticClass: "card-header" }, [
  42450. _vm._v("Example Component")
  42451. ]),
  42452. _vm._v(" "),
  42453. _c("div", { staticClass: "card-body" }, [
  42454. _vm._v(
  42455. "\n I'm an example component.\n "
  42456. )
  42457. ])
  42458. ])
  42459. ])
  42460. ])
  42461. ])
  42462. }
  42463. ]
  42464. render._withStripped = true
  42465. /***/ }),
  42466. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  42467. /*!************************************************************************************************************************************************************************************************************!*\
  42468. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  42469. \************************************************************************************************************************************************************************************************************/
  42470. /*! exports provided: render, staticRenderFns */
  42471. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42472. "use strict";
  42473. __webpack_require__.r(__webpack_exports__);
  42474. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42475. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42476. var render = function() {
  42477. var _vm = this
  42478. var _h = _vm.$createElement
  42479. var _c = _vm._self._c || _h
  42480. return _c("div", [
  42481. _c("h4", { staticClass: "text-center" }, [
  42482. _vm._v(_vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "),
  42483. _c("small", { staticClass: "text-muted" }, [
  42484. _vm._v(_vm._s(this.data.pcnickname))
  42485. ])
  42486. ]),
  42487. _vm._v(" "),
  42488. _c("p", [_vm._v("S/N: " + _vm._s(this.data.pcserial))]),
  42489. _vm._v(" "),
  42490. _c("p", [_vm._v("CPU: " + _vm._s(this.data.pcproc))]),
  42491. _vm._v(" "),
  42492. _c("p", [_vm._v("RAM: " + _vm._s(this.data.pcram))]),
  42493. _vm._v(" "),
  42494. _c("p", [_vm._v("OS: " + _vm._s(this.data.pcos))])
  42495. ])
  42496. }
  42497. var staticRenderFns = []
  42498. render._withStripped = true
  42499. /***/ }),
  42500. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  42501. /*!*************************************************************************************************************************************************************************************************************!*\
  42502. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  42503. \*************************************************************************************************************************************************************************************************************/
  42504. /*! exports provided: render, staticRenderFns */
  42505. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42506. "use strict";
  42507. __webpack_require__.r(__webpack_exports__);
  42508. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42509. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42510. var render = function() {
  42511. var _vm = this
  42512. var _h = _vm.$createElement
  42513. var _c = _vm._self._c || _h
  42514. return _c(
  42515. "div",
  42516. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  42517. [
  42518. _c("div", { staticClass: "row no-gutters" }, [
  42519. _c("div", { staticClass: "h5 col-3 text-left" }, [
  42520. _vm._v(_vm._s(this.data.creddesc))
  42521. ]),
  42522. _vm._v(" "),
  42523. _c("div", { staticClass: "col-9 text-right" }, [
  42524. _vm._v(_vm._s(this.data.creddate))
  42525. ])
  42526. ]),
  42527. _vm._v(" "),
  42528. _c("div", { staticClass: "row" }, [
  42529. _c("div", { staticClass: "col-lg-9" }, [
  42530. _c("div", [
  42531. _vm._m(0),
  42532. _vm._v(" "),
  42533. _c("input", {
  42534. staticClass: "border-0 credential",
  42535. attrs: {
  42536. type: "text",
  42537. id: "username" + this.data.credid,
  42538. readonly: ""
  42539. },
  42540. domProps: { value: this.data.creduser }
  42541. }),
  42542. _vm._v(" "),
  42543. _c(
  42544. "button",
  42545. {
  42546. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  42547. attrs: {
  42548. id: "btn-username" + this.data.credid,
  42549. "data-clipboard-target": "#username" + this.data.credid
  42550. }
  42551. },
  42552. [_c("i", { staticClass: "far fa-clone" })]
  42553. )
  42554. ]),
  42555. _vm._v(" "),
  42556. _c("div", [
  42557. _vm._m(1),
  42558. _vm._v(" "),
  42559. _c("input", {
  42560. staticClass: "border-0 credential",
  42561. attrs: {
  42562. type: "text",
  42563. id: "password" + this.data.credid,
  42564. readonly: ""
  42565. },
  42566. domProps: { value: this.data.credpass }
  42567. }),
  42568. _vm._v(" "),
  42569. _c(
  42570. "button",
  42571. {
  42572. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  42573. attrs: {
  42574. id: "btn-password" + this.data.credid,
  42575. "data-clipboard-target": "#password" + this.data.credid
  42576. }
  42577. },
  42578. [_c("i", { staticClass: "far fa-clone" })]
  42579. )
  42580. ])
  42581. ]),
  42582. _vm._v(" "),
  42583. _vm._m(2)
  42584. ])
  42585. ]
  42586. )
  42587. }
  42588. var staticRenderFns = [
  42589. function() {
  42590. var _vm = this
  42591. var _h = _vm.$createElement
  42592. var _c = _vm._self._c || _h
  42593. return _c("label", { attrs: { for: "username" } }, [
  42594. _c("i", { staticClass: "fas fa-fw fa-user" })
  42595. ])
  42596. },
  42597. function() {
  42598. var _vm = this
  42599. var _h = _vm.$createElement
  42600. var _c = _vm._self._c || _h
  42601. return _c("label", { attrs: { for: "password" } }, [
  42602. _c("i", { staticClass: "fas fa-fw fa-key" })
  42603. ])
  42604. },
  42605. function() {
  42606. var _vm = this
  42607. var _h = _vm.$createElement
  42608. var _c = _vm._self._c || _h
  42609. return _c(
  42610. "div",
  42611. {
  42612. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  42613. attrs: { role: "group", "aria-label": "Edit and Delete" }
  42614. },
  42615. [
  42616. _c(
  42617. "button",
  42618. {
  42619. staticClass: "btn btn-sm btn-secondary p-lg-1",
  42620. attrs: { type: "button" }
  42621. },
  42622. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  42623. ),
  42624. _vm._v(" "),
  42625. _c(
  42626. "button",
  42627. {
  42628. staticClass: "btn btn-sm btn-danger p-lg-1",
  42629. attrs: { type: "button" }
  42630. },
  42631. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  42632. )
  42633. ]
  42634. )
  42635. }
  42636. ]
  42637. render._withStripped = true
  42638. /***/ }),
  42639. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  42640. /*!*********************************************************************************************************************************************************************************************************!*\
  42641. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  42642. \*********************************************************************************************************************************************************************************************************/
  42643. /*! exports provided: render, staticRenderFns */
  42644. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42645. "use strict";
  42646. __webpack_require__.r(__webpack_exports__);
  42647. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42648. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42649. var render = function() {
  42650. var _vm = this
  42651. var _h = _vm.$createElement
  42652. var _c = _vm._self._c || _h
  42653. return _c("div", [
  42654. _c("p", [
  42655. _c("i", { staticClass: "fas fa-info-circle" }),
  42656. _vm._v(" "),
  42657. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  42658. ]),
  42659. _vm._v(" "),
  42660. _c("p", [
  42661. _c("i", { staticClass: "far fa-lightbulb" }),
  42662. _vm._v(" "),
  42663. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  42664. ]),
  42665. _vm._v(" "),
  42666. _c("p", [
  42667. _c("i", { staticClass: "fas fa-paste" }),
  42668. _vm._v(" "),
  42669. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  42670. ]),
  42671. _vm._v(" "),
  42672. _c("p", [
  42673. _c("i", { staticClass: "fas fa-building" }),
  42674. _vm._v(" "),
  42675. _c("span", { domProps: { textContent: _vm._s(this.data.storeid) } })
  42676. ]),
  42677. _vm._v(" "),
  42678. _c("p", [
  42679. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  42680. _vm._v(" "),
  42681. _c(
  42682. "span",
  42683. {
  42684. staticClass: "dashed-underline",
  42685. attrs: {
  42686. "data-toggle": "tooltip",
  42687. "data-placement": "bottom",
  42688. title: this.getHRDate(this.data.dropdate)
  42689. }
  42690. },
  42691. [
  42692. _vm._v(
  42693. "\n " +
  42694. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  42695. " days ago\n "
  42696. )
  42697. ]
  42698. )
  42699. ]),
  42700. _vm._v(" "),
  42701. _c("p", [
  42702. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  42703. _vm._v(" "),
  42704. !this.isZero(this.data.pickupdate)
  42705. ? _c(
  42706. "span",
  42707. {
  42708. staticClass: "dashed-underline",
  42709. attrs: {
  42710. "data-toggle": "tooltip",
  42711. "data-placement": "bottom",
  42712. tittle: this.getHRDate(this.data.pickupdate)
  42713. }
  42714. },
  42715. [
  42716. _vm._v(
  42717. "\n " +
  42718. _vm._s(
  42719. Math.floor(this.daysSinceToday(this.data.pickupdate))
  42720. ) +
  42721. " days ago\n "
  42722. )
  42723. ]
  42724. )
  42725. : _vm._e()
  42726. ])
  42727. ])
  42728. }
  42729. var staticRenderFns = []
  42730. render._withStripped = true
  42731. /***/ }),
  42732. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  42733. /*!********************************************************************!*\
  42734. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  42735. \********************************************************************/
  42736. /*! exports provided: default */
  42737. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42738. "use strict";
  42739. __webpack_require__.r(__webpack_exports__);
  42740. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  42741. /* globals __VUE_SSR_CONTEXT__ */
  42742. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  42743. // This module is a runtime utility for cleaner component module output and will
  42744. // be included in the final webpack user bundle.
  42745. function normalizeComponent (
  42746. scriptExports,
  42747. render,
  42748. staticRenderFns,
  42749. functionalTemplate,
  42750. injectStyles,
  42751. scopeId,
  42752. moduleIdentifier, /* server only */
  42753. shadowMode /* vue-cli only */
  42754. ) {
  42755. // Vue.extend constructor export interop
  42756. var options = typeof scriptExports === 'function'
  42757. ? scriptExports.options
  42758. : scriptExports
  42759. // render functions
  42760. if (render) {
  42761. options.render = render
  42762. options.staticRenderFns = staticRenderFns
  42763. options._compiled = true
  42764. }
  42765. // functional template
  42766. if (functionalTemplate) {
  42767. options.functional = true
  42768. }
  42769. // scopedId
  42770. if (scopeId) {
  42771. options._scopeId = 'data-v-' + scopeId
  42772. }
  42773. var hook
  42774. if (moduleIdentifier) { // server build
  42775. hook = function (context) {
  42776. // 2.3 injection
  42777. context =
  42778. context || // cached call
  42779. (this.$vnode && this.$vnode.ssrContext) || // stateful
  42780. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  42781. // 2.2 with runInNewContext: true
  42782. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  42783. context = __VUE_SSR_CONTEXT__
  42784. }
  42785. // inject component styles
  42786. if (injectStyles) {
  42787. injectStyles.call(this, context)
  42788. }
  42789. // register component module identifier for async chunk inferrence
  42790. if (context && context._registeredComponents) {
  42791. context._registeredComponents.add(moduleIdentifier)
  42792. }
  42793. }
  42794. // used by ssr in case component is cached and beforeCreate
  42795. // never gets called
  42796. options._ssrRegister = hook
  42797. } else if (injectStyles) {
  42798. hook = shadowMode
  42799. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  42800. : injectStyles
  42801. }
  42802. if (hook) {
  42803. if (options.functional) {
  42804. // for template-only hot-reload because in that case the render fn doesn't
  42805. // go through the normalizer
  42806. options._injectStyles = hook
  42807. // register for functioal component in vue file
  42808. var originalRender = options.render
  42809. options.render = function renderWithStyleInjection (h, context) {
  42810. hook.call(context)
  42811. return originalRender(h, context)
  42812. }
  42813. } else {
  42814. // inject component registration as beforeCreate hook
  42815. var existing = options.beforeCreate
  42816. options.beforeCreate = existing
  42817. ? [].concat(existing, hook)
  42818. : [hook]
  42819. }
  42820. }
  42821. return {
  42822. exports: scriptExports,
  42823. options: options
  42824. }
  42825. }
  42826. /***/ }),
  42827. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  42828. /*!*************************************************!*\
  42829. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  42830. \*************************************************/
  42831. /*! no static exports found */
  42832. /***/ (function(module, exports, __webpack_require__) {
  42833. "use strict";
  42834. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  42835. * Vue.js v2.6.11
  42836. * (c) 2014-2019 Evan You
  42837. * Released under the MIT License.
  42838. */
  42839. /* */
  42840. var emptyObject = Object.freeze({});
  42841. // These helpers produce better VM code in JS engines due to their
  42842. // explicitness and function inlining.
  42843. function isUndef (v) {
  42844. return v === undefined || v === null
  42845. }
  42846. function isDef (v) {
  42847. return v !== undefined && v !== null
  42848. }
  42849. function isTrue (v) {
  42850. return v === true
  42851. }
  42852. function isFalse (v) {
  42853. return v === false
  42854. }
  42855. /**
  42856. * Check if value is primitive.
  42857. */
  42858. function isPrimitive (value) {
  42859. return (
  42860. typeof value === 'string' ||
  42861. typeof value === 'number' ||
  42862. // $flow-disable-line
  42863. typeof value === 'symbol' ||
  42864. typeof value === 'boolean'
  42865. )
  42866. }
  42867. /**
  42868. * Quick object check - this is primarily used to tell
  42869. * Objects from primitive values when we know the value
  42870. * is a JSON-compliant type.
  42871. */
  42872. function isObject (obj) {
  42873. return obj !== null && typeof obj === 'object'
  42874. }
  42875. /**
  42876. * Get the raw type string of a value, e.g., [object Object].
  42877. */
  42878. var _toString = Object.prototype.toString;
  42879. function toRawType (value) {
  42880. return _toString.call(value).slice(8, -1)
  42881. }
  42882. /**
  42883. * Strict object type check. Only returns true
  42884. * for plain JavaScript objects.
  42885. */
  42886. function isPlainObject (obj) {
  42887. return _toString.call(obj) === '[object Object]'
  42888. }
  42889. function isRegExp (v) {
  42890. return _toString.call(v) === '[object RegExp]'
  42891. }
  42892. /**
  42893. * Check if val is a valid array index.
  42894. */
  42895. function isValidArrayIndex (val) {
  42896. var n = parseFloat(String(val));
  42897. return n >= 0 && Math.floor(n) === n && isFinite(val)
  42898. }
  42899. function isPromise (val) {
  42900. return (
  42901. isDef(val) &&
  42902. typeof val.then === 'function' &&
  42903. typeof val.catch === 'function'
  42904. )
  42905. }
  42906. /**
  42907. * Convert a value to a string that is actually rendered.
  42908. */
  42909. function toString (val) {
  42910. return val == null
  42911. ? ''
  42912. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  42913. ? JSON.stringify(val, null, 2)
  42914. : String(val)
  42915. }
  42916. /**
  42917. * Convert an input value to a number for persistence.
  42918. * If the conversion fails, return original string.
  42919. */
  42920. function toNumber (val) {
  42921. var n = parseFloat(val);
  42922. return isNaN(n) ? val : n
  42923. }
  42924. /**
  42925. * Make a map and return a function for checking if a key
  42926. * is in that map.
  42927. */
  42928. function makeMap (
  42929. str,
  42930. expectsLowerCase
  42931. ) {
  42932. var map = Object.create(null);
  42933. var list = str.split(',');
  42934. for (var i = 0; i < list.length; i++) {
  42935. map[list[i]] = true;
  42936. }
  42937. return expectsLowerCase
  42938. ? function (val) { return map[val.toLowerCase()]; }
  42939. : function (val) { return map[val]; }
  42940. }
  42941. /**
  42942. * Check if a tag is a built-in tag.
  42943. */
  42944. var isBuiltInTag = makeMap('slot,component', true);
  42945. /**
  42946. * Check if an attribute is a reserved attribute.
  42947. */
  42948. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  42949. /**
  42950. * Remove an item from an array.
  42951. */
  42952. function remove (arr, item) {
  42953. if (arr.length) {
  42954. var index = arr.indexOf(item);
  42955. if (index > -1) {
  42956. return arr.splice(index, 1)
  42957. }
  42958. }
  42959. }
  42960. /**
  42961. * Check whether an object has the property.
  42962. */
  42963. var hasOwnProperty = Object.prototype.hasOwnProperty;
  42964. function hasOwn (obj, key) {
  42965. return hasOwnProperty.call(obj, key)
  42966. }
  42967. /**
  42968. * Create a cached version of a pure function.
  42969. */
  42970. function cached (fn) {
  42971. var cache = Object.create(null);
  42972. return (function cachedFn (str) {
  42973. var hit = cache[str];
  42974. return hit || (cache[str] = fn(str))
  42975. })
  42976. }
  42977. /**
  42978. * Camelize a hyphen-delimited string.
  42979. */
  42980. var camelizeRE = /-(\w)/g;
  42981. var camelize = cached(function (str) {
  42982. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  42983. });
  42984. /**
  42985. * Capitalize a string.
  42986. */
  42987. var capitalize = cached(function (str) {
  42988. return str.charAt(0).toUpperCase() + str.slice(1)
  42989. });
  42990. /**
  42991. * Hyphenate a camelCase string.
  42992. */
  42993. var hyphenateRE = /\B([A-Z])/g;
  42994. var hyphenate = cached(function (str) {
  42995. return str.replace(hyphenateRE, '-$1').toLowerCase()
  42996. });
  42997. /**
  42998. * Simple bind polyfill for environments that do not support it,
  42999. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  43000. * since native bind is now performant enough in most browsers.
  43001. * But removing it would mean breaking code that was able to run in
  43002. * PhantomJS 1.x, so this must be kept for backward compatibility.
  43003. */
  43004. /* istanbul ignore next */
  43005. function polyfillBind (fn, ctx) {
  43006. function boundFn (a) {
  43007. var l = arguments.length;
  43008. return l
  43009. ? l > 1
  43010. ? fn.apply(ctx, arguments)
  43011. : fn.call(ctx, a)
  43012. : fn.call(ctx)
  43013. }
  43014. boundFn._length = fn.length;
  43015. return boundFn
  43016. }
  43017. function nativeBind (fn, ctx) {
  43018. return fn.bind(ctx)
  43019. }
  43020. var bind = Function.prototype.bind
  43021. ? nativeBind
  43022. : polyfillBind;
  43023. /**
  43024. * Convert an Array-like object to a real Array.
  43025. */
  43026. function toArray (list, start) {
  43027. start = start || 0;
  43028. var i = list.length - start;
  43029. var ret = new Array(i);
  43030. while (i--) {
  43031. ret[i] = list[i + start];
  43032. }
  43033. return ret
  43034. }
  43035. /**
  43036. * Mix properties into target object.
  43037. */
  43038. function extend (to, _from) {
  43039. for (var key in _from) {
  43040. to[key] = _from[key];
  43041. }
  43042. return to
  43043. }
  43044. /**
  43045. * Merge an Array of Objects into a single Object.
  43046. */
  43047. function toObject (arr) {
  43048. var res = {};
  43049. for (var i = 0; i < arr.length; i++) {
  43050. if (arr[i]) {
  43051. extend(res, arr[i]);
  43052. }
  43053. }
  43054. return res
  43055. }
  43056. /* eslint-disable no-unused-vars */
  43057. /**
  43058. * Perform no operation.
  43059. * Stubbing args to make Flow happy without leaving useless transpiled code
  43060. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  43061. */
  43062. function noop (a, b, c) {}
  43063. /**
  43064. * Always return false.
  43065. */
  43066. var no = function (a, b, c) { return false; };
  43067. /* eslint-enable no-unused-vars */
  43068. /**
  43069. * Return the same value.
  43070. */
  43071. var identity = function (_) { return _; };
  43072. /**
  43073. * Generate a string containing static keys from compiler modules.
  43074. */
  43075. function genStaticKeys (modules) {
  43076. return modules.reduce(function (keys, m) {
  43077. return keys.concat(m.staticKeys || [])
  43078. }, []).join(',')
  43079. }
  43080. /**
  43081. * Check if two values are loosely equal - that is,
  43082. * if they are plain objects, do they have the same shape?
  43083. */
  43084. function looseEqual (a, b) {
  43085. if (a === b) { return true }
  43086. var isObjectA = isObject(a);
  43087. var isObjectB = isObject(b);
  43088. if (isObjectA && isObjectB) {
  43089. try {
  43090. var isArrayA = Array.isArray(a);
  43091. var isArrayB = Array.isArray(b);
  43092. if (isArrayA && isArrayB) {
  43093. return a.length === b.length && a.every(function (e, i) {
  43094. return looseEqual(e, b[i])
  43095. })
  43096. } else if (a instanceof Date && b instanceof Date) {
  43097. return a.getTime() === b.getTime()
  43098. } else if (!isArrayA && !isArrayB) {
  43099. var keysA = Object.keys(a);
  43100. var keysB = Object.keys(b);
  43101. return keysA.length === keysB.length && keysA.every(function (key) {
  43102. return looseEqual(a[key], b[key])
  43103. })
  43104. } else {
  43105. /* istanbul ignore next */
  43106. return false
  43107. }
  43108. } catch (e) {
  43109. /* istanbul ignore next */
  43110. return false
  43111. }
  43112. } else if (!isObjectA && !isObjectB) {
  43113. return String(a) === String(b)
  43114. } else {
  43115. return false
  43116. }
  43117. }
  43118. /**
  43119. * Return the first index at which a loosely equal value can be
  43120. * found in the array (if value is a plain object, the array must
  43121. * contain an object of the same shape), or -1 if it is not present.
  43122. */
  43123. function looseIndexOf (arr, val) {
  43124. for (var i = 0; i < arr.length; i++) {
  43125. if (looseEqual(arr[i], val)) { return i }
  43126. }
  43127. return -1
  43128. }
  43129. /**
  43130. * Ensure a function is called only once.
  43131. */
  43132. function once (fn) {
  43133. var called = false;
  43134. return function () {
  43135. if (!called) {
  43136. called = true;
  43137. fn.apply(this, arguments);
  43138. }
  43139. }
  43140. }
  43141. var SSR_ATTR = 'data-server-rendered';
  43142. var ASSET_TYPES = [
  43143. 'component',
  43144. 'directive',
  43145. 'filter'
  43146. ];
  43147. var LIFECYCLE_HOOKS = [
  43148. 'beforeCreate',
  43149. 'created',
  43150. 'beforeMount',
  43151. 'mounted',
  43152. 'beforeUpdate',
  43153. 'updated',
  43154. 'beforeDestroy',
  43155. 'destroyed',
  43156. 'activated',
  43157. 'deactivated',
  43158. 'errorCaptured',
  43159. 'serverPrefetch'
  43160. ];
  43161. /* */
  43162. var config = ({
  43163. /**
  43164. * Option merge strategies (used in core/util/options)
  43165. */
  43166. // $flow-disable-line
  43167. optionMergeStrategies: Object.create(null),
  43168. /**
  43169. * Whether to suppress warnings.
  43170. */
  43171. silent: false,
  43172. /**
  43173. * Show production mode tip message on boot?
  43174. */
  43175. productionTip: "development" !== 'production',
  43176. /**
  43177. * Whether to enable devtools
  43178. */
  43179. devtools: "development" !== 'production',
  43180. /**
  43181. * Whether to record perf
  43182. */
  43183. performance: false,
  43184. /**
  43185. * Error handler for watcher errors
  43186. */
  43187. errorHandler: null,
  43188. /**
  43189. * Warn handler for watcher warns
  43190. */
  43191. warnHandler: null,
  43192. /**
  43193. * Ignore certain custom elements
  43194. */
  43195. ignoredElements: [],
  43196. /**
  43197. * Custom user key aliases for v-on
  43198. */
  43199. // $flow-disable-line
  43200. keyCodes: Object.create(null),
  43201. /**
  43202. * Check if a tag is reserved so that it cannot be registered as a
  43203. * component. This is platform-dependent and may be overwritten.
  43204. */
  43205. isReservedTag: no,
  43206. /**
  43207. * Check if an attribute is reserved so that it cannot be used as a component
  43208. * prop. This is platform-dependent and may be overwritten.
  43209. */
  43210. isReservedAttr: no,
  43211. /**
  43212. * Check if a tag is an unknown element.
  43213. * Platform-dependent.
  43214. */
  43215. isUnknownElement: no,
  43216. /**
  43217. * Get the namespace of an element
  43218. */
  43219. getTagNamespace: noop,
  43220. /**
  43221. * Parse the real tag name for the specific platform.
  43222. */
  43223. parsePlatformTagName: identity,
  43224. /**
  43225. * Check if an attribute must be bound using property, e.g. value
  43226. * Platform-dependent.
  43227. */
  43228. mustUseProp: no,
  43229. /**
  43230. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  43231. * This will significantly reduce performance if set to false.
  43232. */
  43233. async: true,
  43234. /**
  43235. * Exposed for legacy reasons
  43236. */
  43237. _lifecycleHooks: LIFECYCLE_HOOKS
  43238. });
  43239. /* */
  43240. /**
  43241. * unicode letters used for parsing html tags, component names and property paths.
  43242. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  43243. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  43244. */
  43245. 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/;
  43246. /**
  43247. * Check if a string starts with $ or _
  43248. */
  43249. function isReserved (str) {
  43250. var c = (str + '').charCodeAt(0);
  43251. return c === 0x24 || c === 0x5F
  43252. }
  43253. /**
  43254. * Define a property.
  43255. */
  43256. function def (obj, key, val, enumerable) {
  43257. Object.defineProperty(obj, key, {
  43258. value: val,
  43259. enumerable: !!enumerable,
  43260. writable: true,
  43261. configurable: true
  43262. });
  43263. }
  43264. /**
  43265. * Parse simple path.
  43266. */
  43267. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  43268. function parsePath (path) {
  43269. if (bailRE.test(path)) {
  43270. return
  43271. }
  43272. var segments = path.split('.');
  43273. return function (obj) {
  43274. for (var i = 0; i < segments.length; i++) {
  43275. if (!obj) { return }
  43276. obj = obj[segments[i]];
  43277. }
  43278. return obj
  43279. }
  43280. }
  43281. /* */
  43282. // can we use __proto__?
  43283. var hasProto = '__proto__' in {};
  43284. // Browser environment sniffing
  43285. var inBrowser = typeof window !== 'undefined';
  43286. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  43287. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  43288. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  43289. var isIE = UA && /msie|trident/.test(UA);
  43290. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  43291. var isEdge = UA && UA.indexOf('edge/') > 0;
  43292. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  43293. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  43294. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  43295. var isPhantomJS = UA && /phantomjs/.test(UA);
  43296. var isFF = UA && UA.match(/firefox\/(\d+)/);
  43297. // Firefox has a "watch" function on Object.prototype...
  43298. var nativeWatch = ({}).watch;
  43299. var supportsPassive = false;
  43300. if (inBrowser) {
  43301. try {
  43302. var opts = {};
  43303. Object.defineProperty(opts, 'passive', ({
  43304. get: function get () {
  43305. /* istanbul ignore next */
  43306. supportsPassive = true;
  43307. }
  43308. })); // https://github.com/facebook/flow/issues/285
  43309. window.addEventListener('test-passive', null, opts);
  43310. } catch (e) {}
  43311. }
  43312. // this needs to be lazy-evaled because vue may be required before
  43313. // vue-server-renderer can set VUE_ENV
  43314. var _isServer;
  43315. var isServerRendering = function () {
  43316. if (_isServer === undefined) {
  43317. /* istanbul ignore if */
  43318. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  43319. // detect presence of vue-server-renderer and avoid
  43320. // Webpack shimming the process
  43321. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  43322. } else {
  43323. _isServer = false;
  43324. }
  43325. }
  43326. return _isServer
  43327. };
  43328. // detect devtools
  43329. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  43330. /* istanbul ignore next */
  43331. function isNative (Ctor) {
  43332. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  43333. }
  43334. var hasSymbol =
  43335. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  43336. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  43337. var _Set;
  43338. /* istanbul ignore if */ // $flow-disable-line
  43339. if (typeof Set !== 'undefined' && isNative(Set)) {
  43340. // use native Set when available.
  43341. _Set = Set;
  43342. } else {
  43343. // a non-standard Set polyfill that only works with primitive keys.
  43344. _Set = /*@__PURE__*/(function () {
  43345. function Set () {
  43346. this.set = Object.create(null);
  43347. }
  43348. Set.prototype.has = function has (key) {
  43349. return this.set[key] === true
  43350. };
  43351. Set.prototype.add = function add (key) {
  43352. this.set[key] = true;
  43353. };
  43354. Set.prototype.clear = function clear () {
  43355. this.set = Object.create(null);
  43356. };
  43357. return Set;
  43358. }());
  43359. }
  43360. /* */
  43361. var warn = noop;
  43362. var tip = noop;
  43363. var generateComponentTrace = (noop); // work around flow check
  43364. var formatComponentName = (noop);
  43365. {
  43366. var hasConsole = typeof console !== 'undefined';
  43367. var classifyRE = /(?:^|[-_])(\w)/g;
  43368. var classify = function (str) { return str
  43369. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  43370. .replace(/[-_]/g, ''); };
  43371. warn = function (msg, vm) {
  43372. var trace = vm ? generateComponentTrace(vm) : '';
  43373. if (config.warnHandler) {
  43374. config.warnHandler.call(null, msg, vm, trace);
  43375. } else if (hasConsole && (!config.silent)) {
  43376. console.error(("[Vue warn]: " + msg + trace));
  43377. }
  43378. };
  43379. tip = function (msg, vm) {
  43380. if (hasConsole && (!config.silent)) {
  43381. console.warn("[Vue tip]: " + msg + (
  43382. vm ? generateComponentTrace(vm) : ''
  43383. ));
  43384. }
  43385. };
  43386. formatComponentName = function (vm, includeFile) {
  43387. if (vm.$root === vm) {
  43388. return '<Root>'
  43389. }
  43390. var options = typeof vm === 'function' && vm.cid != null
  43391. ? vm.options
  43392. : vm._isVue
  43393. ? vm.$options || vm.constructor.options
  43394. : vm;
  43395. var name = options.name || options._componentTag;
  43396. var file = options.__file;
  43397. if (!name && file) {
  43398. var match = file.match(/([^/\\]+)\.vue$/);
  43399. name = match && match[1];
  43400. }
  43401. return (
  43402. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  43403. (file && includeFile !== false ? (" at " + file) : '')
  43404. )
  43405. };
  43406. var repeat = function (str, n) {
  43407. var res = '';
  43408. while (n) {
  43409. if (n % 2 === 1) { res += str; }
  43410. if (n > 1) { str += str; }
  43411. n >>= 1;
  43412. }
  43413. return res
  43414. };
  43415. generateComponentTrace = function (vm) {
  43416. if (vm._isVue && vm.$parent) {
  43417. var tree = [];
  43418. var currentRecursiveSequence = 0;
  43419. while (vm) {
  43420. if (tree.length > 0) {
  43421. var last = tree[tree.length - 1];
  43422. if (last.constructor === vm.constructor) {
  43423. currentRecursiveSequence++;
  43424. vm = vm.$parent;
  43425. continue
  43426. } else if (currentRecursiveSequence > 0) {
  43427. tree[tree.length - 1] = [last, currentRecursiveSequence];
  43428. currentRecursiveSequence = 0;
  43429. }
  43430. }
  43431. tree.push(vm);
  43432. vm = vm.$parent;
  43433. }
  43434. return '\n\nfound in\n\n' + tree
  43435. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  43436. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  43437. : formatComponentName(vm))); })
  43438. .join('\n')
  43439. } else {
  43440. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  43441. }
  43442. };
  43443. }
  43444. /* */
  43445. var uid = 0;
  43446. /**
  43447. * A dep is an observable that can have multiple
  43448. * directives subscribing to it.
  43449. */
  43450. var Dep = function Dep () {
  43451. this.id = uid++;
  43452. this.subs = [];
  43453. };
  43454. Dep.prototype.addSub = function addSub (sub) {
  43455. this.subs.push(sub);
  43456. };
  43457. Dep.prototype.removeSub = function removeSub (sub) {
  43458. remove(this.subs, sub);
  43459. };
  43460. Dep.prototype.depend = function depend () {
  43461. if (Dep.target) {
  43462. Dep.target.addDep(this);
  43463. }
  43464. };
  43465. Dep.prototype.notify = function notify () {
  43466. // stabilize the subscriber list first
  43467. var subs = this.subs.slice();
  43468. if (!config.async) {
  43469. // subs aren't sorted in scheduler if not running async
  43470. // we need to sort them now to make sure they fire in correct
  43471. // order
  43472. subs.sort(function (a, b) { return a.id - b.id; });
  43473. }
  43474. for (var i = 0, l = subs.length; i < l; i++) {
  43475. subs[i].update();
  43476. }
  43477. };
  43478. // The current target watcher being evaluated.
  43479. // This is globally unique because only one watcher
  43480. // can be evaluated at a time.
  43481. Dep.target = null;
  43482. var targetStack = [];
  43483. function pushTarget (target) {
  43484. targetStack.push(target);
  43485. Dep.target = target;
  43486. }
  43487. function popTarget () {
  43488. targetStack.pop();
  43489. Dep.target = targetStack[targetStack.length - 1];
  43490. }
  43491. /* */
  43492. var VNode = function VNode (
  43493. tag,
  43494. data,
  43495. children,
  43496. text,
  43497. elm,
  43498. context,
  43499. componentOptions,
  43500. asyncFactory
  43501. ) {
  43502. this.tag = tag;
  43503. this.data = data;
  43504. this.children = children;
  43505. this.text = text;
  43506. this.elm = elm;
  43507. this.ns = undefined;
  43508. this.context = context;
  43509. this.fnContext = undefined;
  43510. this.fnOptions = undefined;
  43511. this.fnScopeId = undefined;
  43512. this.key = data && data.key;
  43513. this.componentOptions = componentOptions;
  43514. this.componentInstance = undefined;
  43515. this.parent = undefined;
  43516. this.raw = false;
  43517. this.isStatic = false;
  43518. this.isRootInsert = true;
  43519. this.isComment = false;
  43520. this.isCloned = false;
  43521. this.isOnce = false;
  43522. this.asyncFactory = asyncFactory;
  43523. this.asyncMeta = undefined;
  43524. this.isAsyncPlaceholder = false;
  43525. };
  43526. var prototypeAccessors = { child: { configurable: true } };
  43527. // DEPRECATED: alias for componentInstance for backwards compat.
  43528. /* istanbul ignore next */
  43529. prototypeAccessors.child.get = function () {
  43530. return this.componentInstance
  43531. };
  43532. Object.defineProperties( VNode.prototype, prototypeAccessors );
  43533. var createEmptyVNode = function (text) {
  43534. if ( text === void 0 ) text = '';
  43535. var node = new VNode();
  43536. node.text = text;
  43537. node.isComment = true;
  43538. return node
  43539. };
  43540. function createTextVNode (val) {
  43541. return new VNode(undefined, undefined, undefined, String(val))
  43542. }
  43543. // optimized shallow clone
  43544. // used for static nodes and slot nodes because they may be reused across
  43545. // multiple renders, cloning them avoids errors when DOM manipulations rely
  43546. // on their elm reference.
  43547. function cloneVNode (vnode) {
  43548. var cloned = new VNode(
  43549. vnode.tag,
  43550. vnode.data,
  43551. // #7975
  43552. // clone children array to avoid mutating original in case of cloning
  43553. // a child.
  43554. vnode.children && vnode.children.slice(),
  43555. vnode.text,
  43556. vnode.elm,
  43557. vnode.context,
  43558. vnode.componentOptions,
  43559. vnode.asyncFactory
  43560. );
  43561. cloned.ns = vnode.ns;
  43562. cloned.isStatic = vnode.isStatic;
  43563. cloned.key = vnode.key;
  43564. cloned.isComment = vnode.isComment;
  43565. cloned.fnContext = vnode.fnContext;
  43566. cloned.fnOptions = vnode.fnOptions;
  43567. cloned.fnScopeId = vnode.fnScopeId;
  43568. cloned.asyncMeta = vnode.asyncMeta;
  43569. cloned.isCloned = true;
  43570. return cloned
  43571. }
  43572. /*
  43573. * not type checking this file because flow doesn't play well with
  43574. * dynamically accessing methods on Array prototype
  43575. */
  43576. var arrayProto = Array.prototype;
  43577. var arrayMethods = Object.create(arrayProto);
  43578. var methodsToPatch = [
  43579. 'push',
  43580. 'pop',
  43581. 'shift',
  43582. 'unshift',
  43583. 'splice',
  43584. 'sort',
  43585. 'reverse'
  43586. ];
  43587. /**
  43588. * Intercept mutating methods and emit events
  43589. */
  43590. methodsToPatch.forEach(function (method) {
  43591. // cache original method
  43592. var original = arrayProto[method];
  43593. def(arrayMethods, method, function mutator () {
  43594. var args = [], len = arguments.length;
  43595. while ( len-- ) args[ len ] = arguments[ len ];
  43596. var result = original.apply(this, args);
  43597. var ob = this.__ob__;
  43598. var inserted;
  43599. switch (method) {
  43600. case 'push':
  43601. case 'unshift':
  43602. inserted = args;
  43603. break
  43604. case 'splice':
  43605. inserted = args.slice(2);
  43606. break
  43607. }
  43608. if (inserted) { ob.observeArray(inserted); }
  43609. // notify change
  43610. ob.dep.notify();
  43611. return result
  43612. });
  43613. });
  43614. /* */
  43615. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  43616. /**
  43617. * In some cases we may want to disable observation inside a component's
  43618. * update computation.
  43619. */
  43620. var shouldObserve = true;
  43621. function toggleObserving (value) {
  43622. shouldObserve = value;
  43623. }
  43624. /**
  43625. * Observer class that is attached to each observed
  43626. * object. Once attached, the observer converts the target
  43627. * object's property keys into getter/setters that
  43628. * collect dependencies and dispatch updates.
  43629. */
  43630. var Observer = function Observer (value) {
  43631. this.value = value;
  43632. this.dep = new Dep();
  43633. this.vmCount = 0;
  43634. def(value, '__ob__', this);
  43635. if (Array.isArray(value)) {
  43636. if (hasProto) {
  43637. protoAugment(value, arrayMethods);
  43638. } else {
  43639. copyAugment(value, arrayMethods, arrayKeys);
  43640. }
  43641. this.observeArray(value);
  43642. } else {
  43643. this.walk(value);
  43644. }
  43645. };
  43646. /**
  43647. * Walk through all properties and convert them into
  43648. * getter/setters. This method should only be called when
  43649. * value type is Object.
  43650. */
  43651. Observer.prototype.walk = function walk (obj) {
  43652. var keys = Object.keys(obj);
  43653. for (var i = 0; i < keys.length; i++) {
  43654. defineReactive$$1(obj, keys[i]);
  43655. }
  43656. };
  43657. /**
  43658. * Observe a list of Array items.
  43659. */
  43660. Observer.prototype.observeArray = function observeArray (items) {
  43661. for (var i = 0, l = items.length; i < l; i++) {
  43662. observe(items[i]);
  43663. }
  43664. };
  43665. // helpers
  43666. /**
  43667. * Augment a target Object or Array by intercepting
  43668. * the prototype chain using __proto__
  43669. */
  43670. function protoAugment (target, src) {
  43671. /* eslint-disable no-proto */
  43672. target.__proto__ = src;
  43673. /* eslint-enable no-proto */
  43674. }
  43675. /**
  43676. * Augment a target Object or Array by defining
  43677. * hidden properties.
  43678. */
  43679. /* istanbul ignore next */
  43680. function copyAugment (target, src, keys) {
  43681. for (var i = 0, l = keys.length; i < l; i++) {
  43682. var key = keys[i];
  43683. def(target, key, src[key]);
  43684. }
  43685. }
  43686. /**
  43687. * Attempt to create an observer instance for a value,
  43688. * returns the new observer if successfully observed,
  43689. * or the existing observer if the value already has one.
  43690. */
  43691. function observe (value, asRootData) {
  43692. if (!isObject(value) || value instanceof VNode) {
  43693. return
  43694. }
  43695. var ob;
  43696. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  43697. ob = value.__ob__;
  43698. } else if (
  43699. shouldObserve &&
  43700. !isServerRendering() &&
  43701. (Array.isArray(value) || isPlainObject(value)) &&
  43702. Object.isExtensible(value) &&
  43703. !value._isVue
  43704. ) {
  43705. ob = new Observer(value);
  43706. }
  43707. if (asRootData && ob) {
  43708. ob.vmCount++;
  43709. }
  43710. return ob
  43711. }
  43712. /**
  43713. * Define a reactive property on an Object.
  43714. */
  43715. function defineReactive$$1 (
  43716. obj,
  43717. key,
  43718. val,
  43719. customSetter,
  43720. shallow
  43721. ) {
  43722. var dep = new Dep();
  43723. var property = Object.getOwnPropertyDescriptor(obj, key);
  43724. if (property && property.configurable === false) {
  43725. return
  43726. }
  43727. // cater for pre-defined getter/setters
  43728. var getter = property && property.get;
  43729. var setter = property && property.set;
  43730. if ((!getter || setter) && arguments.length === 2) {
  43731. val = obj[key];
  43732. }
  43733. var childOb = !shallow && observe(val);
  43734. Object.defineProperty(obj, key, {
  43735. enumerable: true,
  43736. configurable: true,
  43737. get: function reactiveGetter () {
  43738. var value = getter ? getter.call(obj) : val;
  43739. if (Dep.target) {
  43740. dep.depend();
  43741. if (childOb) {
  43742. childOb.dep.depend();
  43743. if (Array.isArray(value)) {
  43744. dependArray(value);
  43745. }
  43746. }
  43747. }
  43748. return value
  43749. },
  43750. set: function reactiveSetter (newVal) {
  43751. var value = getter ? getter.call(obj) : val;
  43752. /* eslint-disable no-self-compare */
  43753. if (newVal === value || (newVal !== newVal && value !== value)) {
  43754. return
  43755. }
  43756. /* eslint-enable no-self-compare */
  43757. if (customSetter) {
  43758. customSetter();
  43759. }
  43760. // #7981: for accessor properties without setter
  43761. if (getter && !setter) { return }
  43762. if (setter) {
  43763. setter.call(obj, newVal);
  43764. } else {
  43765. val = newVal;
  43766. }
  43767. childOb = !shallow && observe(newVal);
  43768. dep.notify();
  43769. }
  43770. });
  43771. }
  43772. /**
  43773. * Set a property on an object. Adds the new property and
  43774. * triggers change notification if the property doesn't
  43775. * already exist.
  43776. */
  43777. function set (target, key, val) {
  43778. if (isUndef(target) || isPrimitive(target)
  43779. ) {
  43780. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  43781. }
  43782. if (Array.isArray(target) && isValidArrayIndex(key)) {
  43783. target.length = Math.max(target.length, key);
  43784. target.splice(key, 1, val);
  43785. return val
  43786. }
  43787. if (key in target && !(key in Object.prototype)) {
  43788. target[key] = val;
  43789. return val
  43790. }
  43791. var ob = (target).__ob__;
  43792. if (target._isVue || (ob && ob.vmCount)) {
  43793. warn(
  43794. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  43795. 'at runtime - declare it upfront in the data option.'
  43796. );
  43797. return val
  43798. }
  43799. if (!ob) {
  43800. target[key] = val;
  43801. return val
  43802. }
  43803. defineReactive$$1(ob.value, key, val);
  43804. ob.dep.notify();
  43805. return val
  43806. }
  43807. /**
  43808. * Delete a property and trigger change if necessary.
  43809. */
  43810. function del (target, key) {
  43811. if (isUndef(target) || isPrimitive(target)
  43812. ) {
  43813. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  43814. }
  43815. if (Array.isArray(target) && isValidArrayIndex(key)) {
  43816. target.splice(key, 1);
  43817. return
  43818. }
  43819. var ob = (target).__ob__;
  43820. if (target._isVue || (ob && ob.vmCount)) {
  43821. warn(
  43822. 'Avoid deleting properties on a Vue instance or its root $data ' +
  43823. '- just set it to null.'
  43824. );
  43825. return
  43826. }
  43827. if (!hasOwn(target, key)) {
  43828. return
  43829. }
  43830. delete target[key];
  43831. if (!ob) {
  43832. return
  43833. }
  43834. ob.dep.notify();
  43835. }
  43836. /**
  43837. * Collect dependencies on array elements when the array is touched, since
  43838. * we cannot intercept array element access like property getters.
  43839. */
  43840. function dependArray (value) {
  43841. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  43842. e = value[i];
  43843. e && e.__ob__ && e.__ob__.dep.depend();
  43844. if (Array.isArray(e)) {
  43845. dependArray(e);
  43846. }
  43847. }
  43848. }
  43849. /* */
  43850. /**
  43851. * Option overwriting strategies are functions that handle
  43852. * how to merge a parent option value and a child option
  43853. * value into the final value.
  43854. */
  43855. var strats = config.optionMergeStrategies;
  43856. /**
  43857. * Options with restrictions
  43858. */
  43859. {
  43860. strats.el = strats.propsData = function (parent, child, vm, key) {
  43861. if (!vm) {
  43862. warn(
  43863. "option \"" + key + "\" can only be used during instance " +
  43864. 'creation with the `new` keyword.'
  43865. );
  43866. }
  43867. return defaultStrat(parent, child)
  43868. };
  43869. }
  43870. /**
  43871. * Helper that recursively merges two data objects together.
  43872. */
  43873. function mergeData (to, from) {
  43874. if (!from) { return to }
  43875. var key, toVal, fromVal;
  43876. var keys = hasSymbol
  43877. ? Reflect.ownKeys(from)
  43878. : Object.keys(from);
  43879. for (var i = 0; i < keys.length; i++) {
  43880. key = keys[i];
  43881. // in case the object is already observed...
  43882. if (key === '__ob__') { continue }
  43883. toVal = to[key];
  43884. fromVal = from[key];
  43885. if (!hasOwn(to, key)) {
  43886. set(to, key, fromVal);
  43887. } else if (
  43888. toVal !== fromVal &&
  43889. isPlainObject(toVal) &&
  43890. isPlainObject(fromVal)
  43891. ) {
  43892. mergeData(toVal, fromVal);
  43893. }
  43894. }
  43895. return to
  43896. }
  43897. /**
  43898. * Data
  43899. */
  43900. function mergeDataOrFn (
  43901. parentVal,
  43902. childVal,
  43903. vm
  43904. ) {
  43905. if (!vm) {
  43906. // in a Vue.extend merge, both should be functions
  43907. if (!childVal) {
  43908. return parentVal
  43909. }
  43910. if (!parentVal) {
  43911. return childVal
  43912. }
  43913. // when parentVal & childVal are both present,
  43914. // we need to return a function that returns the
  43915. // merged result of both functions... no need to
  43916. // check if parentVal is a function here because
  43917. // it has to be a function to pass previous merges.
  43918. return function mergedDataFn () {
  43919. return mergeData(
  43920. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  43921. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  43922. )
  43923. }
  43924. } else {
  43925. return function mergedInstanceDataFn () {
  43926. // instance merge
  43927. var instanceData = typeof childVal === 'function'
  43928. ? childVal.call(vm, vm)
  43929. : childVal;
  43930. var defaultData = typeof parentVal === 'function'
  43931. ? parentVal.call(vm, vm)
  43932. : parentVal;
  43933. if (instanceData) {
  43934. return mergeData(instanceData, defaultData)
  43935. } else {
  43936. return defaultData
  43937. }
  43938. }
  43939. }
  43940. }
  43941. strats.data = function (
  43942. parentVal,
  43943. childVal,
  43944. vm
  43945. ) {
  43946. if (!vm) {
  43947. if (childVal && typeof childVal !== 'function') {
  43948. warn(
  43949. 'The "data" option should be a function ' +
  43950. 'that returns a per-instance value in component ' +
  43951. 'definitions.',
  43952. vm
  43953. );
  43954. return parentVal
  43955. }
  43956. return mergeDataOrFn(parentVal, childVal)
  43957. }
  43958. return mergeDataOrFn(parentVal, childVal, vm)
  43959. };
  43960. /**
  43961. * Hooks and props are merged as arrays.
  43962. */
  43963. function mergeHook (
  43964. parentVal,
  43965. childVal
  43966. ) {
  43967. var res = childVal
  43968. ? parentVal
  43969. ? parentVal.concat(childVal)
  43970. : Array.isArray(childVal)
  43971. ? childVal
  43972. : [childVal]
  43973. : parentVal;
  43974. return res
  43975. ? dedupeHooks(res)
  43976. : res
  43977. }
  43978. function dedupeHooks (hooks) {
  43979. var res = [];
  43980. for (var i = 0; i < hooks.length; i++) {
  43981. if (res.indexOf(hooks[i]) === -1) {
  43982. res.push(hooks[i]);
  43983. }
  43984. }
  43985. return res
  43986. }
  43987. LIFECYCLE_HOOKS.forEach(function (hook) {
  43988. strats[hook] = mergeHook;
  43989. });
  43990. /**
  43991. * Assets
  43992. *
  43993. * When a vm is present (instance creation), we need to do
  43994. * a three-way merge between constructor options, instance
  43995. * options and parent options.
  43996. */
  43997. function mergeAssets (
  43998. parentVal,
  43999. childVal,
  44000. vm,
  44001. key
  44002. ) {
  44003. var res = Object.create(parentVal || null);
  44004. if (childVal) {
  44005. assertObjectType(key, childVal, vm);
  44006. return extend(res, childVal)
  44007. } else {
  44008. return res
  44009. }
  44010. }
  44011. ASSET_TYPES.forEach(function (type) {
  44012. strats[type + 's'] = mergeAssets;
  44013. });
  44014. /**
  44015. * Watchers.
  44016. *
  44017. * Watchers hashes should not overwrite one
  44018. * another, so we merge them as arrays.
  44019. */
  44020. strats.watch = function (
  44021. parentVal,
  44022. childVal,
  44023. vm,
  44024. key
  44025. ) {
  44026. // work around Firefox's Object.prototype.watch...
  44027. if (parentVal === nativeWatch) { parentVal = undefined; }
  44028. if (childVal === nativeWatch) { childVal = undefined; }
  44029. /* istanbul ignore if */
  44030. if (!childVal) { return Object.create(parentVal || null) }
  44031. {
  44032. assertObjectType(key, childVal, vm);
  44033. }
  44034. if (!parentVal) { return childVal }
  44035. var ret = {};
  44036. extend(ret, parentVal);
  44037. for (var key$1 in childVal) {
  44038. var parent = ret[key$1];
  44039. var child = childVal[key$1];
  44040. if (parent && !Array.isArray(parent)) {
  44041. parent = [parent];
  44042. }
  44043. ret[key$1] = parent
  44044. ? parent.concat(child)
  44045. : Array.isArray(child) ? child : [child];
  44046. }
  44047. return ret
  44048. };
  44049. /**
  44050. * Other object hashes.
  44051. */
  44052. strats.props =
  44053. strats.methods =
  44054. strats.inject =
  44055. strats.computed = function (
  44056. parentVal,
  44057. childVal,
  44058. vm,
  44059. key
  44060. ) {
  44061. if (childVal && "development" !== 'production') {
  44062. assertObjectType(key, childVal, vm);
  44063. }
  44064. if (!parentVal) { return childVal }
  44065. var ret = Object.create(null);
  44066. extend(ret, parentVal);
  44067. if (childVal) { extend(ret, childVal); }
  44068. return ret
  44069. };
  44070. strats.provide = mergeDataOrFn;
  44071. /**
  44072. * Default strategy.
  44073. */
  44074. var defaultStrat = function (parentVal, childVal) {
  44075. return childVal === undefined
  44076. ? parentVal
  44077. : childVal
  44078. };
  44079. /**
  44080. * Validate component names
  44081. */
  44082. function checkComponents (options) {
  44083. for (var key in options.components) {
  44084. validateComponentName(key);
  44085. }
  44086. }
  44087. function validateComponentName (name) {
  44088. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  44089. warn(
  44090. 'Invalid component name: "' + name + '". Component names ' +
  44091. 'should conform to valid custom element name in html5 specification.'
  44092. );
  44093. }
  44094. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  44095. warn(
  44096. 'Do not use built-in or reserved HTML elements as component ' +
  44097. 'id: ' + name
  44098. );
  44099. }
  44100. }
  44101. /**
  44102. * Ensure all props option syntax are normalized into the
  44103. * Object-based format.
  44104. */
  44105. function normalizeProps (options, vm) {
  44106. var props = options.props;
  44107. if (!props) { return }
  44108. var res = {};
  44109. var i, val, name;
  44110. if (Array.isArray(props)) {
  44111. i = props.length;
  44112. while (i--) {
  44113. val = props[i];
  44114. if (typeof val === 'string') {
  44115. name = camelize(val);
  44116. res[name] = { type: null };
  44117. } else {
  44118. warn('props must be strings when using array syntax.');
  44119. }
  44120. }
  44121. } else if (isPlainObject(props)) {
  44122. for (var key in props) {
  44123. val = props[key];
  44124. name = camelize(key);
  44125. res[name] = isPlainObject(val)
  44126. ? val
  44127. : { type: val };
  44128. }
  44129. } else {
  44130. warn(
  44131. "Invalid value for option \"props\": expected an Array or an Object, " +
  44132. "but got " + (toRawType(props)) + ".",
  44133. vm
  44134. );
  44135. }
  44136. options.props = res;
  44137. }
  44138. /**
  44139. * Normalize all injections into Object-based format
  44140. */
  44141. function normalizeInject (options, vm) {
  44142. var inject = options.inject;
  44143. if (!inject) { return }
  44144. var normalized = options.inject = {};
  44145. if (Array.isArray(inject)) {
  44146. for (var i = 0; i < inject.length; i++) {
  44147. normalized[inject[i]] = { from: inject[i] };
  44148. }
  44149. } else if (isPlainObject(inject)) {
  44150. for (var key in inject) {
  44151. var val = inject[key];
  44152. normalized[key] = isPlainObject(val)
  44153. ? extend({ from: key }, val)
  44154. : { from: val };
  44155. }
  44156. } else {
  44157. warn(
  44158. "Invalid value for option \"inject\": expected an Array or an Object, " +
  44159. "but got " + (toRawType(inject)) + ".",
  44160. vm
  44161. );
  44162. }
  44163. }
  44164. /**
  44165. * Normalize raw function directives into object format.
  44166. */
  44167. function normalizeDirectives (options) {
  44168. var dirs = options.directives;
  44169. if (dirs) {
  44170. for (var key in dirs) {
  44171. var def$$1 = dirs[key];
  44172. if (typeof def$$1 === 'function') {
  44173. dirs[key] = { bind: def$$1, update: def$$1 };
  44174. }
  44175. }
  44176. }
  44177. }
  44178. function assertObjectType (name, value, vm) {
  44179. if (!isPlainObject(value)) {
  44180. warn(
  44181. "Invalid value for option \"" + name + "\": expected an Object, " +
  44182. "but got " + (toRawType(value)) + ".",
  44183. vm
  44184. );
  44185. }
  44186. }
  44187. /**
  44188. * Merge two option objects into a new one.
  44189. * Core utility used in both instantiation and inheritance.
  44190. */
  44191. function mergeOptions (
  44192. parent,
  44193. child,
  44194. vm
  44195. ) {
  44196. {
  44197. checkComponents(child);
  44198. }
  44199. if (typeof child === 'function') {
  44200. child = child.options;
  44201. }
  44202. normalizeProps(child, vm);
  44203. normalizeInject(child, vm);
  44204. normalizeDirectives(child);
  44205. // Apply extends and mixins on the child options,
  44206. // but only if it is a raw options object that isn't
  44207. // the result of another mergeOptions call.
  44208. // Only merged options has the _base property.
  44209. if (!child._base) {
  44210. if (child.extends) {
  44211. parent = mergeOptions(parent, child.extends, vm);
  44212. }
  44213. if (child.mixins) {
  44214. for (var i = 0, l = child.mixins.length; i < l; i++) {
  44215. parent = mergeOptions(parent, child.mixins[i], vm);
  44216. }
  44217. }
  44218. }
  44219. var options = {};
  44220. var key;
  44221. for (key in parent) {
  44222. mergeField(key);
  44223. }
  44224. for (key in child) {
  44225. if (!hasOwn(parent, key)) {
  44226. mergeField(key);
  44227. }
  44228. }
  44229. function mergeField (key) {
  44230. var strat = strats[key] || defaultStrat;
  44231. options[key] = strat(parent[key], child[key], vm, key);
  44232. }
  44233. return options
  44234. }
  44235. /**
  44236. * Resolve an asset.
  44237. * This function is used because child instances need access
  44238. * to assets defined in its ancestor chain.
  44239. */
  44240. function resolveAsset (
  44241. options,
  44242. type,
  44243. id,
  44244. warnMissing
  44245. ) {
  44246. /* istanbul ignore if */
  44247. if (typeof id !== 'string') {
  44248. return
  44249. }
  44250. var assets = options[type];
  44251. // check local registration variations first
  44252. if (hasOwn(assets, id)) { return assets[id] }
  44253. var camelizedId = camelize(id);
  44254. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  44255. var PascalCaseId = capitalize(camelizedId);
  44256. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  44257. // fallback to prototype chain
  44258. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  44259. if (warnMissing && !res) {
  44260. warn(
  44261. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  44262. options
  44263. );
  44264. }
  44265. return res
  44266. }
  44267. /* */
  44268. function validateProp (
  44269. key,
  44270. propOptions,
  44271. propsData,
  44272. vm
  44273. ) {
  44274. var prop = propOptions[key];
  44275. var absent = !hasOwn(propsData, key);
  44276. var value = propsData[key];
  44277. // boolean casting
  44278. var booleanIndex = getTypeIndex(Boolean, prop.type);
  44279. if (booleanIndex > -1) {
  44280. if (absent && !hasOwn(prop, 'default')) {
  44281. value = false;
  44282. } else if (value === '' || value === hyphenate(key)) {
  44283. // only cast empty string / same name to boolean if
  44284. // boolean has higher priority
  44285. var stringIndex = getTypeIndex(String, prop.type);
  44286. if (stringIndex < 0 || booleanIndex < stringIndex) {
  44287. value = true;
  44288. }
  44289. }
  44290. }
  44291. // check default value
  44292. if (value === undefined) {
  44293. value = getPropDefaultValue(vm, prop, key);
  44294. // since the default value is a fresh copy,
  44295. // make sure to observe it.
  44296. var prevShouldObserve = shouldObserve;
  44297. toggleObserving(true);
  44298. observe(value);
  44299. toggleObserving(prevShouldObserve);
  44300. }
  44301. {
  44302. assertProp(prop, key, value, vm, absent);
  44303. }
  44304. return value
  44305. }
  44306. /**
  44307. * Get the default value of a prop.
  44308. */
  44309. function getPropDefaultValue (vm, prop, key) {
  44310. // no default, return undefined
  44311. if (!hasOwn(prop, 'default')) {
  44312. return undefined
  44313. }
  44314. var def = prop.default;
  44315. // warn against non-factory defaults for Object & Array
  44316. if (isObject(def)) {
  44317. warn(
  44318. 'Invalid default value for prop "' + key + '": ' +
  44319. 'Props with type Object/Array must use a factory function ' +
  44320. 'to return the default value.',
  44321. vm
  44322. );
  44323. }
  44324. // the raw prop value was also undefined from previous render,
  44325. // return previous default value to avoid unnecessary watcher trigger
  44326. if (vm && vm.$options.propsData &&
  44327. vm.$options.propsData[key] === undefined &&
  44328. vm._props[key] !== undefined
  44329. ) {
  44330. return vm._props[key]
  44331. }
  44332. // call factory function for non-Function types
  44333. // a value is Function if its prototype is function even across different execution context
  44334. return typeof def === 'function' && getType(prop.type) !== 'Function'
  44335. ? def.call(vm)
  44336. : def
  44337. }
  44338. /**
  44339. * Assert whether a prop is valid.
  44340. */
  44341. function assertProp (
  44342. prop,
  44343. name,
  44344. value,
  44345. vm,
  44346. absent
  44347. ) {
  44348. if (prop.required && absent) {
  44349. warn(
  44350. 'Missing required prop: "' + name + '"',
  44351. vm
  44352. );
  44353. return
  44354. }
  44355. if (value == null && !prop.required) {
  44356. return
  44357. }
  44358. var type = prop.type;
  44359. var valid = !type || type === true;
  44360. var expectedTypes = [];
  44361. if (type) {
  44362. if (!Array.isArray(type)) {
  44363. type = [type];
  44364. }
  44365. for (var i = 0; i < type.length && !valid; i++) {
  44366. var assertedType = assertType(value, type[i]);
  44367. expectedTypes.push(assertedType.expectedType || '');
  44368. valid = assertedType.valid;
  44369. }
  44370. }
  44371. if (!valid) {
  44372. warn(
  44373. getInvalidTypeMessage(name, value, expectedTypes),
  44374. vm
  44375. );
  44376. return
  44377. }
  44378. var validator = prop.validator;
  44379. if (validator) {
  44380. if (!validator(value)) {
  44381. warn(
  44382. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  44383. vm
  44384. );
  44385. }
  44386. }
  44387. }
  44388. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  44389. function assertType (value, type) {
  44390. var valid;
  44391. var expectedType = getType(type);
  44392. if (simpleCheckRE.test(expectedType)) {
  44393. var t = typeof value;
  44394. valid = t === expectedType.toLowerCase();
  44395. // for primitive wrapper objects
  44396. if (!valid && t === 'object') {
  44397. valid = value instanceof type;
  44398. }
  44399. } else if (expectedType === 'Object') {
  44400. valid = isPlainObject(value);
  44401. } else if (expectedType === 'Array') {
  44402. valid = Array.isArray(value);
  44403. } else {
  44404. valid = value instanceof type;
  44405. }
  44406. return {
  44407. valid: valid,
  44408. expectedType: expectedType
  44409. }
  44410. }
  44411. /**
  44412. * Use function string name to check built-in types,
  44413. * because a simple equality check will fail when running
  44414. * across different vms / iframes.
  44415. */
  44416. function getType (fn) {
  44417. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  44418. return match ? match[1] : ''
  44419. }
  44420. function isSameType (a, b) {
  44421. return getType(a) === getType(b)
  44422. }
  44423. function getTypeIndex (type, expectedTypes) {
  44424. if (!Array.isArray(expectedTypes)) {
  44425. return isSameType(expectedTypes, type) ? 0 : -1
  44426. }
  44427. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  44428. if (isSameType(expectedTypes[i], type)) {
  44429. return i
  44430. }
  44431. }
  44432. return -1
  44433. }
  44434. function getInvalidTypeMessage (name, value, expectedTypes) {
  44435. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  44436. " Expected " + (expectedTypes.map(capitalize).join(', '));
  44437. var expectedType = expectedTypes[0];
  44438. var receivedType = toRawType(value);
  44439. var expectedValue = styleValue(value, expectedType);
  44440. var receivedValue = styleValue(value, receivedType);
  44441. // check if we need to specify expected value
  44442. if (expectedTypes.length === 1 &&
  44443. isExplicable(expectedType) &&
  44444. !isBoolean(expectedType, receivedType)) {
  44445. message += " with value " + expectedValue;
  44446. }
  44447. message += ", got " + receivedType + " ";
  44448. // check if we need to specify received value
  44449. if (isExplicable(receivedType)) {
  44450. message += "with value " + receivedValue + ".";
  44451. }
  44452. return message
  44453. }
  44454. function styleValue (value, type) {
  44455. if (type === 'String') {
  44456. return ("\"" + value + "\"")
  44457. } else if (type === 'Number') {
  44458. return ("" + (Number(value)))
  44459. } else {
  44460. return ("" + value)
  44461. }
  44462. }
  44463. function isExplicable (value) {
  44464. var explicitTypes = ['string', 'number', 'boolean'];
  44465. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  44466. }
  44467. function isBoolean () {
  44468. var args = [], len = arguments.length;
  44469. while ( len-- ) args[ len ] = arguments[ len ];
  44470. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  44471. }
  44472. /* */
  44473. function handleError (err, vm, info) {
  44474. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  44475. // See: https://github.com/vuejs/vuex/issues/1505
  44476. pushTarget();
  44477. try {
  44478. if (vm) {
  44479. var cur = vm;
  44480. while ((cur = cur.$parent)) {
  44481. var hooks = cur.$options.errorCaptured;
  44482. if (hooks) {
  44483. for (var i = 0; i < hooks.length; i++) {
  44484. try {
  44485. var capture = hooks[i].call(cur, err, vm, info) === false;
  44486. if (capture) { return }
  44487. } catch (e) {
  44488. globalHandleError(e, cur, 'errorCaptured hook');
  44489. }
  44490. }
  44491. }
  44492. }
  44493. }
  44494. globalHandleError(err, vm, info);
  44495. } finally {
  44496. popTarget();
  44497. }
  44498. }
  44499. function invokeWithErrorHandling (
  44500. handler,
  44501. context,
  44502. args,
  44503. vm,
  44504. info
  44505. ) {
  44506. var res;
  44507. try {
  44508. res = args ? handler.apply(context, args) : handler.call(context);
  44509. if (res && !res._isVue && isPromise(res) && !res._handled) {
  44510. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  44511. // issue #9511
  44512. // avoid catch triggering multiple times when nested calls
  44513. res._handled = true;
  44514. }
  44515. } catch (e) {
  44516. handleError(e, vm, info);
  44517. }
  44518. return res
  44519. }
  44520. function globalHandleError (err, vm, info) {
  44521. if (config.errorHandler) {
  44522. try {
  44523. return config.errorHandler.call(null, err, vm, info)
  44524. } catch (e) {
  44525. // if the user intentionally throws the original error in the handler,
  44526. // do not log it twice
  44527. if (e !== err) {
  44528. logError(e, null, 'config.errorHandler');
  44529. }
  44530. }
  44531. }
  44532. logError(err, vm, info);
  44533. }
  44534. function logError (err, vm, info) {
  44535. {
  44536. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  44537. }
  44538. /* istanbul ignore else */
  44539. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  44540. console.error(err);
  44541. } else {
  44542. throw err
  44543. }
  44544. }
  44545. /* */
  44546. var isUsingMicroTask = false;
  44547. var callbacks = [];
  44548. var pending = false;
  44549. function flushCallbacks () {
  44550. pending = false;
  44551. var copies = callbacks.slice(0);
  44552. callbacks.length = 0;
  44553. for (var i = 0; i < copies.length; i++) {
  44554. copies[i]();
  44555. }
  44556. }
  44557. // Here we have async deferring wrappers using microtasks.
  44558. // In 2.5 we used (macro) tasks (in combination with microtasks).
  44559. // However, it has subtle problems when state is changed right before repaint
  44560. // (e.g. #6813, out-in transitions).
  44561. // Also, using (macro) tasks in event handler would cause some weird behaviors
  44562. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  44563. // So we now use microtasks everywhere, again.
  44564. // A major drawback of this tradeoff is that there are some scenarios
  44565. // where microtasks have too high a priority and fire in between supposedly
  44566. // sequential events (e.g. #4521, #6690, which have workarounds)
  44567. // or even between bubbling of the same event (#6566).
  44568. var timerFunc;
  44569. // The nextTick behavior leverages the microtask queue, which can be accessed
  44570. // via either native Promise.then or MutationObserver.
  44571. // MutationObserver has wider support, however it is seriously bugged in
  44572. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  44573. // completely stops working after triggering a few times... so, if native
  44574. // Promise is available, we will use it:
  44575. /* istanbul ignore next, $flow-disable-line */
  44576. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  44577. var p = Promise.resolve();
  44578. timerFunc = function () {
  44579. p.then(flushCallbacks);
  44580. // In problematic UIWebViews, Promise.then doesn't completely break, but
  44581. // it can get stuck in a weird state where callbacks are pushed into the
  44582. // microtask queue but the queue isn't being flushed, until the browser
  44583. // needs to do some other work, e.g. handle a timer. Therefore we can
  44584. // "force" the microtask queue to be flushed by adding an empty timer.
  44585. if (isIOS) { setTimeout(noop); }
  44586. };
  44587. isUsingMicroTask = true;
  44588. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  44589. isNative(MutationObserver) ||
  44590. // PhantomJS and iOS 7.x
  44591. MutationObserver.toString() === '[object MutationObserverConstructor]'
  44592. )) {
  44593. // Use MutationObserver where native Promise is not available,
  44594. // e.g. PhantomJS, iOS7, Android 4.4
  44595. // (#6466 MutationObserver is unreliable in IE11)
  44596. var counter = 1;
  44597. var observer = new MutationObserver(flushCallbacks);
  44598. var textNode = document.createTextNode(String(counter));
  44599. observer.observe(textNode, {
  44600. characterData: true
  44601. });
  44602. timerFunc = function () {
  44603. counter = (counter + 1) % 2;
  44604. textNode.data = String(counter);
  44605. };
  44606. isUsingMicroTask = true;
  44607. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  44608. // Fallback to setImmediate.
  44609. // Technically it leverages the (macro) task queue,
  44610. // but it is still a better choice than setTimeout.
  44611. timerFunc = function () {
  44612. setImmediate(flushCallbacks);
  44613. };
  44614. } else {
  44615. // Fallback to setTimeout.
  44616. timerFunc = function () {
  44617. setTimeout(flushCallbacks, 0);
  44618. };
  44619. }
  44620. function nextTick (cb, ctx) {
  44621. var _resolve;
  44622. callbacks.push(function () {
  44623. if (cb) {
  44624. try {
  44625. cb.call(ctx);
  44626. } catch (e) {
  44627. handleError(e, ctx, 'nextTick');
  44628. }
  44629. } else if (_resolve) {
  44630. _resolve(ctx);
  44631. }
  44632. });
  44633. if (!pending) {
  44634. pending = true;
  44635. timerFunc();
  44636. }
  44637. // $flow-disable-line
  44638. if (!cb && typeof Promise !== 'undefined') {
  44639. return new Promise(function (resolve) {
  44640. _resolve = resolve;
  44641. })
  44642. }
  44643. }
  44644. /* */
  44645. var mark;
  44646. var measure;
  44647. {
  44648. var perf = inBrowser && window.performance;
  44649. /* istanbul ignore if */
  44650. if (
  44651. perf &&
  44652. perf.mark &&
  44653. perf.measure &&
  44654. perf.clearMarks &&
  44655. perf.clearMeasures
  44656. ) {
  44657. mark = function (tag) { return perf.mark(tag); };
  44658. measure = function (name, startTag, endTag) {
  44659. perf.measure(name, startTag, endTag);
  44660. perf.clearMarks(startTag);
  44661. perf.clearMarks(endTag);
  44662. // perf.clearMeasures(name)
  44663. };
  44664. }
  44665. }
  44666. /* not type checking this file because flow doesn't play well with Proxy */
  44667. var initProxy;
  44668. {
  44669. var allowedGlobals = makeMap(
  44670. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  44671. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  44672. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  44673. 'require' // for Webpack/Browserify
  44674. );
  44675. var warnNonPresent = function (target, key) {
  44676. warn(
  44677. "Property or method \"" + key + "\" is not defined on the instance but " +
  44678. 'referenced during render. Make sure that this property is reactive, ' +
  44679. 'either in the data option, or for class-based components, by ' +
  44680. 'initializing the property. ' +
  44681. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  44682. target
  44683. );
  44684. };
  44685. var warnReservedPrefix = function (target, key) {
  44686. warn(
  44687. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  44688. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  44689. 'prevent conflicts with Vue internals. ' +
  44690. 'See: https://vuejs.org/v2/api/#data',
  44691. target
  44692. );
  44693. };
  44694. var hasProxy =
  44695. typeof Proxy !== 'undefined' && isNative(Proxy);
  44696. if (hasProxy) {
  44697. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  44698. config.keyCodes = new Proxy(config.keyCodes, {
  44699. set: function set (target, key, value) {
  44700. if (isBuiltInModifier(key)) {
  44701. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  44702. return false
  44703. } else {
  44704. target[key] = value;
  44705. return true
  44706. }
  44707. }
  44708. });
  44709. }
  44710. var hasHandler = {
  44711. has: function has (target, key) {
  44712. var has = key in target;
  44713. var isAllowed = allowedGlobals(key) ||
  44714. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  44715. if (!has && !isAllowed) {
  44716. if (key in target.$data) { warnReservedPrefix(target, key); }
  44717. else { warnNonPresent(target, key); }
  44718. }
  44719. return has || !isAllowed
  44720. }
  44721. };
  44722. var getHandler = {
  44723. get: function get (target, key) {
  44724. if (typeof key === 'string' && !(key in target)) {
  44725. if (key in target.$data) { warnReservedPrefix(target, key); }
  44726. else { warnNonPresent(target, key); }
  44727. }
  44728. return target[key]
  44729. }
  44730. };
  44731. initProxy = function initProxy (vm) {
  44732. if (hasProxy) {
  44733. // determine which proxy handler to use
  44734. var options = vm.$options;
  44735. var handlers = options.render && options.render._withStripped
  44736. ? getHandler
  44737. : hasHandler;
  44738. vm._renderProxy = new Proxy(vm, handlers);
  44739. } else {
  44740. vm._renderProxy = vm;
  44741. }
  44742. };
  44743. }
  44744. /* */
  44745. var seenObjects = new _Set();
  44746. /**
  44747. * Recursively traverse an object to evoke all converted
  44748. * getters, so that every nested property inside the object
  44749. * is collected as a "deep" dependency.
  44750. */
  44751. function traverse (val) {
  44752. _traverse(val, seenObjects);
  44753. seenObjects.clear();
  44754. }
  44755. function _traverse (val, seen) {
  44756. var i, keys;
  44757. var isA = Array.isArray(val);
  44758. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  44759. return
  44760. }
  44761. if (val.__ob__) {
  44762. var depId = val.__ob__.dep.id;
  44763. if (seen.has(depId)) {
  44764. return
  44765. }
  44766. seen.add(depId);
  44767. }
  44768. if (isA) {
  44769. i = val.length;
  44770. while (i--) { _traverse(val[i], seen); }
  44771. } else {
  44772. keys = Object.keys(val);
  44773. i = keys.length;
  44774. while (i--) { _traverse(val[keys[i]], seen); }
  44775. }
  44776. }
  44777. /* */
  44778. var normalizeEvent = cached(function (name) {
  44779. var passive = name.charAt(0) === '&';
  44780. name = passive ? name.slice(1) : name;
  44781. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  44782. name = once$$1 ? name.slice(1) : name;
  44783. var capture = name.charAt(0) === '!';
  44784. name = capture ? name.slice(1) : name;
  44785. return {
  44786. name: name,
  44787. once: once$$1,
  44788. capture: capture,
  44789. passive: passive
  44790. }
  44791. });
  44792. function createFnInvoker (fns, vm) {
  44793. function invoker () {
  44794. var arguments$1 = arguments;
  44795. var fns = invoker.fns;
  44796. if (Array.isArray(fns)) {
  44797. var cloned = fns.slice();
  44798. for (var i = 0; i < cloned.length; i++) {
  44799. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  44800. }
  44801. } else {
  44802. // return handler return value for single handlers
  44803. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  44804. }
  44805. }
  44806. invoker.fns = fns;
  44807. return invoker
  44808. }
  44809. function updateListeners (
  44810. on,
  44811. oldOn,
  44812. add,
  44813. remove$$1,
  44814. createOnceHandler,
  44815. vm
  44816. ) {
  44817. var name, def$$1, cur, old, event;
  44818. for (name in on) {
  44819. def$$1 = cur = on[name];
  44820. old = oldOn[name];
  44821. event = normalizeEvent(name);
  44822. if (isUndef(cur)) {
  44823. warn(
  44824. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  44825. vm
  44826. );
  44827. } else if (isUndef(old)) {
  44828. if (isUndef(cur.fns)) {
  44829. cur = on[name] = createFnInvoker(cur, vm);
  44830. }
  44831. if (isTrue(event.once)) {
  44832. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  44833. }
  44834. add(event.name, cur, event.capture, event.passive, event.params);
  44835. } else if (cur !== old) {
  44836. old.fns = cur;
  44837. on[name] = old;
  44838. }
  44839. }
  44840. for (name in oldOn) {
  44841. if (isUndef(on[name])) {
  44842. event = normalizeEvent(name);
  44843. remove$$1(event.name, oldOn[name], event.capture);
  44844. }
  44845. }
  44846. }
  44847. /* */
  44848. function mergeVNodeHook (def, hookKey, hook) {
  44849. if (def instanceof VNode) {
  44850. def = def.data.hook || (def.data.hook = {});
  44851. }
  44852. var invoker;
  44853. var oldHook = def[hookKey];
  44854. function wrappedHook () {
  44855. hook.apply(this, arguments);
  44856. // important: remove merged hook to ensure it's called only once
  44857. // and prevent memory leak
  44858. remove(invoker.fns, wrappedHook);
  44859. }
  44860. if (isUndef(oldHook)) {
  44861. // no existing hook
  44862. invoker = createFnInvoker([wrappedHook]);
  44863. } else {
  44864. /* istanbul ignore if */
  44865. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  44866. // already a merged invoker
  44867. invoker = oldHook;
  44868. invoker.fns.push(wrappedHook);
  44869. } else {
  44870. // existing plain hook
  44871. invoker = createFnInvoker([oldHook, wrappedHook]);
  44872. }
  44873. }
  44874. invoker.merged = true;
  44875. def[hookKey] = invoker;
  44876. }
  44877. /* */
  44878. function extractPropsFromVNodeData (
  44879. data,
  44880. Ctor,
  44881. tag
  44882. ) {
  44883. // we are only extracting raw values here.
  44884. // validation and default values are handled in the child
  44885. // component itself.
  44886. var propOptions = Ctor.options.props;
  44887. if (isUndef(propOptions)) {
  44888. return
  44889. }
  44890. var res = {};
  44891. var attrs = data.attrs;
  44892. var props = data.props;
  44893. if (isDef(attrs) || isDef(props)) {
  44894. for (var key in propOptions) {
  44895. var altKey = hyphenate(key);
  44896. {
  44897. var keyInLowerCase = key.toLowerCase();
  44898. if (
  44899. key !== keyInLowerCase &&
  44900. attrs && hasOwn(attrs, keyInLowerCase)
  44901. ) {
  44902. tip(
  44903. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  44904. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  44905. " \"" + key + "\". " +
  44906. "Note that HTML attributes are case-insensitive and camelCased " +
  44907. "props need to use their kebab-case equivalents when using in-DOM " +
  44908. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  44909. );
  44910. }
  44911. }
  44912. checkProp(res, props, key, altKey, true) ||
  44913. checkProp(res, attrs, key, altKey, false);
  44914. }
  44915. }
  44916. return res
  44917. }
  44918. function checkProp (
  44919. res,
  44920. hash,
  44921. key,
  44922. altKey,
  44923. preserve
  44924. ) {
  44925. if (isDef(hash)) {
  44926. if (hasOwn(hash, key)) {
  44927. res[key] = hash[key];
  44928. if (!preserve) {
  44929. delete hash[key];
  44930. }
  44931. return true
  44932. } else if (hasOwn(hash, altKey)) {
  44933. res[key] = hash[altKey];
  44934. if (!preserve) {
  44935. delete hash[altKey];
  44936. }
  44937. return true
  44938. }
  44939. }
  44940. return false
  44941. }
  44942. /* */
  44943. // The template compiler attempts to minimize the need for normalization by
  44944. // statically analyzing the template at compile time.
  44945. //
  44946. // For plain HTML markup, normalization can be completely skipped because the
  44947. // generated render function is guaranteed to return Array<VNode>. There are
  44948. // two cases where extra normalization is needed:
  44949. // 1. When the children contains components - because a functional component
  44950. // may return an Array instead of a single root. In this case, just a simple
  44951. // normalization is needed - if any child is an Array, we flatten the whole
  44952. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  44953. // because functional components already normalize their own children.
  44954. function simpleNormalizeChildren (children) {
  44955. for (var i = 0; i < children.length; i++) {
  44956. if (Array.isArray(children[i])) {
  44957. return Array.prototype.concat.apply([], children)
  44958. }
  44959. }
  44960. return children
  44961. }
  44962. // 2. When the children contains constructs that always generated nested Arrays,
  44963. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  44964. // with hand-written render functions / JSX. In such cases a full normalization
  44965. // is needed to cater to all possible types of children values.
  44966. function normalizeChildren (children) {
  44967. return isPrimitive(children)
  44968. ? [createTextVNode(children)]
  44969. : Array.isArray(children)
  44970. ? normalizeArrayChildren(children)
  44971. : undefined
  44972. }
  44973. function isTextNode (node) {
  44974. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  44975. }
  44976. function normalizeArrayChildren (children, nestedIndex) {
  44977. var res = [];
  44978. var i, c, lastIndex, last;
  44979. for (i = 0; i < children.length; i++) {
  44980. c = children[i];
  44981. if (isUndef(c) || typeof c === 'boolean') { continue }
  44982. lastIndex = res.length - 1;
  44983. last = res[lastIndex];
  44984. // nested
  44985. if (Array.isArray(c)) {
  44986. if (c.length > 0) {
  44987. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  44988. // merge adjacent text nodes
  44989. if (isTextNode(c[0]) && isTextNode(last)) {
  44990. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  44991. c.shift();
  44992. }
  44993. res.push.apply(res, c);
  44994. }
  44995. } else if (isPrimitive(c)) {
  44996. if (isTextNode(last)) {
  44997. // merge adjacent text nodes
  44998. // this is necessary for SSR hydration because text nodes are
  44999. // essentially merged when rendered to HTML strings
  45000. res[lastIndex] = createTextVNode(last.text + c);
  45001. } else if (c !== '') {
  45002. // convert primitive to vnode
  45003. res.push(createTextVNode(c));
  45004. }
  45005. } else {
  45006. if (isTextNode(c) && isTextNode(last)) {
  45007. // merge adjacent text nodes
  45008. res[lastIndex] = createTextVNode(last.text + c.text);
  45009. } else {
  45010. // default key for nested array children (likely generated by v-for)
  45011. if (isTrue(children._isVList) &&
  45012. isDef(c.tag) &&
  45013. isUndef(c.key) &&
  45014. isDef(nestedIndex)) {
  45015. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  45016. }
  45017. res.push(c);
  45018. }
  45019. }
  45020. }
  45021. return res
  45022. }
  45023. /* */
  45024. function initProvide (vm) {
  45025. var provide = vm.$options.provide;
  45026. if (provide) {
  45027. vm._provided = typeof provide === 'function'
  45028. ? provide.call(vm)
  45029. : provide;
  45030. }
  45031. }
  45032. function initInjections (vm) {
  45033. var result = resolveInject(vm.$options.inject, vm);
  45034. if (result) {
  45035. toggleObserving(false);
  45036. Object.keys(result).forEach(function (key) {
  45037. /* istanbul ignore else */
  45038. {
  45039. defineReactive$$1(vm, key, result[key], function () {
  45040. warn(
  45041. "Avoid mutating an injected value directly since the changes will be " +
  45042. "overwritten whenever the provided component re-renders. " +
  45043. "injection being mutated: \"" + key + "\"",
  45044. vm
  45045. );
  45046. });
  45047. }
  45048. });
  45049. toggleObserving(true);
  45050. }
  45051. }
  45052. function resolveInject (inject, vm) {
  45053. if (inject) {
  45054. // inject is :any because flow is not smart enough to figure out cached
  45055. var result = Object.create(null);
  45056. var keys = hasSymbol
  45057. ? Reflect.ownKeys(inject)
  45058. : Object.keys(inject);
  45059. for (var i = 0; i < keys.length; i++) {
  45060. var key = keys[i];
  45061. // #6574 in case the inject object is observed...
  45062. if (key === '__ob__') { continue }
  45063. var provideKey = inject[key].from;
  45064. var source = vm;
  45065. while (source) {
  45066. if (source._provided && hasOwn(source._provided, provideKey)) {
  45067. result[key] = source._provided[provideKey];
  45068. break
  45069. }
  45070. source = source.$parent;
  45071. }
  45072. if (!source) {
  45073. if ('default' in inject[key]) {
  45074. var provideDefault = inject[key].default;
  45075. result[key] = typeof provideDefault === 'function'
  45076. ? provideDefault.call(vm)
  45077. : provideDefault;
  45078. } else {
  45079. warn(("Injection \"" + key + "\" not found"), vm);
  45080. }
  45081. }
  45082. }
  45083. return result
  45084. }
  45085. }
  45086. /* */
  45087. /**
  45088. * Runtime helper for resolving raw children VNodes into a slot object.
  45089. */
  45090. function resolveSlots (
  45091. children,
  45092. context
  45093. ) {
  45094. if (!children || !children.length) {
  45095. return {}
  45096. }
  45097. var slots = {};
  45098. for (var i = 0, l = children.length; i < l; i++) {
  45099. var child = children[i];
  45100. var data = child.data;
  45101. // remove slot attribute if the node is resolved as a Vue slot node
  45102. if (data && data.attrs && data.attrs.slot) {
  45103. delete data.attrs.slot;
  45104. }
  45105. // named slots should only be respected if the vnode was rendered in the
  45106. // same context.
  45107. if ((child.context === context || child.fnContext === context) &&
  45108. data && data.slot != null
  45109. ) {
  45110. var name = data.slot;
  45111. var slot = (slots[name] || (slots[name] = []));
  45112. if (child.tag === 'template') {
  45113. slot.push.apply(slot, child.children || []);
  45114. } else {
  45115. slot.push(child);
  45116. }
  45117. } else {
  45118. (slots.default || (slots.default = [])).push(child);
  45119. }
  45120. }
  45121. // ignore slots that contains only whitespace
  45122. for (var name$1 in slots) {
  45123. if (slots[name$1].every(isWhitespace)) {
  45124. delete slots[name$1];
  45125. }
  45126. }
  45127. return slots
  45128. }
  45129. function isWhitespace (node) {
  45130. return (node.isComment && !node.asyncFactory) || node.text === ' '
  45131. }
  45132. /* */
  45133. function normalizeScopedSlots (
  45134. slots,
  45135. normalSlots,
  45136. prevSlots
  45137. ) {
  45138. var res;
  45139. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  45140. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  45141. var key = slots && slots.$key;
  45142. if (!slots) {
  45143. res = {};
  45144. } else if (slots._normalized) {
  45145. // fast path 1: child component re-render only, parent did not change
  45146. return slots._normalized
  45147. } else if (
  45148. isStable &&
  45149. prevSlots &&
  45150. prevSlots !== emptyObject &&
  45151. key === prevSlots.$key &&
  45152. !hasNormalSlots &&
  45153. !prevSlots.$hasNormal
  45154. ) {
  45155. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  45156. // only need to normalize once
  45157. return prevSlots
  45158. } else {
  45159. res = {};
  45160. for (var key$1 in slots) {
  45161. if (slots[key$1] && key$1[0] !== '$') {
  45162. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  45163. }
  45164. }
  45165. }
  45166. // expose normal slots on scopedSlots
  45167. for (var key$2 in normalSlots) {
  45168. if (!(key$2 in res)) {
  45169. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  45170. }
  45171. }
  45172. // avoriaz seems to mock a non-extensible $scopedSlots object
  45173. // and when that is passed down this would cause an error
  45174. if (slots && Object.isExtensible(slots)) {
  45175. (slots)._normalized = res;
  45176. }
  45177. def(res, '$stable', isStable);
  45178. def(res, '$key', key);
  45179. def(res, '$hasNormal', hasNormalSlots);
  45180. return res
  45181. }
  45182. function normalizeScopedSlot(normalSlots, key, fn) {
  45183. var normalized = function () {
  45184. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  45185. res = res && typeof res === 'object' && !Array.isArray(res)
  45186. ? [res] // single vnode
  45187. : normalizeChildren(res);
  45188. return res && (
  45189. res.length === 0 ||
  45190. (res.length === 1 && res[0].isComment) // #9658
  45191. ) ? undefined
  45192. : res
  45193. };
  45194. // this is a slot using the new v-slot syntax without scope. although it is
  45195. // compiled as a scoped slot, render fn users would expect it to be present
  45196. // on this.$slots because the usage is semantically a normal slot.
  45197. if (fn.proxy) {
  45198. Object.defineProperty(normalSlots, key, {
  45199. get: normalized,
  45200. enumerable: true,
  45201. configurable: true
  45202. });
  45203. }
  45204. return normalized
  45205. }
  45206. function proxyNormalSlot(slots, key) {
  45207. return function () { return slots[key]; }
  45208. }
  45209. /* */
  45210. /**
  45211. * Runtime helper for rendering v-for lists.
  45212. */
  45213. function renderList (
  45214. val,
  45215. render
  45216. ) {
  45217. var ret, i, l, keys, key;
  45218. if (Array.isArray(val) || typeof val === 'string') {
  45219. ret = new Array(val.length);
  45220. for (i = 0, l = val.length; i < l; i++) {
  45221. ret[i] = render(val[i], i);
  45222. }
  45223. } else if (typeof val === 'number') {
  45224. ret = new Array(val);
  45225. for (i = 0; i < val; i++) {
  45226. ret[i] = render(i + 1, i);
  45227. }
  45228. } else if (isObject(val)) {
  45229. if (hasSymbol && val[Symbol.iterator]) {
  45230. ret = [];
  45231. var iterator = val[Symbol.iterator]();
  45232. var result = iterator.next();
  45233. while (!result.done) {
  45234. ret.push(render(result.value, ret.length));
  45235. result = iterator.next();
  45236. }
  45237. } else {
  45238. keys = Object.keys(val);
  45239. ret = new Array(keys.length);
  45240. for (i = 0, l = keys.length; i < l; i++) {
  45241. key = keys[i];
  45242. ret[i] = render(val[key], key, i);
  45243. }
  45244. }
  45245. }
  45246. if (!isDef(ret)) {
  45247. ret = [];
  45248. }
  45249. (ret)._isVList = true;
  45250. return ret
  45251. }
  45252. /* */
  45253. /**
  45254. * Runtime helper for rendering <slot>
  45255. */
  45256. function renderSlot (
  45257. name,
  45258. fallback,
  45259. props,
  45260. bindObject
  45261. ) {
  45262. var scopedSlotFn = this.$scopedSlots[name];
  45263. var nodes;
  45264. if (scopedSlotFn) { // scoped slot
  45265. props = props || {};
  45266. if (bindObject) {
  45267. if (!isObject(bindObject)) {
  45268. warn(
  45269. 'slot v-bind without argument expects an Object',
  45270. this
  45271. );
  45272. }
  45273. props = extend(extend({}, bindObject), props);
  45274. }
  45275. nodes = scopedSlotFn(props) || fallback;
  45276. } else {
  45277. nodes = this.$slots[name] || fallback;
  45278. }
  45279. var target = props && props.slot;
  45280. if (target) {
  45281. return this.$createElement('template', { slot: target }, nodes)
  45282. } else {
  45283. return nodes
  45284. }
  45285. }
  45286. /* */
  45287. /**
  45288. * Runtime helper for resolving filters
  45289. */
  45290. function resolveFilter (id) {
  45291. return resolveAsset(this.$options, 'filters', id, true) || identity
  45292. }
  45293. /* */
  45294. function isKeyNotMatch (expect, actual) {
  45295. if (Array.isArray(expect)) {
  45296. return expect.indexOf(actual) === -1
  45297. } else {
  45298. return expect !== actual
  45299. }
  45300. }
  45301. /**
  45302. * Runtime helper for checking keyCodes from config.
  45303. * exposed as Vue.prototype._k
  45304. * passing in eventKeyName as last argument separately for backwards compat
  45305. */
  45306. function checkKeyCodes (
  45307. eventKeyCode,
  45308. key,
  45309. builtInKeyCode,
  45310. eventKeyName,
  45311. builtInKeyName
  45312. ) {
  45313. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  45314. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  45315. return isKeyNotMatch(builtInKeyName, eventKeyName)
  45316. } else if (mappedKeyCode) {
  45317. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  45318. } else if (eventKeyName) {
  45319. return hyphenate(eventKeyName) !== key
  45320. }
  45321. }
  45322. /* */
  45323. /**
  45324. * Runtime helper for merging v-bind="object" into a VNode's data.
  45325. */
  45326. function bindObjectProps (
  45327. data,
  45328. tag,
  45329. value,
  45330. asProp,
  45331. isSync
  45332. ) {
  45333. if (value) {
  45334. if (!isObject(value)) {
  45335. warn(
  45336. 'v-bind without argument expects an Object or Array value',
  45337. this
  45338. );
  45339. } else {
  45340. if (Array.isArray(value)) {
  45341. value = toObject(value);
  45342. }
  45343. var hash;
  45344. var loop = function ( key ) {
  45345. if (
  45346. key === 'class' ||
  45347. key === 'style' ||
  45348. isReservedAttribute(key)
  45349. ) {
  45350. hash = data;
  45351. } else {
  45352. var type = data.attrs && data.attrs.type;
  45353. hash = asProp || config.mustUseProp(tag, type, key)
  45354. ? data.domProps || (data.domProps = {})
  45355. : data.attrs || (data.attrs = {});
  45356. }
  45357. var camelizedKey = camelize(key);
  45358. var hyphenatedKey = hyphenate(key);
  45359. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  45360. hash[key] = value[key];
  45361. if (isSync) {
  45362. var on = data.on || (data.on = {});
  45363. on[("update:" + key)] = function ($event) {
  45364. value[key] = $event;
  45365. };
  45366. }
  45367. }
  45368. };
  45369. for (var key in value) loop( key );
  45370. }
  45371. }
  45372. return data
  45373. }
  45374. /* */
  45375. /**
  45376. * Runtime helper for rendering static trees.
  45377. */
  45378. function renderStatic (
  45379. index,
  45380. isInFor
  45381. ) {
  45382. var cached = this._staticTrees || (this._staticTrees = []);
  45383. var tree = cached[index];
  45384. // if has already-rendered static tree and not inside v-for,
  45385. // we can reuse the same tree.
  45386. if (tree && !isInFor) {
  45387. return tree
  45388. }
  45389. // otherwise, render a fresh tree.
  45390. tree = cached[index] = this.$options.staticRenderFns[index].call(
  45391. this._renderProxy,
  45392. null,
  45393. this // for render fns generated for functional component templates
  45394. );
  45395. markStatic(tree, ("__static__" + index), false);
  45396. return tree
  45397. }
  45398. /**
  45399. * Runtime helper for v-once.
  45400. * Effectively it means marking the node as static with a unique key.
  45401. */
  45402. function markOnce (
  45403. tree,
  45404. index,
  45405. key
  45406. ) {
  45407. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  45408. return tree
  45409. }
  45410. function markStatic (
  45411. tree,
  45412. key,
  45413. isOnce
  45414. ) {
  45415. if (Array.isArray(tree)) {
  45416. for (var i = 0; i < tree.length; i++) {
  45417. if (tree[i] && typeof tree[i] !== 'string') {
  45418. markStaticNode(tree[i], (key + "_" + i), isOnce);
  45419. }
  45420. }
  45421. } else {
  45422. markStaticNode(tree, key, isOnce);
  45423. }
  45424. }
  45425. function markStaticNode (node, key, isOnce) {
  45426. node.isStatic = true;
  45427. node.key = key;
  45428. node.isOnce = isOnce;
  45429. }
  45430. /* */
  45431. function bindObjectListeners (data, value) {
  45432. if (value) {
  45433. if (!isPlainObject(value)) {
  45434. warn(
  45435. 'v-on without argument expects an Object value',
  45436. this
  45437. );
  45438. } else {
  45439. var on = data.on = data.on ? extend({}, data.on) : {};
  45440. for (var key in value) {
  45441. var existing = on[key];
  45442. var ours = value[key];
  45443. on[key] = existing ? [].concat(existing, ours) : ours;
  45444. }
  45445. }
  45446. }
  45447. return data
  45448. }
  45449. /* */
  45450. function resolveScopedSlots (
  45451. fns, // see flow/vnode
  45452. res,
  45453. // the following are added in 2.6
  45454. hasDynamicKeys,
  45455. contentHashKey
  45456. ) {
  45457. res = res || { $stable: !hasDynamicKeys };
  45458. for (var i = 0; i < fns.length; i++) {
  45459. var slot = fns[i];
  45460. if (Array.isArray(slot)) {
  45461. resolveScopedSlots(slot, res, hasDynamicKeys);
  45462. } else if (slot) {
  45463. // marker for reverse proxying v-slot without scope on this.$slots
  45464. if (slot.proxy) {
  45465. slot.fn.proxy = true;
  45466. }
  45467. res[slot.key] = slot.fn;
  45468. }
  45469. }
  45470. if (contentHashKey) {
  45471. (res).$key = contentHashKey;
  45472. }
  45473. return res
  45474. }
  45475. /* */
  45476. function bindDynamicKeys (baseObj, values) {
  45477. for (var i = 0; i < values.length; i += 2) {
  45478. var key = values[i];
  45479. if (typeof key === 'string' && key) {
  45480. baseObj[values[i]] = values[i + 1];
  45481. } else if (key !== '' && key !== null) {
  45482. // null is a special value for explicitly removing a binding
  45483. warn(
  45484. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  45485. this
  45486. );
  45487. }
  45488. }
  45489. return baseObj
  45490. }
  45491. // helper to dynamically append modifier runtime markers to event names.
  45492. // ensure only append when value is already string, otherwise it will be cast
  45493. // to string and cause the type check to miss.
  45494. function prependModifier (value, symbol) {
  45495. return typeof value === 'string' ? symbol + value : value
  45496. }
  45497. /* */
  45498. function installRenderHelpers (target) {
  45499. target._o = markOnce;
  45500. target._n = toNumber;
  45501. target._s = toString;
  45502. target._l = renderList;
  45503. target._t = renderSlot;
  45504. target._q = looseEqual;
  45505. target._i = looseIndexOf;
  45506. target._m = renderStatic;
  45507. target._f = resolveFilter;
  45508. target._k = checkKeyCodes;
  45509. target._b = bindObjectProps;
  45510. target._v = createTextVNode;
  45511. target._e = createEmptyVNode;
  45512. target._u = resolveScopedSlots;
  45513. target._g = bindObjectListeners;
  45514. target._d = bindDynamicKeys;
  45515. target._p = prependModifier;
  45516. }
  45517. /* */
  45518. function FunctionalRenderContext (
  45519. data,
  45520. props,
  45521. children,
  45522. parent,
  45523. Ctor
  45524. ) {
  45525. var this$1 = this;
  45526. var options = Ctor.options;
  45527. // ensure the createElement function in functional components
  45528. // gets a unique context - this is necessary for correct named slot check
  45529. var contextVm;
  45530. if (hasOwn(parent, '_uid')) {
  45531. contextVm = Object.create(parent);
  45532. // $flow-disable-line
  45533. contextVm._original = parent;
  45534. } else {
  45535. // the context vm passed in is a functional context as well.
  45536. // in this case we want to make sure we are able to get a hold to the
  45537. // real context instance.
  45538. contextVm = parent;
  45539. // $flow-disable-line
  45540. parent = parent._original;
  45541. }
  45542. var isCompiled = isTrue(options._compiled);
  45543. var needNormalization = !isCompiled;
  45544. this.data = data;
  45545. this.props = props;
  45546. this.children = children;
  45547. this.parent = parent;
  45548. this.listeners = data.on || emptyObject;
  45549. this.injections = resolveInject(options.inject, parent);
  45550. this.slots = function () {
  45551. if (!this$1.$slots) {
  45552. normalizeScopedSlots(
  45553. data.scopedSlots,
  45554. this$1.$slots = resolveSlots(children, parent)
  45555. );
  45556. }
  45557. return this$1.$slots
  45558. };
  45559. Object.defineProperty(this, 'scopedSlots', ({
  45560. enumerable: true,
  45561. get: function get () {
  45562. return normalizeScopedSlots(data.scopedSlots, this.slots())
  45563. }
  45564. }));
  45565. // support for compiled functional template
  45566. if (isCompiled) {
  45567. // exposing $options for renderStatic()
  45568. this.$options = options;
  45569. // pre-resolve slots for renderSlot()
  45570. this.$slots = this.slots();
  45571. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  45572. }
  45573. if (options._scopeId) {
  45574. this._c = function (a, b, c, d) {
  45575. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  45576. if (vnode && !Array.isArray(vnode)) {
  45577. vnode.fnScopeId = options._scopeId;
  45578. vnode.fnContext = parent;
  45579. }
  45580. return vnode
  45581. };
  45582. } else {
  45583. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  45584. }
  45585. }
  45586. installRenderHelpers(FunctionalRenderContext.prototype);
  45587. function createFunctionalComponent (
  45588. Ctor,
  45589. propsData,
  45590. data,
  45591. contextVm,
  45592. children
  45593. ) {
  45594. var options = Ctor.options;
  45595. var props = {};
  45596. var propOptions = options.props;
  45597. if (isDef(propOptions)) {
  45598. for (var key in propOptions) {
  45599. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  45600. }
  45601. } else {
  45602. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  45603. if (isDef(data.props)) { mergeProps(props, data.props); }
  45604. }
  45605. var renderContext = new FunctionalRenderContext(
  45606. data,
  45607. props,
  45608. children,
  45609. contextVm,
  45610. Ctor
  45611. );
  45612. var vnode = options.render.call(null, renderContext._c, renderContext);
  45613. if (vnode instanceof VNode) {
  45614. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  45615. } else if (Array.isArray(vnode)) {
  45616. var vnodes = normalizeChildren(vnode) || [];
  45617. var res = new Array(vnodes.length);
  45618. for (var i = 0; i < vnodes.length; i++) {
  45619. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  45620. }
  45621. return res
  45622. }
  45623. }
  45624. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  45625. // #7817 clone node before setting fnContext, otherwise if the node is reused
  45626. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  45627. // that should not be matched to match.
  45628. var clone = cloneVNode(vnode);
  45629. clone.fnContext = contextVm;
  45630. clone.fnOptions = options;
  45631. {
  45632. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  45633. }
  45634. if (data.slot) {
  45635. (clone.data || (clone.data = {})).slot = data.slot;
  45636. }
  45637. return clone
  45638. }
  45639. function mergeProps (to, from) {
  45640. for (var key in from) {
  45641. to[camelize(key)] = from[key];
  45642. }
  45643. }
  45644. /* */
  45645. /* */
  45646. /* */
  45647. /* */
  45648. // inline hooks to be invoked on component VNodes during patch
  45649. var componentVNodeHooks = {
  45650. init: function init (vnode, hydrating) {
  45651. if (
  45652. vnode.componentInstance &&
  45653. !vnode.componentInstance._isDestroyed &&
  45654. vnode.data.keepAlive
  45655. ) {
  45656. // kept-alive components, treat as a patch
  45657. var mountedNode = vnode; // work around flow
  45658. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  45659. } else {
  45660. var child = vnode.componentInstance = createComponentInstanceForVnode(
  45661. vnode,
  45662. activeInstance
  45663. );
  45664. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  45665. }
  45666. },
  45667. prepatch: function prepatch (oldVnode, vnode) {
  45668. var options = vnode.componentOptions;
  45669. var child = vnode.componentInstance = oldVnode.componentInstance;
  45670. updateChildComponent(
  45671. child,
  45672. options.propsData, // updated props
  45673. options.listeners, // updated listeners
  45674. vnode, // new parent vnode
  45675. options.children // new children
  45676. );
  45677. },
  45678. insert: function insert (vnode) {
  45679. var context = vnode.context;
  45680. var componentInstance = vnode.componentInstance;
  45681. if (!componentInstance._isMounted) {
  45682. componentInstance._isMounted = true;
  45683. callHook(componentInstance, 'mounted');
  45684. }
  45685. if (vnode.data.keepAlive) {
  45686. if (context._isMounted) {
  45687. // vue-router#1212
  45688. // During updates, a kept-alive component's child components may
  45689. // change, so directly walking the tree here may call activated hooks
  45690. // on incorrect children. Instead we push them into a queue which will
  45691. // be processed after the whole patch process ended.
  45692. queueActivatedComponent(componentInstance);
  45693. } else {
  45694. activateChildComponent(componentInstance, true /* direct */);
  45695. }
  45696. }
  45697. },
  45698. destroy: function destroy (vnode) {
  45699. var componentInstance = vnode.componentInstance;
  45700. if (!componentInstance._isDestroyed) {
  45701. if (!vnode.data.keepAlive) {
  45702. componentInstance.$destroy();
  45703. } else {
  45704. deactivateChildComponent(componentInstance, true /* direct */);
  45705. }
  45706. }
  45707. }
  45708. };
  45709. var hooksToMerge = Object.keys(componentVNodeHooks);
  45710. function createComponent (
  45711. Ctor,
  45712. data,
  45713. context,
  45714. children,
  45715. tag
  45716. ) {
  45717. if (isUndef(Ctor)) {
  45718. return
  45719. }
  45720. var baseCtor = context.$options._base;
  45721. // plain options object: turn it into a constructor
  45722. if (isObject(Ctor)) {
  45723. Ctor = baseCtor.extend(Ctor);
  45724. }
  45725. // if at this stage it's not a constructor or an async component factory,
  45726. // reject.
  45727. if (typeof Ctor !== 'function') {
  45728. {
  45729. warn(("Invalid Component definition: " + (String(Ctor))), context);
  45730. }
  45731. return
  45732. }
  45733. // async component
  45734. var asyncFactory;
  45735. if (isUndef(Ctor.cid)) {
  45736. asyncFactory = Ctor;
  45737. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  45738. if (Ctor === undefined) {
  45739. // return a placeholder node for async component, which is rendered
  45740. // as a comment node but preserves all the raw information for the node.
  45741. // the information will be used for async server-rendering and hydration.
  45742. return createAsyncPlaceholder(
  45743. asyncFactory,
  45744. data,
  45745. context,
  45746. children,
  45747. tag
  45748. )
  45749. }
  45750. }
  45751. data = data || {};
  45752. // resolve constructor options in case global mixins are applied after
  45753. // component constructor creation
  45754. resolveConstructorOptions(Ctor);
  45755. // transform component v-model data into props & events
  45756. if (isDef(data.model)) {
  45757. transformModel(Ctor.options, data);
  45758. }
  45759. // extract props
  45760. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  45761. // functional component
  45762. if (isTrue(Ctor.options.functional)) {
  45763. return createFunctionalComponent(Ctor, propsData, data, context, children)
  45764. }
  45765. // extract listeners, since these needs to be treated as
  45766. // child component listeners instead of DOM listeners
  45767. var listeners = data.on;
  45768. // replace with listeners with .native modifier
  45769. // so it gets processed during parent component patch.
  45770. data.on = data.nativeOn;
  45771. if (isTrue(Ctor.options.abstract)) {
  45772. // abstract components do not keep anything
  45773. // other than props & listeners & slot
  45774. // work around flow
  45775. var slot = data.slot;
  45776. data = {};
  45777. if (slot) {
  45778. data.slot = slot;
  45779. }
  45780. }
  45781. // install component management hooks onto the placeholder node
  45782. installComponentHooks(data);
  45783. // return a placeholder vnode
  45784. var name = Ctor.options.name || tag;
  45785. var vnode = new VNode(
  45786. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  45787. data, undefined, undefined, undefined, context,
  45788. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  45789. asyncFactory
  45790. );
  45791. return vnode
  45792. }
  45793. function createComponentInstanceForVnode (
  45794. vnode, // we know it's MountedComponentVNode but flow doesn't
  45795. parent // activeInstance in lifecycle state
  45796. ) {
  45797. var options = {
  45798. _isComponent: true,
  45799. _parentVnode: vnode,
  45800. parent: parent
  45801. };
  45802. // check inline-template render functions
  45803. var inlineTemplate = vnode.data.inlineTemplate;
  45804. if (isDef(inlineTemplate)) {
  45805. options.render = inlineTemplate.render;
  45806. options.staticRenderFns = inlineTemplate.staticRenderFns;
  45807. }
  45808. return new vnode.componentOptions.Ctor(options)
  45809. }
  45810. function installComponentHooks (data) {
  45811. var hooks = data.hook || (data.hook = {});
  45812. for (var i = 0; i < hooksToMerge.length; i++) {
  45813. var key = hooksToMerge[i];
  45814. var existing = hooks[key];
  45815. var toMerge = componentVNodeHooks[key];
  45816. if (existing !== toMerge && !(existing && existing._merged)) {
  45817. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  45818. }
  45819. }
  45820. }
  45821. function mergeHook$1 (f1, f2) {
  45822. var merged = function (a, b) {
  45823. // flow complains about extra args which is why we use any
  45824. f1(a, b);
  45825. f2(a, b);
  45826. };
  45827. merged._merged = true;
  45828. return merged
  45829. }
  45830. // transform component v-model info (value and callback) into
  45831. // prop and event handler respectively.
  45832. function transformModel (options, data) {
  45833. var prop = (options.model && options.model.prop) || 'value';
  45834. var event = (options.model && options.model.event) || 'input'
  45835. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  45836. var on = data.on || (data.on = {});
  45837. var existing = on[event];
  45838. var callback = data.model.callback;
  45839. if (isDef(existing)) {
  45840. if (
  45841. Array.isArray(existing)
  45842. ? existing.indexOf(callback) === -1
  45843. : existing !== callback
  45844. ) {
  45845. on[event] = [callback].concat(existing);
  45846. }
  45847. } else {
  45848. on[event] = callback;
  45849. }
  45850. }
  45851. /* */
  45852. var SIMPLE_NORMALIZE = 1;
  45853. var ALWAYS_NORMALIZE = 2;
  45854. // wrapper function for providing a more flexible interface
  45855. // without getting yelled at by flow
  45856. function createElement (
  45857. context,
  45858. tag,
  45859. data,
  45860. children,
  45861. normalizationType,
  45862. alwaysNormalize
  45863. ) {
  45864. if (Array.isArray(data) || isPrimitive(data)) {
  45865. normalizationType = children;
  45866. children = data;
  45867. data = undefined;
  45868. }
  45869. if (isTrue(alwaysNormalize)) {
  45870. normalizationType = ALWAYS_NORMALIZE;
  45871. }
  45872. return _createElement(context, tag, data, children, normalizationType)
  45873. }
  45874. function _createElement (
  45875. context,
  45876. tag,
  45877. data,
  45878. children,
  45879. normalizationType
  45880. ) {
  45881. if (isDef(data) && isDef((data).__ob__)) {
  45882. warn(
  45883. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  45884. 'Always create fresh vnode data objects in each render!',
  45885. context
  45886. );
  45887. return createEmptyVNode()
  45888. }
  45889. // object syntax in v-bind
  45890. if (isDef(data) && isDef(data.is)) {
  45891. tag = data.is;
  45892. }
  45893. if (!tag) {
  45894. // in case of component :is set to falsy value
  45895. return createEmptyVNode()
  45896. }
  45897. // warn against non-primitive key
  45898. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  45899. ) {
  45900. {
  45901. warn(
  45902. 'Avoid using non-primitive value as key, ' +
  45903. 'use string/number value instead.',
  45904. context
  45905. );
  45906. }
  45907. }
  45908. // support single function children as default scoped slot
  45909. if (Array.isArray(children) &&
  45910. typeof children[0] === 'function'
  45911. ) {
  45912. data = data || {};
  45913. data.scopedSlots = { default: children[0] };
  45914. children.length = 0;
  45915. }
  45916. if (normalizationType === ALWAYS_NORMALIZE) {
  45917. children = normalizeChildren(children);
  45918. } else if (normalizationType === SIMPLE_NORMALIZE) {
  45919. children = simpleNormalizeChildren(children);
  45920. }
  45921. var vnode, ns;
  45922. if (typeof tag === 'string') {
  45923. var Ctor;
  45924. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  45925. if (config.isReservedTag(tag)) {
  45926. // platform built-in elements
  45927. if (isDef(data) && isDef(data.nativeOn)) {
  45928. warn(
  45929. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  45930. context
  45931. );
  45932. }
  45933. vnode = new VNode(
  45934. config.parsePlatformTagName(tag), data, children,
  45935. undefined, undefined, context
  45936. );
  45937. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  45938. // component
  45939. vnode = createComponent(Ctor, data, context, children, tag);
  45940. } else {
  45941. // unknown or unlisted namespaced elements
  45942. // check at runtime because it may get assigned a namespace when its
  45943. // parent normalizes children
  45944. vnode = new VNode(
  45945. tag, data, children,
  45946. undefined, undefined, context
  45947. );
  45948. }
  45949. } else {
  45950. // direct component options / constructor
  45951. vnode = createComponent(tag, data, context, children);
  45952. }
  45953. if (Array.isArray(vnode)) {
  45954. return vnode
  45955. } else if (isDef(vnode)) {
  45956. if (isDef(ns)) { applyNS(vnode, ns); }
  45957. if (isDef(data)) { registerDeepBindings(data); }
  45958. return vnode
  45959. } else {
  45960. return createEmptyVNode()
  45961. }
  45962. }
  45963. function applyNS (vnode, ns, force) {
  45964. vnode.ns = ns;
  45965. if (vnode.tag === 'foreignObject') {
  45966. // use default namespace inside foreignObject
  45967. ns = undefined;
  45968. force = true;
  45969. }
  45970. if (isDef(vnode.children)) {
  45971. for (var i = 0, l = vnode.children.length; i < l; i++) {
  45972. var child = vnode.children[i];
  45973. if (isDef(child.tag) && (
  45974. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  45975. applyNS(child, ns, force);
  45976. }
  45977. }
  45978. }
  45979. }
  45980. // ref #5318
  45981. // necessary to ensure parent re-render when deep bindings like :style and
  45982. // :class are used on slot nodes
  45983. function registerDeepBindings (data) {
  45984. if (isObject(data.style)) {
  45985. traverse(data.style);
  45986. }
  45987. if (isObject(data.class)) {
  45988. traverse(data.class);
  45989. }
  45990. }
  45991. /* */
  45992. function initRender (vm) {
  45993. vm._vnode = null; // the root of the child tree
  45994. vm._staticTrees = null; // v-once cached trees
  45995. var options = vm.$options;
  45996. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  45997. var renderContext = parentVnode && parentVnode.context;
  45998. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  45999. vm.$scopedSlots = emptyObject;
  46000. // bind the createElement fn to this instance
  46001. // so that we get proper render context inside it.
  46002. // args order: tag, data, children, normalizationType, alwaysNormalize
  46003. // internal version is used by render functions compiled from templates
  46004. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  46005. // normalization is always applied for the public version, used in
  46006. // user-written render functions.
  46007. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  46008. // $attrs & $listeners are exposed for easier HOC creation.
  46009. // they need to be reactive so that HOCs using them are always updated
  46010. var parentData = parentVnode && parentVnode.data;
  46011. /* istanbul ignore else */
  46012. {
  46013. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  46014. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  46015. }, true);
  46016. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  46017. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  46018. }, true);
  46019. }
  46020. }
  46021. var currentRenderingInstance = null;
  46022. function renderMixin (Vue) {
  46023. // install runtime convenience helpers
  46024. installRenderHelpers(Vue.prototype);
  46025. Vue.prototype.$nextTick = function (fn) {
  46026. return nextTick(fn, this)
  46027. };
  46028. Vue.prototype._render = function () {
  46029. var vm = this;
  46030. var ref = vm.$options;
  46031. var render = ref.render;
  46032. var _parentVnode = ref._parentVnode;
  46033. if (_parentVnode) {
  46034. vm.$scopedSlots = normalizeScopedSlots(
  46035. _parentVnode.data.scopedSlots,
  46036. vm.$slots,
  46037. vm.$scopedSlots
  46038. );
  46039. }
  46040. // set parent vnode. this allows render functions to have access
  46041. // to the data on the placeholder node.
  46042. vm.$vnode = _parentVnode;
  46043. // render self
  46044. var vnode;
  46045. try {
  46046. // There's no need to maintain a stack because all render fns are called
  46047. // separately from one another. Nested component's render fns are called
  46048. // when parent component is patched.
  46049. currentRenderingInstance = vm;
  46050. vnode = render.call(vm._renderProxy, vm.$createElement);
  46051. } catch (e) {
  46052. handleError(e, vm, "render");
  46053. // return error render result,
  46054. // or previous vnode to prevent render error causing blank component
  46055. /* istanbul ignore else */
  46056. if (vm.$options.renderError) {
  46057. try {
  46058. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  46059. } catch (e) {
  46060. handleError(e, vm, "renderError");
  46061. vnode = vm._vnode;
  46062. }
  46063. } else {
  46064. vnode = vm._vnode;
  46065. }
  46066. } finally {
  46067. currentRenderingInstance = null;
  46068. }
  46069. // if the returned array contains only a single node, allow it
  46070. if (Array.isArray(vnode) && vnode.length === 1) {
  46071. vnode = vnode[0];
  46072. }
  46073. // return empty vnode in case the render function errored out
  46074. if (!(vnode instanceof VNode)) {
  46075. if (Array.isArray(vnode)) {
  46076. warn(
  46077. 'Multiple root nodes returned from render function. Render function ' +
  46078. 'should return a single root node.',
  46079. vm
  46080. );
  46081. }
  46082. vnode = createEmptyVNode();
  46083. }
  46084. // set parent
  46085. vnode.parent = _parentVnode;
  46086. return vnode
  46087. };
  46088. }
  46089. /* */
  46090. function ensureCtor (comp, base) {
  46091. if (
  46092. comp.__esModule ||
  46093. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  46094. ) {
  46095. comp = comp.default;
  46096. }
  46097. return isObject(comp)
  46098. ? base.extend(comp)
  46099. : comp
  46100. }
  46101. function createAsyncPlaceholder (
  46102. factory,
  46103. data,
  46104. context,
  46105. children,
  46106. tag
  46107. ) {
  46108. var node = createEmptyVNode();
  46109. node.asyncFactory = factory;
  46110. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  46111. return node
  46112. }
  46113. function resolveAsyncComponent (
  46114. factory,
  46115. baseCtor
  46116. ) {
  46117. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  46118. return factory.errorComp
  46119. }
  46120. if (isDef(factory.resolved)) {
  46121. return factory.resolved
  46122. }
  46123. var owner = currentRenderingInstance;
  46124. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  46125. // already pending
  46126. factory.owners.push(owner);
  46127. }
  46128. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  46129. return factory.loadingComp
  46130. }
  46131. if (owner && !isDef(factory.owners)) {
  46132. var owners = factory.owners = [owner];
  46133. var sync = true;
  46134. var timerLoading = null;
  46135. var timerTimeout = null
  46136. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  46137. var forceRender = function (renderCompleted) {
  46138. for (var i = 0, l = owners.length; i < l; i++) {
  46139. (owners[i]).$forceUpdate();
  46140. }
  46141. if (renderCompleted) {
  46142. owners.length = 0;
  46143. if (timerLoading !== null) {
  46144. clearTimeout(timerLoading);
  46145. timerLoading = null;
  46146. }
  46147. if (timerTimeout !== null) {
  46148. clearTimeout(timerTimeout);
  46149. timerTimeout = null;
  46150. }
  46151. }
  46152. };
  46153. var resolve = once(function (res) {
  46154. // cache resolved
  46155. factory.resolved = ensureCtor(res, baseCtor);
  46156. // invoke callbacks only if this is not a synchronous resolve
  46157. // (async resolves are shimmed as synchronous during SSR)
  46158. if (!sync) {
  46159. forceRender(true);
  46160. } else {
  46161. owners.length = 0;
  46162. }
  46163. });
  46164. var reject = once(function (reason) {
  46165. warn(
  46166. "Failed to resolve async component: " + (String(factory)) +
  46167. (reason ? ("\nReason: " + reason) : '')
  46168. );
  46169. if (isDef(factory.errorComp)) {
  46170. factory.error = true;
  46171. forceRender(true);
  46172. }
  46173. });
  46174. var res = factory(resolve, reject);
  46175. if (isObject(res)) {
  46176. if (isPromise(res)) {
  46177. // () => Promise
  46178. if (isUndef(factory.resolved)) {
  46179. res.then(resolve, reject);
  46180. }
  46181. } else if (isPromise(res.component)) {
  46182. res.component.then(resolve, reject);
  46183. if (isDef(res.error)) {
  46184. factory.errorComp = ensureCtor(res.error, baseCtor);
  46185. }
  46186. if (isDef(res.loading)) {
  46187. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  46188. if (res.delay === 0) {
  46189. factory.loading = true;
  46190. } else {
  46191. timerLoading = setTimeout(function () {
  46192. timerLoading = null;
  46193. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  46194. factory.loading = true;
  46195. forceRender(false);
  46196. }
  46197. }, res.delay || 200);
  46198. }
  46199. }
  46200. if (isDef(res.timeout)) {
  46201. timerTimeout = setTimeout(function () {
  46202. timerTimeout = null;
  46203. if (isUndef(factory.resolved)) {
  46204. reject(
  46205. "timeout (" + (res.timeout) + "ms)"
  46206. );
  46207. }
  46208. }, res.timeout);
  46209. }
  46210. }
  46211. }
  46212. sync = false;
  46213. // return in case resolved synchronously
  46214. return factory.loading
  46215. ? factory.loadingComp
  46216. : factory.resolved
  46217. }
  46218. }
  46219. /* */
  46220. function isAsyncPlaceholder (node) {
  46221. return node.isComment && node.asyncFactory
  46222. }
  46223. /* */
  46224. function getFirstComponentChild (children) {
  46225. if (Array.isArray(children)) {
  46226. for (var i = 0; i < children.length; i++) {
  46227. var c = children[i];
  46228. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  46229. return c
  46230. }
  46231. }
  46232. }
  46233. }
  46234. /* */
  46235. /* */
  46236. function initEvents (vm) {
  46237. vm._events = Object.create(null);
  46238. vm._hasHookEvent = false;
  46239. // init parent attached events
  46240. var listeners = vm.$options._parentListeners;
  46241. if (listeners) {
  46242. updateComponentListeners(vm, listeners);
  46243. }
  46244. }
  46245. var target;
  46246. function add (event, fn) {
  46247. target.$on(event, fn);
  46248. }
  46249. function remove$1 (event, fn) {
  46250. target.$off(event, fn);
  46251. }
  46252. function createOnceHandler (event, fn) {
  46253. var _target = target;
  46254. return function onceHandler () {
  46255. var res = fn.apply(null, arguments);
  46256. if (res !== null) {
  46257. _target.$off(event, onceHandler);
  46258. }
  46259. }
  46260. }
  46261. function updateComponentListeners (
  46262. vm,
  46263. listeners,
  46264. oldListeners
  46265. ) {
  46266. target = vm;
  46267. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  46268. target = undefined;
  46269. }
  46270. function eventsMixin (Vue) {
  46271. var hookRE = /^hook:/;
  46272. Vue.prototype.$on = function (event, fn) {
  46273. var vm = this;
  46274. if (Array.isArray(event)) {
  46275. for (var i = 0, l = event.length; i < l; i++) {
  46276. vm.$on(event[i], fn);
  46277. }
  46278. } else {
  46279. (vm._events[event] || (vm._events[event] = [])).push(fn);
  46280. // optimize hook:event cost by using a boolean flag marked at registration
  46281. // instead of a hash lookup
  46282. if (hookRE.test(event)) {
  46283. vm._hasHookEvent = true;
  46284. }
  46285. }
  46286. return vm
  46287. };
  46288. Vue.prototype.$once = function (event, fn) {
  46289. var vm = this;
  46290. function on () {
  46291. vm.$off(event, on);
  46292. fn.apply(vm, arguments);
  46293. }
  46294. on.fn = fn;
  46295. vm.$on(event, on);
  46296. return vm
  46297. };
  46298. Vue.prototype.$off = function (event, fn) {
  46299. var vm = this;
  46300. // all
  46301. if (!arguments.length) {
  46302. vm._events = Object.create(null);
  46303. return vm
  46304. }
  46305. // array of events
  46306. if (Array.isArray(event)) {
  46307. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  46308. vm.$off(event[i$1], fn);
  46309. }
  46310. return vm
  46311. }
  46312. // specific event
  46313. var cbs = vm._events[event];
  46314. if (!cbs) {
  46315. return vm
  46316. }
  46317. if (!fn) {
  46318. vm._events[event] = null;
  46319. return vm
  46320. }
  46321. // specific handler
  46322. var cb;
  46323. var i = cbs.length;
  46324. while (i--) {
  46325. cb = cbs[i];
  46326. if (cb === fn || cb.fn === fn) {
  46327. cbs.splice(i, 1);
  46328. break
  46329. }
  46330. }
  46331. return vm
  46332. };
  46333. Vue.prototype.$emit = function (event) {
  46334. var vm = this;
  46335. {
  46336. var lowerCaseEvent = event.toLowerCase();
  46337. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  46338. tip(
  46339. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  46340. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  46341. "Note that HTML attributes are case-insensitive and you cannot use " +
  46342. "v-on to listen to camelCase events when using in-DOM templates. " +
  46343. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  46344. );
  46345. }
  46346. }
  46347. var cbs = vm._events[event];
  46348. if (cbs) {
  46349. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  46350. var args = toArray(arguments, 1);
  46351. var info = "event handler for \"" + event + "\"";
  46352. for (var i = 0, l = cbs.length; i < l; i++) {
  46353. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  46354. }
  46355. }
  46356. return vm
  46357. };
  46358. }
  46359. /* */
  46360. var activeInstance = null;
  46361. var isUpdatingChildComponent = false;
  46362. function setActiveInstance(vm) {
  46363. var prevActiveInstance = activeInstance;
  46364. activeInstance = vm;
  46365. return function () {
  46366. activeInstance = prevActiveInstance;
  46367. }
  46368. }
  46369. function initLifecycle (vm) {
  46370. var options = vm.$options;
  46371. // locate first non-abstract parent
  46372. var parent = options.parent;
  46373. if (parent && !options.abstract) {
  46374. while (parent.$options.abstract && parent.$parent) {
  46375. parent = parent.$parent;
  46376. }
  46377. parent.$children.push(vm);
  46378. }
  46379. vm.$parent = parent;
  46380. vm.$root = parent ? parent.$root : vm;
  46381. vm.$children = [];
  46382. vm.$refs = {};
  46383. vm._watcher = null;
  46384. vm._inactive = null;
  46385. vm._directInactive = false;
  46386. vm._isMounted = false;
  46387. vm._isDestroyed = false;
  46388. vm._isBeingDestroyed = false;
  46389. }
  46390. function lifecycleMixin (Vue) {
  46391. Vue.prototype._update = function (vnode, hydrating) {
  46392. var vm = this;
  46393. var prevEl = vm.$el;
  46394. var prevVnode = vm._vnode;
  46395. var restoreActiveInstance = setActiveInstance(vm);
  46396. vm._vnode = vnode;
  46397. // Vue.prototype.__patch__ is injected in entry points
  46398. // based on the rendering backend used.
  46399. if (!prevVnode) {
  46400. // initial render
  46401. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  46402. } else {
  46403. // updates
  46404. vm.$el = vm.__patch__(prevVnode, vnode);
  46405. }
  46406. restoreActiveInstance();
  46407. // update __vue__ reference
  46408. if (prevEl) {
  46409. prevEl.__vue__ = null;
  46410. }
  46411. if (vm.$el) {
  46412. vm.$el.__vue__ = vm;
  46413. }
  46414. // if parent is an HOC, update its $el as well
  46415. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  46416. vm.$parent.$el = vm.$el;
  46417. }
  46418. // updated hook is called by the scheduler to ensure that children are
  46419. // updated in a parent's updated hook.
  46420. };
  46421. Vue.prototype.$forceUpdate = function () {
  46422. var vm = this;
  46423. if (vm._watcher) {
  46424. vm._watcher.update();
  46425. }
  46426. };
  46427. Vue.prototype.$destroy = function () {
  46428. var vm = this;
  46429. if (vm._isBeingDestroyed) {
  46430. return
  46431. }
  46432. callHook(vm, 'beforeDestroy');
  46433. vm._isBeingDestroyed = true;
  46434. // remove self from parent
  46435. var parent = vm.$parent;
  46436. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  46437. remove(parent.$children, vm);
  46438. }
  46439. // teardown watchers
  46440. if (vm._watcher) {
  46441. vm._watcher.teardown();
  46442. }
  46443. var i = vm._watchers.length;
  46444. while (i--) {
  46445. vm._watchers[i].teardown();
  46446. }
  46447. // remove reference from data ob
  46448. // frozen object may not have observer.
  46449. if (vm._data.__ob__) {
  46450. vm._data.__ob__.vmCount--;
  46451. }
  46452. // call the last hook...
  46453. vm._isDestroyed = true;
  46454. // invoke destroy hooks on current rendered tree
  46455. vm.__patch__(vm._vnode, null);
  46456. // fire destroyed hook
  46457. callHook(vm, 'destroyed');
  46458. // turn off all instance listeners.
  46459. vm.$off();
  46460. // remove __vue__ reference
  46461. if (vm.$el) {
  46462. vm.$el.__vue__ = null;
  46463. }
  46464. // release circular reference (#6759)
  46465. if (vm.$vnode) {
  46466. vm.$vnode.parent = null;
  46467. }
  46468. };
  46469. }
  46470. function mountComponent (
  46471. vm,
  46472. el,
  46473. hydrating
  46474. ) {
  46475. vm.$el = el;
  46476. if (!vm.$options.render) {
  46477. vm.$options.render = createEmptyVNode;
  46478. {
  46479. /* istanbul ignore if */
  46480. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  46481. vm.$options.el || el) {
  46482. warn(
  46483. 'You are using the runtime-only build of Vue where the template ' +
  46484. 'compiler is not available. Either pre-compile the templates into ' +
  46485. 'render functions, or use the compiler-included build.',
  46486. vm
  46487. );
  46488. } else {
  46489. warn(
  46490. 'Failed to mount component: template or render function not defined.',
  46491. vm
  46492. );
  46493. }
  46494. }
  46495. }
  46496. callHook(vm, 'beforeMount');
  46497. var updateComponent;
  46498. /* istanbul ignore if */
  46499. if (config.performance && mark) {
  46500. updateComponent = function () {
  46501. var name = vm._name;
  46502. var id = vm._uid;
  46503. var startTag = "vue-perf-start:" + id;
  46504. var endTag = "vue-perf-end:" + id;
  46505. mark(startTag);
  46506. var vnode = vm._render();
  46507. mark(endTag);
  46508. measure(("vue " + name + " render"), startTag, endTag);
  46509. mark(startTag);
  46510. vm._update(vnode, hydrating);
  46511. mark(endTag);
  46512. measure(("vue " + name + " patch"), startTag, endTag);
  46513. };
  46514. } else {
  46515. updateComponent = function () {
  46516. vm._update(vm._render(), hydrating);
  46517. };
  46518. }
  46519. // we set this to vm._watcher inside the watcher's constructor
  46520. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  46521. // component's mounted hook), which relies on vm._watcher being already defined
  46522. new Watcher(vm, updateComponent, noop, {
  46523. before: function before () {
  46524. if (vm._isMounted && !vm._isDestroyed) {
  46525. callHook(vm, 'beforeUpdate');
  46526. }
  46527. }
  46528. }, true /* isRenderWatcher */);
  46529. hydrating = false;
  46530. // manually mounted instance, call mounted on self
  46531. // mounted is called for render-created child components in its inserted hook
  46532. if (vm.$vnode == null) {
  46533. vm._isMounted = true;
  46534. callHook(vm, 'mounted');
  46535. }
  46536. return vm
  46537. }
  46538. function updateChildComponent (
  46539. vm,
  46540. propsData,
  46541. listeners,
  46542. parentVnode,
  46543. renderChildren
  46544. ) {
  46545. {
  46546. isUpdatingChildComponent = true;
  46547. }
  46548. // determine whether component has slot children
  46549. // we need to do this before overwriting $options._renderChildren.
  46550. // check if there are dynamic scopedSlots (hand-written or compiled but with
  46551. // dynamic slot names). Static scoped slots compiled from template has the
  46552. // "$stable" marker.
  46553. var newScopedSlots = parentVnode.data.scopedSlots;
  46554. var oldScopedSlots = vm.$scopedSlots;
  46555. var hasDynamicScopedSlot = !!(
  46556. (newScopedSlots && !newScopedSlots.$stable) ||
  46557. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  46558. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  46559. );
  46560. // Any static slot children from the parent may have changed during parent's
  46561. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  46562. // update is necessary to ensure correctness.
  46563. var needsForceUpdate = !!(
  46564. renderChildren || // has new static slots
  46565. vm.$options._renderChildren || // has old static slots
  46566. hasDynamicScopedSlot
  46567. );
  46568. vm.$options._parentVnode = parentVnode;
  46569. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  46570. if (vm._vnode) { // update child tree's parent
  46571. vm._vnode.parent = parentVnode;
  46572. }
  46573. vm.$options._renderChildren = renderChildren;
  46574. // update $attrs and $listeners hash
  46575. // these are also reactive so they may trigger child update if the child
  46576. // used them during render
  46577. vm.$attrs = parentVnode.data.attrs || emptyObject;
  46578. vm.$listeners = listeners || emptyObject;
  46579. // update props
  46580. if (propsData && vm.$options.props) {
  46581. toggleObserving(false);
  46582. var props = vm._props;
  46583. var propKeys = vm.$options._propKeys || [];
  46584. for (var i = 0; i < propKeys.length; i++) {
  46585. var key = propKeys[i];
  46586. var propOptions = vm.$options.props; // wtf flow?
  46587. props[key] = validateProp(key, propOptions, propsData, vm);
  46588. }
  46589. toggleObserving(true);
  46590. // keep a copy of raw propsData
  46591. vm.$options.propsData = propsData;
  46592. }
  46593. // update listeners
  46594. listeners = listeners || emptyObject;
  46595. var oldListeners = vm.$options._parentListeners;
  46596. vm.$options._parentListeners = listeners;
  46597. updateComponentListeners(vm, listeners, oldListeners);
  46598. // resolve slots + force update if has children
  46599. if (needsForceUpdate) {
  46600. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  46601. vm.$forceUpdate();
  46602. }
  46603. {
  46604. isUpdatingChildComponent = false;
  46605. }
  46606. }
  46607. function isInInactiveTree (vm) {
  46608. while (vm && (vm = vm.$parent)) {
  46609. if (vm._inactive) { return true }
  46610. }
  46611. return false
  46612. }
  46613. function activateChildComponent (vm, direct) {
  46614. if (direct) {
  46615. vm._directInactive = false;
  46616. if (isInInactiveTree(vm)) {
  46617. return
  46618. }
  46619. } else if (vm._directInactive) {
  46620. return
  46621. }
  46622. if (vm._inactive || vm._inactive === null) {
  46623. vm._inactive = false;
  46624. for (var i = 0; i < vm.$children.length; i++) {
  46625. activateChildComponent(vm.$children[i]);
  46626. }
  46627. callHook(vm, 'activated');
  46628. }
  46629. }
  46630. function deactivateChildComponent (vm, direct) {
  46631. if (direct) {
  46632. vm._directInactive = true;
  46633. if (isInInactiveTree(vm)) {
  46634. return
  46635. }
  46636. }
  46637. if (!vm._inactive) {
  46638. vm._inactive = true;
  46639. for (var i = 0; i < vm.$children.length; i++) {
  46640. deactivateChildComponent(vm.$children[i]);
  46641. }
  46642. callHook(vm, 'deactivated');
  46643. }
  46644. }
  46645. function callHook (vm, hook) {
  46646. // #7573 disable dep collection when invoking lifecycle hooks
  46647. pushTarget();
  46648. var handlers = vm.$options[hook];
  46649. var info = hook + " hook";
  46650. if (handlers) {
  46651. for (var i = 0, j = handlers.length; i < j; i++) {
  46652. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  46653. }
  46654. }
  46655. if (vm._hasHookEvent) {
  46656. vm.$emit('hook:' + hook);
  46657. }
  46658. popTarget();
  46659. }
  46660. /* */
  46661. var MAX_UPDATE_COUNT = 100;
  46662. var queue = [];
  46663. var activatedChildren = [];
  46664. var has = {};
  46665. var circular = {};
  46666. var waiting = false;
  46667. var flushing = false;
  46668. var index = 0;
  46669. /**
  46670. * Reset the scheduler's state.
  46671. */
  46672. function resetSchedulerState () {
  46673. index = queue.length = activatedChildren.length = 0;
  46674. has = {};
  46675. {
  46676. circular = {};
  46677. }
  46678. waiting = flushing = false;
  46679. }
  46680. // Async edge case #6566 requires saving the timestamp when event listeners are
  46681. // attached. However, calling performance.now() has a perf overhead especially
  46682. // if the page has thousands of event listeners. Instead, we take a timestamp
  46683. // every time the scheduler flushes and use that for all event listeners
  46684. // attached during that flush.
  46685. var currentFlushTimestamp = 0;
  46686. // Async edge case fix requires storing an event listener's attach timestamp.
  46687. var getNow = Date.now;
  46688. // Determine what event timestamp the browser is using. Annoyingly, the
  46689. // timestamp can either be hi-res (relative to page load) or low-res
  46690. // (relative to UNIX epoch), so in order to compare time we have to use the
  46691. // same timestamp type when saving the flush timestamp.
  46692. // All IE versions use low-res event timestamps, and have problematic clock
  46693. // implementations (#9632)
  46694. if (inBrowser && !isIE) {
  46695. var performance = window.performance;
  46696. if (
  46697. performance &&
  46698. typeof performance.now === 'function' &&
  46699. getNow() > document.createEvent('Event').timeStamp
  46700. ) {
  46701. // if the event timestamp, although evaluated AFTER the Date.now(), is
  46702. // smaller than it, it means the event is using a hi-res timestamp,
  46703. // and we need to use the hi-res version for event listener timestamps as
  46704. // well.
  46705. getNow = function () { return performance.now(); };
  46706. }
  46707. }
  46708. /**
  46709. * Flush both queues and run the watchers.
  46710. */
  46711. function flushSchedulerQueue () {
  46712. currentFlushTimestamp = getNow();
  46713. flushing = true;
  46714. var watcher, id;
  46715. // Sort queue before flush.
  46716. // This ensures that:
  46717. // 1. Components are updated from parent to child. (because parent is always
  46718. // created before the child)
  46719. // 2. A component's user watchers are run before its render watcher (because
  46720. // user watchers are created before the render watcher)
  46721. // 3. If a component is destroyed during a parent component's watcher run,
  46722. // its watchers can be skipped.
  46723. queue.sort(function (a, b) { return a.id - b.id; });
  46724. // do not cache length because more watchers might be pushed
  46725. // as we run existing watchers
  46726. for (index = 0; index < queue.length; index++) {
  46727. watcher = queue[index];
  46728. if (watcher.before) {
  46729. watcher.before();
  46730. }
  46731. id = watcher.id;
  46732. has[id] = null;
  46733. watcher.run();
  46734. // in dev build, check and stop circular updates.
  46735. if (has[id] != null) {
  46736. circular[id] = (circular[id] || 0) + 1;
  46737. if (circular[id] > MAX_UPDATE_COUNT) {
  46738. warn(
  46739. 'You may have an infinite update loop ' + (
  46740. watcher.user
  46741. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  46742. : "in a component render function."
  46743. ),
  46744. watcher.vm
  46745. );
  46746. break
  46747. }
  46748. }
  46749. }
  46750. // keep copies of post queues before resetting state
  46751. var activatedQueue = activatedChildren.slice();
  46752. var updatedQueue = queue.slice();
  46753. resetSchedulerState();
  46754. // call component updated and activated hooks
  46755. callActivatedHooks(activatedQueue);
  46756. callUpdatedHooks(updatedQueue);
  46757. // devtool hook
  46758. /* istanbul ignore if */
  46759. if (devtools && config.devtools) {
  46760. devtools.emit('flush');
  46761. }
  46762. }
  46763. function callUpdatedHooks (queue) {
  46764. var i = queue.length;
  46765. while (i--) {
  46766. var watcher = queue[i];
  46767. var vm = watcher.vm;
  46768. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  46769. callHook(vm, 'updated');
  46770. }
  46771. }
  46772. }
  46773. /**
  46774. * Queue a kept-alive component that was activated during patch.
  46775. * The queue will be processed after the entire tree has been patched.
  46776. */
  46777. function queueActivatedComponent (vm) {
  46778. // setting _inactive to false here so that a render function can
  46779. // rely on checking whether it's in an inactive tree (e.g. router-view)
  46780. vm._inactive = false;
  46781. activatedChildren.push(vm);
  46782. }
  46783. function callActivatedHooks (queue) {
  46784. for (var i = 0; i < queue.length; i++) {
  46785. queue[i]._inactive = true;
  46786. activateChildComponent(queue[i], true /* true */);
  46787. }
  46788. }
  46789. /**
  46790. * Push a watcher into the watcher queue.
  46791. * Jobs with duplicate IDs will be skipped unless it's
  46792. * pushed when the queue is being flushed.
  46793. */
  46794. function queueWatcher (watcher) {
  46795. var id = watcher.id;
  46796. if (has[id] == null) {
  46797. has[id] = true;
  46798. if (!flushing) {
  46799. queue.push(watcher);
  46800. } else {
  46801. // if already flushing, splice the watcher based on its id
  46802. // if already past its id, it will be run next immediately.
  46803. var i = queue.length - 1;
  46804. while (i > index && queue[i].id > watcher.id) {
  46805. i--;
  46806. }
  46807. queue.splice(i + 1, 0, watcher);
  46808. }
  46809. // queue the flush
  46810. if (!waiting) {
  46811. waiting = true;
  46812. if (!config.async) {
  46813. flushSchedulerQueue();
  46814. return
  46815. }
  46816. nextTick(flushSchedulerQueue);
  46817. }
  46818. }
  46819. }
  46820. /* */
  46821. var uid$2 = 0;
  46822. /**
  46823. * A watcher parses an expression, collects dependencies,
  46824. * and fires callback when the expression value changes.
  46825. * This is used for both the $watch() api and directives.
  46826. */
  46827. var Watcher = function Watcher (
  46828. vm,
  46829. expOrFn,
  46830. cb,
  46831. options,
  46832. isRenderWatcher
  46833. ) {
  46834. this.vm = vm;
  46835. if (isRenderWatcher) {
  46836. vm._watcher = this;
  46837. }
  46838. vm._watchers.push(this);
  46839. // options
  46840. if (options) {
  46841. this.deep = !!options.deep;
  46842. this.user = !!options.user;
  46843. this.lazy = !!options.lazy;
  46844. this.sync = !!options.sync;
  46845. this.before = options.before;
  46846. } else {
  46847. this.deep = this.user = this.lazy = this.sync = false;
  46848. }
  46849. this.cb = cb;
  46850. this.id = ++uid$2; // uid for batching
  46851. this.active = true;
  46852. this.dirty = this.lazy; // for lazy watchers
  46853. this.deps = [];
  46854. this.newDeps = [];
  46855. this.depIds = new _Set();
  46856. this.newDepIds = new _Set();
  46857. this.expression = expOrFn.toString();
  46858. // parse expression for getter
  46859. if (typeof expOrFn === 'function') {
  46860. this.getter = expOrFn;
  46861. } else {
  46862. this.getter = parsePath(expOrFn);
  46863. if (!this.getter) {
  46864. this.getter = noop;
  46865. warn(
  46866. "Failed watching path: \"" + expOrFn + "\" " +
  46867. 'Watcher only accepts simple dot-delimited paths. ' +
  46868. 'For full control, use a function instead.',
  46869. vm
  46870. );
  46871. }
  46872. }
  46873. this.value = this.lazy
  46874. ? undefined
  46875. : this.get();
  46876. };
  46877. /**
  46878. * Evaluate the getter, and re-collect dependencies.
  46879. */
  46880. Watcher.prototype.get = function get () {
  46881. pushTarget(this);
  46882. var value;
  46883. var vm = this.vm;
  46884. try {
  46885. value = this.getter.call(vm, vm);
  46886. } catch (e) {
  46887. if (this.user) {
  46888. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  46889. } else {
  46890. throw e
  46891. }
  46892. } finally {
  46893. // "touch" every property so they are all tracked as
  46894. // dependencies for deep watching
  46895. if (this.deep) {
  46896. traverse(value);
  46897. }
  46898. popTarget();
  46899. this.cleanupDeps();
  46900. }
  46901. return value
  46902. };
  46903. /**
  46904. * Add a dependency to this directive.
  46905. */
  46906. Watcher.prototype.addDep = function addDep (dep) {
  46907. var id = dep.id;
  46908. if (!this.newDepIds.has(id)) {
  46909. this.newDepIds.add(id);
  46910. this.newDeps.push(dep);
  46911. if (!this.depIds.has(id)) {
  46912. dep.addSub(this);
  46913. }
  46914. }
  46915. };
  46916. /**
  46917. * Clean up for dependency collection.
  46918. */
  46919. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  46920. var i = this.deps.length;
  46921. while (i--) {
  46922. var dep = this.deps[i];
  46923. if (!this.newDepIds.has(dep.id)) {
  46924. dep.removeSub(this);
  46925. }
  46926. }
  46927. var tmp = this.depIds;
  46928. this.depIds = this.newDepIds;
  46929. this.newDepIds = tmp;
  46930. this.newDepIds.clear();
  46931. tmp = this.deps;
  46932. this.deps = this.newDeps;
  46933. this.newDeps = tmp;
  46934. this.newDeps.length = 0;
  46935. };
  46936. /**
  46937. * Subscriber interface.
  46938. * Will be called when a dependency changes.
  46939. */
  46940. Watcher.prototype.update = function update () {
  46941. /* istanbul ignore else */
  46942. if (this.lazy) {
  46943. this.dirty = true;
  46944. } else if (this.sync) {
  46945. this.run();
  46946. } else {
  46947. queueWatcher(this);
  46948. }
  46949. };
  46950. /**
  46951. * Scheduler job interface.
  46952. * Will be called by the scheduler.
  46953. */
  46954. Watcher.prototype.run = function run () {
  46955. if (this.active) {
  46956. var value = this.get();
  46957. if (
  46958. value !== this.value ||
  46959. // Deep watchers and watchers on Object/Arrays should fire even
  46960. // when the value is the same, because the value may
  46961. // have mutated.
  46962. isObject(value) ||
  46963. this.deep
  46964. ) {
  46965. // set new value
  46966. var oldValue = this.value;
  46967. this.value = value;
  46968. if (this.user) {
  46969. try {
  46970. this.cb.call(this.vm, value, oldValue);
  46971. } catch (e) {
  46972. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  46973. }
  46974. } else {
  46975. this.cb.call(this.vm, value, oldValue);
  46976. }
  46977. }
  46978. }
  46979. };
  46980. /**
  46981. * Evaluate the value of the watcher.
  46982. * This only gets called for lazy watchers.
  46983. */
  46984. Watcher.prototype.evaluate = function evaluate () {
  46985. this.value = this.get();
  46986. this.dirty = false;
  46987. };
  46988. /**
  46989. * Depend on all deps collected by this watcher.
  46990. */
  46991. Watcher.prototype.depend = function depend () {
  46992. var i = this.deps.length;
  46993. while (i--) {
  46994. this.deps[i].depend();
  46995. }
  46996. };
  46997. /**
  46998. * Remove self from all dependencies' subscriber list.
  46999. */
  47000. Watcher.prototype.teardown = function teardown () {
  47001. if (this.active) {
  47002. // remove self from vm's watcher list
  47003. // this is a somewhat expensive operation so we skip it
  47004. // if the vm is being destroyed.
  47005. if (!this.vm._isBeingDestroyed) {
  47006. remove(this.vm._watchers, this);
  47007. }
  47008. var i = this.deps.length;
  47009. while (i--) {
  47010. this.deps[i].removeSub(this);
  47011. }
  47012. this.active = false;
  47013. }
  47014. };
  47015. /* */
  47016. var sharedPropertyDefinition = {
  47017. enumerable: true,
  47018. configurable: true,
  47019. get: noop,
  47020. set: noop
  47021. };
  47022. function proxy (target, sourceKey, key) {
  47023. sharedPropertyDefinition.get = function proxyGetter () {
  47024. return this[sourceKey][key]
  47025. };
  47026. sharedPropertyDefinition.set = function proxySetter (val) {
  47027. this[sourceKey][key] = val;
  47028. };
  47029. Object.defineProperty(target, key, sharedPropertyDefinition);
  47030. }
  47031. function initState (vm) {
  47032. vm._watchers = [];
  47033. var opts = vm.$options;
  47034. if (opts.props) { initProps(vm, opts.props); }
  47035. if (opts.methods) { initMethods(vm, opts.methods); }
  47036. if (opts.data) {
  47037. initData(vm);
  47038. } else {
  47039. observe(vm._data = {}, true /* asRootData */);
  47040. }
  47041. if (opts.computed) { initComputed(vm, opts.computed); }
  47042. if (opts.watch && opts.watch !== nativeWatch) {
  47043. initWatch(vm, opts.watch);
  47044. }
  47045. }
  47046. function initProps (vm, propsOptions) {
  47047. var propsData = vm.$options.propsData || {};
  47048. var props = vm._props = {};
  47049. // cache prop keys so that future props updates can iterate using Array
  47050. // instead of dynamic object key enumeration.
  47051. var keys = vm.$options._propKeys = [];
  47052. var isRoot = !vm.$parent;
  47053. // root instance props should be converted
  47054. if (!isRoot) {
  47055. toggleObserving(false);
  47056. }
  47057. var loop = function ( key ) {
  47058. keys.push(key);
  47059. var value = validateProp(key, propsOptions, propsData, vm);
  47060. /* istanbul ignore else */
  47061. {
  47062. var hyphenatedKey = hyphenate(key);
  47063. if (isReservedAttribute(hyphenatedKey) ||
  47064. config.isReservedAttr(hyphenatedKey)) {
  47065. warn(
  47066. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  47067. vm
  47068. );
  47069. }
  47070. defineReactive$$1(props, key, value, function () {
  47071. if (!isRoot && !isUpdatingChildComponent) {
  47072. warn(
  47073. "Avoid mutating a prop directly since the value will be " +
  47074. "overwritten whenever the parent component re-renders. " +
  47075. "Instead, use a data or computed property based on the prop's " +
  47076. "value. Prop being mutated: \"" + key + "\"",
  47077. vm
  47078. );
  47079. }
  47080. });
  47081. }
  47082. // static props are already proxied on the component's prototype
  47083. // during Vue.extend(). We only need to proxy props defined at
  47084. // instantiation here.
  47085. if (!(key in vm)) {
  47086. proxy(vm, "_props", key);
  47087. }
  47088. };
  47089. for (var key in propsOptions) loop( key );
  47090. toggleObserving(true);
  47091. }
  47092. function initData (vm) {
  47093. var data = vm.$options.data;
  47094. data = vm._data = typeof data === 'function'
  47095. ? getData(data, vm)
  47096. : data || {};
  47097. if (!isPlainObject(data)) {
  47098. data = {};
  47099. warn(
  47100. 'data functions should return an object:\n' +
  47101. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  47102. vm
  47103. );
  47104. }
  47105. // proxy data on instance
  47106. var keys = Object.keys(data);
  47107. var props = vm.$options.props;
  47108. var methods = vm.$options.methods;
  47109. var i = keys.length;
  47110. while (i--) {
  47111. var key = keys[i];
  47112. {
  47113. if (methods && hasOwn(methods, key)) {
  47114. warn(
  47115. ("Method \"" + key + "\" has already been defined as a data property."),
  47116. vm
  47117. );
  47118. }
  47119. }
  47120. if (props && hasOwn(props, key)) {
  47121. warn(
  47122. "The data property \"" + key + "\" is already declared as a prop. " +
  47123. "Use prop default value instead.",
  47124. vm
  47125. );
  47126. } else if (!isReserved(key)) {
  47127. proxy(vm, "_data", key);
  47128. }
  47129. }
  47130. // observe data
  47131. observe(data, true /* asRootData */);
  47132. }
  47133. function getData (data, vm) {
  47134. // #7573 disable dep collection when invoking data getters
  47135. pushTarget();
  47136. try {
  47137. return data.call(vm, vm)
  47138. } catch (e) {
  47139. handleError(e, vm, "data()");
  47140. return {}
  47141. } finally {
  47142. popTarget();
  47143. }
  47144. }
  47145. var computedWatcherOptions = { lazy: true };
  47146. function initComputed (vm, computed) {
  47147. // $flow-disable-line
  47148. var watchers = vm._computedWatchers = Object.create(null);
  47149. // computed properties are just getters during SSR
  47150. var isSSR = isServerRendering();
  47151. for (var key in computed) {
  47152. var userDef = computed[key];
  47153. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  47154. if (getter == null) {
  47155. warn(
  47156. ("Getter is missing for computed property \"" + key + "\"."),
  47157. vm
  47158. );
  47159. }
  47160. if (!isSSR) {
  47161. // create internal watcher for the computed property.
  47162. watchers[key] = new Watcher(
  47163. vm,
  47164. getter || noop,
  47165. noop,
  47166. computedWatcherOptions
  47167. );
  47168. }
  47169. // component-defined computed properties are already defined on the
  47170. // component prototype. We only need to define computed properties defined
  47171. // at instantiation here.
  47172. if (!(key in vm)) {
  47173. defineComputed(vm, key, userDef);
  47174. } else {
  47175. if (key in vm.$data) {
  47176. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  47177. } else if (vm.$options.props && key in vm.$options.props) {
  47178. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  47179. }
  47180. }
  47181. }
  47182. }
  47183. function defineComputed (
  47184. target,
  47185. key,
  47186. userDef
  47187. ) {
  47188. var shouldCache = !isServerRendering();
  47189. if (typeof userDef === 'function') {
  47190. sharedPropertyDefinition.get = shouldCache
  47191. ? createComputedGetter(key)
  47192. : createGetterInvoker(userDef);
  47193. sharedPropertyDefinition.set = noop;
  47194. } else {
  47195. sharedPropertyDefinition.get = userDef.get
  47196. ? shouldCache && userDef.cache !== false
  47197. ? createComputedGetter(key)
  47198. : createGetterInvoker(userDef.get)
  47199. : noop;
  47200. sharedPropertyDefinition.set = userDef.set || noop;
  47201. }
  47202. if (sharedPropertyDefinition.set === noop) {
  47203. sharedPropertyDefinition.set = function () {
  47204. warn(
  47205. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  47206. this
  47207. );
  47208. };
  47209. }
  47210. Object.defineProperty(target, key, sharedPropertyDefinition);
  47211. }
  47212. function createComputedGetter (key) {
  47213. return function computedGetter () {
  47214. var watcher = this._computedWatchers && this._computedWatchers[key];
  47215. if (watcher) {
  47216. if (watcher.dirty) {
  47217. watcher.evaluate();
  47218. }
  47219. if (Dep.target) {
  47220. watcher.depend();
  47221. }
  47222. return watcher.value
  47223. }
  47224. }
  47225. }
  47226. function createGetterInvoker(fn) {
  47227. return function computedGetter () {
  47228. return fn.call(this, this)
  47229. }
  47230. }
  47231. function initMethods (vm, methods) {
  47232. var props = vm.$options.props;
  47233. for (var key in methods) {
  47234. {
  47235. if (typeof methods[key] !== 'function') {
  47236. warn(
  47237. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  47238. "Did you reference the function correctly?",
  47239. vm
  47240. );
  47241. }
  47242. if (props && hasOwn(props, key)) {
  47243. warn(
  47244. ("Method \"" + key + "\" has already been defined as a prop."),
  47245. vm
  47246. );
  47247. }
  47248. if ((key in vm) && isReserved(key)) {
  47249. warn(
  47250. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  47251. "Avoid defining component methods that start with _ or $."
  47252. );
  47253. }
  47254. }
  47255. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  47256. }
  47257. }
  47258. function initWatch (vm, watch) {
  47259. for (var key in watch) {
  47260. var handler = watch[key];
  47261. if (Array.isArray(handler)) {
  47262. for (var i = 0; i < handler.length; i++) {
  47263. createWatcher(vm, key, handler[i]);
  47264. }
  47265. } else {
  47266. createWatcher(vm, key, handler);
  47267. }
  47268. }
  47269. }
  47270. function createWatcher (
  47271. vm,
  47272. expOrFn,
  47273. handler,
  47274. options
  47275. ) {
  47276. if (isPlainObject(handler)) {
  47277. options = handler;
  47278. handler = handler.handler;
  47279. }
  47280. if (typeof handler === 'string') {
  47281. handler = vm[handler];
  47282. }
  47283. return vm.$watch(expOrFn, handler, options)
  47284. }
  47285. function stateMixin (Vue) {
  47286. // flow somehow has problems with directly declared definition object
  47287. // when using Object.defineProperty, so we have to procedurally build up
  47288. // the object here.
  47289. var dataDef = {};
  47290. dataDef.get = function () { return this._data };
  47291. var propsDef = {};
  47292. propsDef.get = function () { return this._props };
  47293. {
  47294. dataDef.set = function () {
  47295. warn(
  47296. 'Avoid replacing instance root $data. ' +
  47297. 'Use nested data properties instead.',
  47298. this
  47299. );
  47300. };
  47301. propsDef.set = function () {
  47302. warn("$props is readonly.", this);
  47303. };
  47304. }
  47305. Object.defineProperty(Vue.prototype, '$data', dataDef);
  47306. Object.defineProperty(Vue.prototype, '$props', propsDef);
  47307. Vue.prototype.$set = set;
  47308. Vue.prototype.$delete = del;
  47309. Vue.prototype.$watch = function (
  47310. expOrFn,
  47311. cb,
  47312. options
  47313. ) {
  47314. var vm = this;
  47315. if (isPlainObject(cb)) {
  47316. return createWatcher(vm, expOrFn, cb, options)
  47317. }
  47318. options = options || {};
  47319. options.user = true;
  47320. var watcher = new Watcher(vm, expOrFn, cb, options);
  47321. if (options.immediate) {
  47322. try {
  47323. cb.call(vm, watcher.value);
  47324. } catch (error) {
  47325. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  47326. }
  47327. }
  47328. return function unwatchFn () {
  47329. watcher.teardown();
  47330. }
  47331. };
  47332. }
  47333. /* */
  47334. var uid$3 = 0;
  47335. function initMixin (Vue) {
  47336. Vue.prototype._init = function (options) {
  47337. var vm = this;
  47338. // a uid
  47339. vm._uid = uid$3++;
  47340. var startTag, endTag;
  47341. /* istanbul ignore if */
  47342. if (config.performance && mark) {
  47343. startTag = "vue-perf-start:" + (vm._uid);
  47344. endTag = "vue-perf-end:" + (vm._uid);
  47345. mark(startTag);
  47346. }
  47347. // a flag to avoid this being observed
  47348. vm._isVue = true;
  47349. // merge options
  47350. if (options && options._isComponent) {
  47351. // optimize internal component instantiation
  47352. // since dynamic options merging is pretty slow, and none of the
  47353. // internal component options needs special treatment.
  47354. initInternalComponent(vm, options);
  47355. } else {
  47356. vm.$options = mergeOptions(
  47357. resolveConstructorOptions(vm.constructor),
  47358. options || {},
  47359. vm
  47360. );
  47361. }
  47362. /* istanbul ignore else */
  47363. {
  47364. initProxy(vm);
  47365. }
  47366. // expose real self
  47367. vm._self = vm;
  47368. initLifecycle(vm);
  47369. initEvents(vm);
  47370. initRender(vm);
  47371. callHook(vm, 'beforeCreate');
  47372. initInjections(vm); // resolve injections before data/props
  47373. initState(vm);
  47374. initProvide(vm); // resolve provide after data/props
  47375. callHook(vm, 'created');
  47376. /* istanbul ignore if */
  47377. if (config.performance && mark) {
  47378. vm._name = formatComponentName(vm, false);
  47379. mark(endTag);
  47380. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  47381. }
  47382. if (vm.$options.el) {
  47383. vm.$mount(vm.$options.el);
  47384. }
  47385. };
  47386. }
  47387. function initInternalComponent (vm, options) {
  47388. var opts = vm.$options = Object.create(vm.constructor.options);
  47389. // doing this because it's faster than dynamic enumeration.
  47390. var parentVnode = options._parentVnode;
  47391. opts.parent = options.parent;
  47392. opts._parentVnode = parentVnode;
  47393. var vnodeComponentOptions = parentVnode.componentOptions;
  47394. opts.propsData = vnodeComponentOptions.propsData;
  47395. opts._parentListeners = vnodeComponentOptions.listeners;
  47396. opts._renderChildren = vnodeComponentOptions.children;
  47397. opts._componentTag = vnodeComponentOptions.tag;
  47398. if (options.render) {
  47399. opts.render = options.render;
  47400. opts.staticRenderFns = options.staticRenderFns;
  47401. }
  47402. }
  47403. function resolveConstructorOptions (Ctor) {
  47404. var options = Ctor.options;
  47405. if (Ctor.super) {
  47406. var superOptions = resolveConstructorOptions(Ctor.super);
  47407. var cachedSuperOptions = Ctor.superOptions;
  47408. if (superOptions !== cachedSuperOptions) {
  47409. // super option changed,
  47410. // need to resolve new options.
  47411. Ctor.superOptions = superOptions;
  47412. // check if there are any late-modified/attached options (#4976)
  47413. var modifiedOptions = resolveModifiedOptions(Ctor);
  47414. // update base extend options
  47415. if (modifiedOptions) {
  47416. extend(Ctor.extendOptions, modifiedOptions);
  47417. }
  47418. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  47419. if (options.name) {
  47420. options.components[options.name] = Ctor;
  47421. }
  47422. }
  47423. }
  47424. return options
  47425. }
  47426. function resolveModifiedOptions (Ctor) {
  47427. var modified;
  47428. var latest = Ctor.options;
  47429. var sealed = Ctor.sealedOptions;
  47430. for (var key in latest) {
  47431. if (latest[key] !== sealed[key]) {
  47432. if (!modified) { modified = {}; }
  47433. modified[key] = latest[key];
  47434. }
  47435. }
  47436. return modified
  47437. }
  47438. function Vue (options) {
  47439. if (!(this instanceof Vue)
  47440. ) {
  47441. warn('Vue is a constructor and should be called with the `new` keyword');
  47442. }
  47443. this._init(options);
  47444. }
  47445. initMixin(Vue);
  47446. stateMixin(Vue);
  47447. eventsMixin(Vue);
  47448. lifecycleMixin(Vue);
  47449. renderMixin(Vue);
  47450. /* */
  47451. function initUse (Vue) {
  47452. Vue.use = function (plugin) {
  47453. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  47454. if (installedPlugins.indexOf(plugin) > -1) {
  47455. return this
  47456. }
  47457. // additional parameters
  47458. var args = toArray(arguments, 1);
  47459. args.unshift(this);
  47460. if (typeof plugin.install === 'function') {
  47461. plugin.install.apply(plugin, args);
  47462. } else if (typeof plugin === 'function') {
  47463. plugin.apply(null, args);
  47464. }
  47465. installedPlugins.push(plugin);
  47466. return this
  47467. };
  47468. }
  47469. /* */
  47470. function initMixin$1 (Vue) {
  47471. Vue.mixin = function (mixin) {
  47472. this.options = mergeOptions(this.options, mixin);
  47473. return this
  47474. };
  47475. }
  47476. /* */
  47477. function initExtend (Vue) {
  47478. /**
  47479. * Each instance constructor, including Vue, has a unique
  47480. * cid. This enables us to create wrapped "child
  47481. * constructors" for prototypal inheritance and cache them.
  47482. */
  47483. Vue.cid = 0;
  47484. var cid = 1;
  47485. /**
  47486. * Class inheritance
  47487. */
  47488. Vue.extend = function (extendOptions) {
  47489. extendOptions = extendOptions || {};
  47490. var Super = this;
  47491. var SuperId = Super.cid;
  47492. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  47493. if (cachedCtors[SuperId]) {
  47494. return cachedCtors[SuperId]
  47495. }
  47496. var name = extendOptions.name || Super.options.name;
  47497. if (name) {
  47498. validateComponentName(name);
  47499. }
  47500. var Sub = function VueComponent (options) {
  47501. this._init(options);
  47502. };
  47503. Sub.prototype = Object.create(Super.prototype);
  47504. Sub.prototype.constructor = Sub;
  47505. Sub.cid = cid++;
  47506. Sub.options = mergeOptions(
  47507. Super.options,
  47508. extendOptions
  47509. );
  47510. Sub['super'] = Super;
  47511. // For props and computed properties, we define the proxy getters on
  47512. // the Vue instances at extension time, on the extended prototype. This
  47513. // avoids Object.defineProperty calls for each instance created.
  47514. if (Sub.options.props) {
  47515. initProps$1(Sub);
  47516. }
  47517. if (Sub.options.computed) {
  47518. initComputed$1(Sub);
  47519. }
  47520. // allow further extension/mixin/plugin usage
  47521. Sub.extend = Super.extend;
  47522. Sub.mixin = Super.mixin;
  47523. Sub.use = Super.use;
  47524. // create asset registers, so extended classes
  47525. // can have their private assets too.
  47526. ASSET_TYPES.forEach(function (type) {
  47527. Sub[type] = Super[type];
  47528. });
  47529. // enable recursive self-lookup
  47530. if (name) {
  47531. Sub.options.components[name] = Sub;
  47532. }
  47533. // keep a reference to the super options at extension time.
  47534. // later at instantiation we can check if Super's options have
  47535. // been updated.
  47536. Sub.superOptions = Super.options;
  47537. Sub.extendOptions = extendOptions;
  47538. Sub.sealedOptions = extend({}, Sub.options);
  47539. // cache constructor
  47540. cachedCtors[SuperId] = Sub;
  47541. return Sub
  47542. };
  47543. }
  47544. function initProps$1 (Comp) {
  47545. var props = Comp.options.props;
  47546. for (var key in props) {
  47547. proxy(Comp.prototype, "_props", key);
  47548. }
  47549. }
  47550. function initComputed$1 (Comp) {
  47551. var computed = Comp.options.computed;
  47552. for (var key in computed) {
  47553. defineComputed(Comp.prototype, key, computed[key]);
  47554. }
  47555. }
  47556. /* */
  47557. function initAssetRegisters (Vue) {
  47558. /**
  47559. * Create asset registration methods.
  47560. */
  47561. ASSET_TYPES.forEach(function (type) {
  47562. Vue[type] = function (
  47563. id,
  47564. definition
  47565. ) {
  47566. if (!definition) {
  47567. return this.options[type + 's'][id]
  47568. } else {
  47569. /* istanbul ignore if */
  47570. if (type === 'component') {
  47571. validateComponentName(id);
  47572. }
  47573. if (type === 'component' && isPlainObject(definition)) {
  47574. definition.name = definition.name || id;
  47575. definition = this.options._base.extend(definition);
  47576. }
  47577. if (type === 'directive' && typeof definition === 'function') {
  47578. definition = { bind: definition, update: definition };
  47579. }
  47580. this.options[type + 's'][id] = definition;
  47581. return definition
  47582. }
  47583. };
  47584. });
  47585. }
  47586. /* */
  47587. function getComponentName (opts) {
  47588. return opts && (opts.Ctor.options.name || opts.tag)
  47589. }
  47590. function matches (pattern, name) {
  47591. if (Array.isArray(pattern)) {
  47592. return pattern.indexOf(name) > -1
  47593. } else if (typeof pattern === 'string') {
  47594. return pattern.split(',').indexOf(name) > -1
  47595. } else if (isRegExp(pattern)) {
  47596. return pattern.test(name)
  47597. }
  47598. /* istanbul ignore next */
  47599. return false
  47600. }
  47601. function pruneCache (keepAliveInstance, filter) {
  47602. var cache = keepAliveInstance.cache;
  47603. var keys = keepAliveInstance.keys;
  47604. var _vnode = keepAliveInstance._vnode;
  47605. for (var key in cache) {
  47606. var cachedNode = cache[key];
  47607. if (cachedNode) {
  47608. var name = getComponentName(cachedNode.componentOptions);
  47609. if (name && !filter(name)) {
  47610. pruneCacheEntry(cache, key, keys, _vnode);
  47611. }
  47612. }
  47613. }
  47614. }
  47615. function pruneCacheEntry (
  47616. cache,
  47617. key,
  47618. keys,
  47619. current
  47620. ) {
  47621. var cached$$1 = cache[key];
  47622. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  47623. cached$$1.componentInstance.$destroy();
  47624. }
  47625. cache[key] = null;
  47626. remove(keys, key);
  47627. }
  47628. var patternTypes = [String, RegExp, Array];
  47629. var KeepAlive = {
  47630. name: 'keep-alive',
  47631. abstract: true,
  47632. props: {
  47633. include: patternTypes,
  47634. exclude: patternTypes,
  47635. max: [String, Number]
  47636. },
  47637. created: function created () {
  47638. this.cache = Object.create(null);
  47639. this.keys = [];
  47640. },
  47641. destroyed: function destroyed () {
  47642. for (var key in this.cache) {
  47643. pruneCacheEntry(this.cache, key, this.keys);
  47644. }
  47645. },
  47646. mounted: function mounted () {
  47647. var this$1 = this;
  47648. this.$watch('include', function (val) {
  47649. pruneCache(this$1, function (name) { return matches(val, name); });
  47650. });
  47651. this.$watch('exclude', function (val) {
  47652. pruneCache(this$1, function (name) { return !matches(val, name); });
  47653. });
  47654. },
  47655. render: function render () {
  47656. var slot = this.$slots.default;
  47657. var vnode = getFirstComponentChild(slot);
  47658. var componentOptions = vnode && vnode.componentOptions;
  47659. if (componentOptions) {
  47660. // check pattern
  47661. var name = getComponentName(componentOptions);
  47662. var ref = this;
  47663. var include = ref.include;
  47664. var exclude = ref.exclude;
  47665. if (
  47666. // not included
  47667. (include && (!name || !matches(include, name))) ||
  47668. // excluded
  47669. (exclude && name && matches(exclude, name))
  47670. ) {
  47671. return vnode
  47672. }
  47673. var ref$1 = this;
  47674. var cache = ref$1.cache;
  47675. var keys = ref$1.keys;
  47676. var key = vnode.key == null
  47677. // same constructor may get registered as different local components
  47678. // so cid alone is not enough (#3269)
  47679. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  47680. : vnode.key;
  47681. if (cache[key]) {
  47682. vnode.componentInstance = cache[key].componentInstance;
  47683. // make current key freshest
  47684. remove(keys, key);
  47685. keys.push(key);
  47686. } else {
  47687. cache[key] = vnode;
  47688. keys.push(key);
  47689. // prune oldest entry
  47690. if (this.max && keys.length > parseInt(this.max)) {
  47691. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  47692. }
  47693. }
  47694. vnode.data.keepAlive = true;
  47695. }
  47696. return vnode || (slot && slot[0])
  47697. }
  47698. };
  47699. var builtInComponents = {
  47700. KeepAlive: KeepAlive
  47701. };
  47702. /* */
  47703. function initGlobalAPI (Vue) {
  47704. // config
  47705. var configDef = {};
  47706. configDef.get = function () { return config; };
  47707. {
  47708. configDef.set = function () {
  47709. warn(
  47710. 'Do not replace the Vue.config object, set individual fields instead.'
  47711. );
  47712. };
  47713. }
  47714. Object.defineProperty(Vue, 'config', configDef);
  47715. // exposed util methods.
  47716. // NOTE: these are not considered part of the public API - avoid relying on
  47717. // them unless you are aware of the risk.
  47718. Vue.util = {
  47719. warn: warn,
  47720. extend: extend,
  47721. mergeOptions: mergeOptions,
  47722. defineReactive: defineReactive$$1
  47723. };
  47724. Vue.set = set;
  47725. Vue.delete = del;
  47726. Vue.nextTick = nextTick;
  47727. // 2.6 explicit observable API
  47728. Vue.observable = function (obj) {
  47729. observe(obj);
  47730. return obj
  47731. };
  47732. Vue.options = Object.create(null);
  47733. ASSET_TYPES.forEach(function (type) {
  47734. Vue.options[type + 's'] = Object.create(null);
  47735. });
  47736. // this is used to identify the "base" constructor to extend all plain-object
  47737. // components with in Weex's multi-instance scenarios.
  47738. Vue.options._base = Vue;
  47739. extend(Vue.options.components, builtInComponents);
  47740. initUse(Vue);
  47741. initMixin$1(Vue);
  47742. initExtend(Vue);
  47743. initAssetRegisters(Vue);
  47744. }
  47745. initGlobalAPI(Vue);
  47746. Object.defineProperty(Vue.prototype, '$isServer', {
  47747. get: isServerRendering
  47748. });
  47749. Object.defineProperty(Vue.prototype, '$ssrContext', {
  47750. get: function get () {
  47751. /* istanbul ignore next */
  47752. return this.$vnode && this.$vnode.ssrContext
  47753. }
  47754. });
  47755. // expose FunctionalRenderContext for ssr runtime helper installation
  47756. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  47757. value: FunctionalRenderContext
  47758. });
  47759. Vue.version = '2.6.11';
  47760. /* */
  47761. // these are reserved for web because they are directly compiled away
  47762. // during template compilation
  47763. var isReservedAttr = makeMap('style,class');
  47764. // attributes that should be using props for binding
  47765. var acceptValue = makeMap('input,textarea,option,select,progress');
  47766. var mustUseProp = function (tag, type, attr) {
  47767. return (
  47768. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  47769. (attr === 'selected' && tag === 'option') ||
  47770. (attr === 'checked' && tag === 'input') ||
  47771. (attr === 'muted' && tag === 'video')
  47772. )
  47773. };
  47774. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  47775. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  47776. var convertEnumeratedValue = function (key, value) {
  47777. return isFalsyAttrValue(value) || value === 'false'
  47778. ? 'false'
  47779. // allow arbitrary string value for contenteditable
  47780. : key === 'contenteditable' && isValidContentEditableValue(value)
  47781. ? value
  47782. : 'true'
  47783. };
  47784. var isBooleanAttr = makeMap(
  47785. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  47786. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  47787. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  47788. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  47789. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  47790. 'truespeed,typemustmatch,visible'
  47791. );
  47792. var xlinkNS = 'http://www.w3.org/1999/xlink';
  47793. var isXlink = function (name) {
  47794. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  47795. };
  47796. var getXlinkProp = function (name) {
  47797. return isXlink(name) ? name.slice(6, name.length) : ''
  47798. };
  47799. var isFalsyAttrValue = function (val) {
  47800. return val == null || val === false
  47801. };
  47802. /* */
  47803. function genClassForVnode (vnode) {
  47804. var data = vnode.data;
  47805. var parentNode = vnode;
  47806. var childNode = vnode;
  47807. while (isDef(childNode.componentInstance)) {
  47808. childNode = childNode.componentInstance._vnode;
  47809. if (childNode && childNode.data) {
  47810. data = mergeClassData(childNode.data, data);
  47811. }
  47812. }
  47813. while (isDef(parentNode = parentNode.parent)) {
  47814. if (parentNode && parentNode.data) {
  47815. data = mergeClassData(data, parentNode.data);
  47816. }
  47817. }
  47818. return renderClass(data.staticClass, data.class)
  47819. }
  47820. function mergeClassData (child, parent) {
  47821. return {
  47822. staticClass: concat(child.staticClass, parent.staticClass),
  47823. class: isDef(child.class)
  47824. ? [child.class, parent.class]
  47825. : parent.class
  47826. }
  47827. }
  47828. function renderClass (
  47829. staticClass,
  47830. dynamicClass
  47831. ) {
  47832. if (isDef(staticClass) || isDef(dynamicClass)) {
  47833. return concat(staticClass, stringifyClass(dynamicClass))
  47834. }
  47835. /* istanbul ignore next */
  47836. return ''
  47837. }
  47838. function concat (a, b) {
  47839. return a ? b ? (a + ' ' + b) : a : (b || '')
  47840. }
  47841. function stringifyClass (value) {
  47842. if (Array.isArray(value)) {
  47843. return stringifyArray(value)
  47844. }
  47845. if (isObject(value)) {
  47846. return stringifyObject(value)
  47847. }
  47848. if (typeof value === 'string') {
  47849. return value
  47850. }
  47851. /* istanbul ignore next */
  47852. return ''
  47853. }
  47854. function stringifyArray (value) {
  47855. var res = '';
  47856. var stringified;
  47857. for (var i = 0, l = value.length; i < l; i++) {
  47858. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  47859. if (res) { res += ' '; }
  47860. res += stringified;
  47861. }
  47862. }
  47863. return res
  47864. }
  47865. function stringifyObject (value) {
  47866. var res = '';
  47867. for (var key in value) {
  47868. if (value[key]) {
  47869. if (res) { res += ' '; }
  47870. res += key;
  47871. }
  47872. }
  47873. return res
  47874. }
  47875. /* */
  47876. var namespaceMap = {
  47877. svg: 'http://www.w3.org/2000/svg',
  47878. math: 'http://www.w3.org/1998/Math/MathML'
  47879. };
  47880. var isHTMLTag = makeMap(
  47881. 'html,body,base,head,link,meta,style,title,' +
  47882. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  47883. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  47884. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  47885. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  47886. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  47887. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  47888. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  47889. 'output,progress,select,textarea,' +
  47890. 'details,dialog,menu,menuitem,summary,' +
  47891. 'content,element,shadow,template,blockquote,iframe,tfoot'
  47892. );
  47893. // this map is intentionally selective, only covering SVG elements that may
  47894. // contain child elements.
  47895. var isSVG = makeMap(
  47896. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  47897. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  47898. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  47899. true
  47900. );
  47901. var isPreTag = function (tag) { return tag === 'pre'; };
  47902. var isReservedTag = function (tag) {
  47903. return isHTMLTag(tag) || isSVG(tag)
  47904. };
  47905. function getTagNamespace (tag) {
  47906. if (isSVG(tag)) {
  47907. return 'svg'
  47908. }
  47909. // basic support for MathML
  47910. // note it doesn't support other MathML elements being component roots
  47911. if (tag === 'math') {
  47912. return 'math'
  47913. }
  47914. }
  47915. var unknownElementCache = Object.create(null);
  47916. function isUnknownElement (tag) {
  47917. /* istanbul ignore if */
  47918. if (!inBrowser) {
  47919. return true
  47920. }
  47921. if (isReservedTag(tag)) {
  47922. return false
  47923. }
  47924. tag = tag.toLowerCase();
  47925. /* istanbul ignore if */
  47926. if (unknownElementCache[tag] != null) {
  47927. return unknownElementCache[tag]
  47928. }
  47929. var el = document.createElement(tag);
  47930. if (tag.indexOf('-') > -1) {
  47931. // http://stackoverflow.com/a/28210364/1070244
  47932. return (unknownElementCache[tag] = (
  47933. el.constructor === window.HTMLUnknownElement ||
  47934. el.constructor === window.HTMLElement
  47935. ))
  47936. } else {
  47937. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  47938. }
  47939. }
  47940. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  47941. /* */
  47942. /**
  47943. * Query an element selector if it's not an element already.
  47944. */
  47945. function query (el) {
  47946. if (typeof el === 'string') {
  47947. var selected = document.querySelector(el);
  47948. if (!selected) {
  47949. warn(
  47950. 'Cannot find element: ' + el
  47951. );
  47952. return document.createElement('div')
  47953. }
  47954. return selected
  47955. } else {
  47956. return el
  47957. }
  47958. }
  47959. /* */
  47960. function createElement$1 (tagName, vnode) {
  47961. var elm = document.createElement(tagName);
  47962. if (tagName !== 'select') {
  47963. return elm
  47964. }
  47965. // false or null will remove the attribute but undefined will not
  47966. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  47967. elm.setAttribute('multiple', 'multiple');
  47968. }
  47969. return elm
  47970. }
  47971. function createElementNS (namespace, tagName) {
  47972. return document.createElementNS(namespaceMap[namespace], tagName)
  47973. }
  47974. function createTextNode (text) {
  47975. return document.createTextNode(text)
  47976. }
  47977. function createComment (text) {
  47978. return document.createComment(text)
  47979. }
  47980. function insertBefore (parentNode, newNode, referenceNode) {
  47981. parentNode.insertBefore(newNode, referenceNode);
  47982. }
  47983. function removeChild (node, child) {
  47984. node.removeChild(child);
  47985. }
  47986. function appendChild (node, child) {
  47987. node.appendChild(child);
  47988. }
  47989. function parentNode (node) {
  47990. return node.parentNode
  47991. }
  47992. function nextSibling (node) {
  47993. return node.nextSibling
  47994. }
  47995. function tagName (node) {
  47996. return node.tagName
  47997. }
  47998. function setTextContent (node, text) {
  47999. node.textContent = text;
  48000. }
  48001. function setStyleScope (node, scopeId) {
  48002. node.setAttribute(scopeId, '');
  48003. }
  48004. var nodeOps = /*#__PURE__*/Object.freeze({
  48005. createElement: createElement$1,
  48006. createElementNS: createElementNS,
  48007. createTextNode: createTextNode,
  48008. createComment: createComment,
  48009. insertBefore: insertBefore,
  48010. removeChild: removeChild,
  48011. appendChild: appendChild,
  48012. parentNode: parentNode,
  48013. nextSibling: nextSibling,
  48014. tagName: tagName,
  48015. setTextContent: setTextContent,
  48016. setStyleScope: setStyleScope
  48017. });
  48018. /* */
  48019. var ref = {
  48020. create: function create (_, vnode) {
  48021. registerRef(vnode);
  48022. },
  48023. update: function update (oldVnode, vnode) {
  48024. if (oldVnode.data.ref !== vnode.data.ref) {
  48025. registerRef(oldVnode, true);
  48026. registerRef(vnode);
  48027. }
  48028. },
  48029. destroy: function destroy (vnode) {
  48030. registerRef(vnode, true);
  48031. }
  48032. };
  48033. function registerRef (vnode, isRemoval) {
  48034. var key = vnode.data.ref;
  48035. if (!isDef(key)) { return }
  48036. var vm = vnode.context;
  48037. var ref = vnode.componentInstance || vnode.elm;
  48038. var refs = vm.$refs;
  48039. if (isRemoval) {
  48040. if (Array.isArray(refs[key])) {
  48041. remove(refs[key], ref);
  48042. } else if (refs[key] === ref) {
  48043. refs[key] = undefined;
  48044. }
  48045. } else {
  48046. if (vnode.data.refInFor) {
  48047. if (!Array.isArray(refs[key])) {
  48048. refs[key] = [ref];
  48049. } else if (refs[key].indexOf(ref) < 0) {
  48050. // $flow-disable-line
  48051. refs[key].push(ref);
  48052. }
  48053. } else {
  48054. refs[key] = ref;
  48055. }
  48056. }
  48057. }
  48058. /**
  48059. * Virtual DOM patching algorithm based on Snabbdom by
  48060. * Simon Friis Vindum (@paldepind)
  48061. * Licensed under the MIT License
  48062. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  48063. *
  48064. * modified by Evan You (@yyx990803)
  48065. *
  48066. * Not type-checking this because this file is perf-critical and the cost
  48067. * of making flow understand it is not worth it.
  48068. */
  48069. var emptyNode = new VNode('', {}, []);
  48070. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  48071. function sameVnode (a, b) {
  48072. return (
  48073. a.key === b.key && (
  48074. (
  48075. a.tag === b.tag &&
  48076. a.isComment === b.isComment &&
  48077. isDef(a.data) === isDef(b.data) &&
  48078. sameInputType(a, b)
  48079. ) || (
  48080. isTrue(a.isAsyncPlaceholder) &&
  48081. a.asyncFactory === b.asyncFactory &&
  48082. isUndef(b.asyncFactory.error)
  48083. )
  48084. )
  48085. )
  48086. }
  48087. function sameInputType (a, b) {
  48088. if (a.tag !== 'input') { return true }
  48089. var i;
  48090. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  48091. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  48092. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  48093. }
  48094. function createKeyToOldIdx (children, beginIdx, endIdx) {
  48095. var i, key;
  48096. var map = {};
  48097. for (i = beginIdx; i <= endIdx; ++i) {
  48098. key = children[i].key;
  48099. if (isDef(key)) { map[key] = i; }
  48100. }
  48101. return map
  48102. }
  48103. function createPatchFunction (backend) {
  48104. var i, j;
  48105. var cbs = {};
  48106. var modules = backend.modules;
  48107. var nodeOps = backend.nodeOps;
  48108. for (i = 0; i < hooks.length; ++i) {
  48109. cbs[hooks[i]] = [];
  48110. for (j = 0; j < modules.length; ++j) {
  48111. if (isDef(modules[j][hooks[i]])) {
  48112. cbs[hooks[i]].push(modules[j][hooks[i]]);
  48113. }
  48114. }
  48115. }
  48116. function emptyNodeAt (elm) {
  48117. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  48118. }
  48119. function createRmCb (childElm, listeners) {
  48120. function remove$$1 () {
  48121. if (--remove$$1.listeners === 0) {
  48122. removeNode(childElm);
  48123. }
  48124. }
  48125. remove$$1.listeners = listeners;
  48126. return remove$$1
  48127. }
  48128. function removeNode (el) {
  48129. var parent = nodeOps.parentNode(el);
  48130. // element may have already been removed due to v-html / v-text
  48131. if (isDef(parent)) {
  48132. nodeOps.removeChild(parent, el);
  48133. }
  48134. }
  48135. function isUnknownElement$$1 (vnode, inVPre) {
  48136. return (
  48137. !inVPre &&
  48138. !vnode.ns &&
  48139. !(
  48140. config.ignoredElements.length &&
  48141. config.ignoredElements.some(function (ignore) {
  48142. return isRegExp(ignore)
  48143. ? ignore.test(vnode.tag)
  48144. : ignore === vnode.tag
  48145. })
  48146. ) &&
  48147. config.isUnknownElement(vnode.tag)
  48148. )
  48149. }
  48150. var creatingElmInVPre = 0;
  48151. function createElm (
  48152. vnode,
  48153. insertedVnodeQueue,
  48154. parentElm,
  48155. refElm,
  48156. nested,
  48157. ownerArray,
  48158. index
  48159. ) {
  48160. if (isDef(vnode.elm) && isDef(ownerArray)) {
  48161. // This vnode was used in a previous render!
  48162. // now it's used as a new node, overwriting its elm would cause
  48163. // potential patch errors down the road when it's used as an insertion
  48164. // reference node. Instead, we clone the node on-demand before creating
  48165. // associated DOM element for it.
  48166. vnode = ownerArray[index] = cloneVNode(vnode);
  48167. }
  48168. vnode.isRootInsert = !nested; // for transition enter check
  48169. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  48170. return
  48171. }
  48172. var data = vnode.data;
  48173. var children = vnode.children;
  48174. var tag = vnode.tag;
  48175. if (isDef(tag)) {
  48176. {
  48177. if (data && data.pre) {
  48178. creatingElmInVPre++;
  48179. }
  48180. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  48181. warn(
  48182. 'Unknown custom element: <' + tag + '> - did you ' +
  48183. 'register the component correctly? For recursive components, ' +
  48184. 'make sure to provide the "name" option.',
  48185. vnode.context
  48186. );
  48187. }
  48188. }
  48189. vnode.elm = vnode.ns
  48190. ? nodeOps.createElementNS(vnode.ns, tag)
  48191. : nodeOps.createElement(tag, vnode);
  48192. setScope(vnode);
  48193. /* istanbul ignore if */
  48194. {
  48195. createChildren(vnode, children, insertedVnodeQueue);
  48196. if (isDef(data)) {
  48197. invokeCreateHooks(vnode, insertedVnodeQueue);
  48198. }
  48199. insert(parentElm, vnode.elm, refElm);
  48200. }
  48201. if (data && data.pre) {
  48202. creatingElmInVPre--;
  48203. }
  48204. } else if (isTrue(vnode.isComment)) {
  48205. vnode.elm = nodeOps.createComment(vnode.text);
  48206. insert(parentElm, vnode.elm, refElm);
  48207. } else {
  48208. vnode.elm = nodeOps.createTextNode(vnode.text);
  48209. insert(parentElm, vnode.elm, refElm);
  48210. }
  48211. }
  48212. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  48213. var i = vnode.data;
  48214. if (isDef(i)) {
  48215. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  48216. if (isDef(i = i.hook) && isDef(i = i.init)) {
  48217. i(vnode, false /* hydrating */);
  48218. }
  48219. // after calling the init hook, if the vnode is a child component
  48220. // it should've created a child instance and mounted it. the child
  48221. // component also has set the placeholder vnode's elm.
  48222. // in that case we can just return the element and be done.
  48223. if (isDef(vnode.componentInstance)) {
  48224. initComponent(vnode, insertedVnodeQueue);
  48225. insert(parentElm, vnode.elm, refElm);
  48226. if (isTrue(isReactivated)) {
  48227. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  48228. }
  48229. return true
  48230. }
  48231. }
  48232. }
  48233. function initComponent (vnode, insertedVnodeQueue) {
  48234. if (isDef(vnode.data.pendingInsert)) {
  48235. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  48236. vnode.data.pendingInsert = null;
  48237. }
  48238. vnode.elm = vnode.componentInstance.$el;
  48239. if (isPatchable(vnode)) {
  48240. invokeCreateHooks(vnode, insertedVnodeQueue);
  48241. setScope(vnode);
  48242. } else {
  48243. // empty component root.
  48244. // skip all element-related modules except for ref (#3455)
  48245. registerRef(vnode);
  48246. // make sure to invoke the insert hook
  48247. insertedVnodeQueue.push(vnode);
  48248. }
  48249. }
  48250. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  48251. var i;
  48252. // hack for #4339: a reactivated component with inner transition
  48253. // does not trigger because the inner node's created hooks are not called
  48254. // again. It's not ideal to involve module-specific logic in here but
  48255. // there doesn't seem to be a better way to do it.
  48256. var innerNode = vnode;
  48257. while (innerNode.componentInstance) {
  48258. innerNode = innerNode.componentInstance._vnode;
  48259. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  48260. for (i = 0; i < cbs.activate.length; ++i) {
  48261. cbs.activate[i](emptyNode, innerNode);
  48262. }
  48263. insertedVnodeQueue.push(innerNode);
  48264. break
  48265. }
  48266. }
  48267. // unlike a newly created component,
  48268. // a reactivated keep-alive component doesn't insert itself
  48269. insert(parentElm, vnode.elm, refElm);
  48270. }
  48271. function insert (parent, elm, ref$$1) {
  48272. if (isDef(parent)) {
  48273. if (isDef(ref$$1)) {
  48274. if (nodeOps.parentNode(ref$$1) === parent) {
  48275. nodeOps.insertBefore(parent, elm, ref$$1);
  48276. }
  48277. } else {
  48278. nodeOps.appendChild(parent, elm);
  48279. }
  48280. }
  48281. }
  48282. function createChildren (vnode, children, insertedVnodeQueue) {
  48283. if (Array.isArray(children)) {
  48284. {
  48285. checkDuplicateKeys(children);
  48286. }
  48287. for (var i = 0; i < children.length; ++i) {
  48288. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  48289. }
  48290. } else if (isPrimitive(vnode.text)) {
  48291. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  48292. }
  48293. }
  48294. function isPatchable (vnode) {
  48295. while (vnode.componentInstance) {
  48296. vnode = vnode.componentInstance._vnode;
  48297. }
  48298. return isDef(vnode.tag)
  48299. }
  48300. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  48301. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  48302. cbs.create[i$1](emptyNode, vnode);
  48303. }
  48304. i = vnode.data.hook; // Reuse variable
  48305. if (isDef(i)) {
  48306. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  48307. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  48308. }
  48309. }
  48310. // set scope id attribute for scoped CSS.
  48311. // this is implemented as a special case to avoid the overhead
  48312. // of going through the normal attribute patching process.
  48313. function setScope (vnode) {
  48314. var i;
  48315. if (isDef(i = vnode.fnScopeId)) {
  48316. nodeOps.setStyleScope(vnode.elm, i);
  48317. } else {
  48318. var ancestor = vnode;
  48319. while (ancestor) {
  48320. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  48321. nodeOps.setStyleScope(vnode.elm, i);
  48322. }
  48323. ancestor = ancestor.parent;
  48324. }
  48325. }
  48326. // for slot content they should also get the scopeId from the host instance.
  48327. if (isDef(i = activeInstance) &&
  48328. i !== vnode.context &&
  48329. i !== vnode.fnContext &&
  48330. isDef(i = i.$options._scopeId)
  48331. ) {
  48332. nodeOps.setStyleScope(vnode.elm, i);
  48333. }
  48334. }
  48335. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  48336. for (; startIdx <= endIdx; ++startIdx) {
  48337. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  48338. }
  48339. }
  48340. function invokeDestroyHook (vnode) {
  48341. var i, j;
  48342. var data = vnode.data;
  48343. if (isDef(data)) {
  48344. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  48345. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  48346. }
  48347. if (isDef(i = vnode.children)) {
  48348. for (j = 0; j < vnode.children.length; ++j) {
  48349. invokeDestroyHook(vnode.children[j]);
  48350. }
  48351. }
  48352. }
  48353. function removeVnodes (vnodes, startIdx, endIdx) {
  48354. for (; startIdx <= endIdx; ++startIdx) {
  48355. var ch = vnodes[startIdx];
  48356. if (isDef(ch)) {
  48357. if (isDef(ch.tag)) {
  48358. removeAndInvokeRemoveHook(ch);
  48359. invokeDestroyHook(ch);
  48360. } else { // Text node
  48361. removeNode(ch.elm);
  48362. }
  48363. }
  48364. }
  48365. }
  48366. function removeAndInvokeRemoveHook (vnode, rm) {
  48367. if (isDef(rm) || isDef(vnode.data)) {
  48368. var i;
  48369. var listeners = cbs.remove.length + 1;
  48370. if (isDef(rm)) {
  48371. // we have a recursively passed down rm callback
  48372. // increase the listeners count
  48373. rm.listeners += listeners;
  48374. } else {
  48375. // directly removing
  48376. rm = createRmCb(vnode.elm, listeners);
  48377. }
  48378. // recursively invoke hooks on child component root node
  48379. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  48380. removeAndInvokeRemoveHook(i, rm);
  48381. }
  48382. for (i = 0; i < cbs.remove.length; ++i) {
  48383. cbs.remove[i](vnode, rm);
  48384. }
  48385. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  48386. i(vnode, rm);
  48387. } else {
  48388. rm();
  48389. }
  48390. } else {
  48391. removeNode(vnode.elm);
  48392. }
  48393. }
  48394. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  48395. var oldStartIdx = 0;
  48396. var newStartIdx = 0;
  48397. var oldEndIdx = oldCh.length - 1;
  48398. var oldStartVnode = oldCh[0];
  48399. var oldEndVnode = oldCh[oldEndIdx];
  48400. var newEndIdx = newCh.length - 1;
  48401. var newStartVnode = newCh[0];
  48402. var newEndVnode = newCh[newEndIdx];
  48403. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  48404. // removeOnly is a special flag used only by <transition-group>
  48405. // to ensure removed elements stay in correct relative positions
  48406. // during leaving transitions
  48407. var canMove = !removeOnly;
  48408. {
  48409. checkDuplicateKeys(newCh);
  48410. }
  48411. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  48412. if (isUndef(oldStartVnode)) {
  48413. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  48414. } else if (isUndef(oldEndVnode)) {
  48415. oldEndVnode = oldCh[--oldEndIdx];
  48416. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  48417. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  48418. oldStartVnode = oldCh[++oldStartIdx];
  48419. newStartVnode = newCh[++newStartIdx];
  48420. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  48421. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  48422. oldEndVnode = oldCh[--oldEndIdx];
  48423. newEndVnode = newCh[--newEndIdx];
  48424. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  48425. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  48426. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  48427. oldStartVnode = oldCh[++oldStartIdx];
  48428. newEndVnode = newCh[--newEndIdx];
  48429. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  48430. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  48431. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  48432. oldEndVnode = oldCh[--oldEndIdx];
  48433. newStartVnode = newCh[++newStartIdx];
  48434. } else {
  48435. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  48436. idxInOld = isDef(newStartVnode.key)
  48437. ? oldKeyToIdx[newStartVnode.key]
  48438. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  48439. if (isUndef(idxInOld)) { // New element
  48440. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  48441. } else {
  48442. vnodeToMove = oldCh[idxInOld];
  48443. if (sameVnode(vnodeToMove, newStartVnode)) {
  48444. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  48445. oldCh[idxInOld] = undefined;
  48446. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  48447. } else {
  48448. // same key but different element. treat as new element
  48449. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  48450. }
  48451. }
  48452. newStartVnode = newCh[++newStartIdx];
  48453. }
  48454. }
  48455. if (oldStartIdx > oldEndIdx) {
  48456. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  48457. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  48458. } else if (newStartIdx > newEndIdx) {
  48459. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  48460. }
  48461. }
  48462. function checkDuplicateKeys (children) {
  48463. var seenKeys = {};
  48464. for (var i = 0; i < children.length; i++) {
  48465. var vnode = children[i];
  48466. var key = vnode.key;
  48467. if (isDef(key)) {
  48468. if (seenKeys[key]) {
  48469. warn(
  48470. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  48471. vnode.context
  48472. );
  48473. } else {
  48474. seenKeys[key] = true;
  48475. }
  48476. }
  48477. }
  48478. }
  48479. function findIdxInOld (node, oldCh, start, end) {
  48480. for (var i = start; i < end; i++) {
  48481. var c = oldCh[i];
  48482. if (isDef(c) && sameVnode(node, c)) { return i }
  48483. }
  48484. }
  48485. function patchVnode (
  48486. oldVnode,
  48487. vnode,
  48488. insertedVnodeQueue,
  48489. ownerArray,
  48490. index,
  48491. removeOnly
  48492. ) {
  48493. if (oldVnode === vnode) {
  48494. return
  48495. }
  48496. if (isDef(vnode.elm) && isDef(ownerArray)) {
  48497. // clone reused vnode
  48498. vnode = ownerArray[index] = cloneVNode(vnode);
  48499. }
  48500. var elm = vnode.elm = oldVnode.elm;
  48501. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  48502. if (isDef(vnode.asyncFactory.resolved)) {
  48503. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  48504. } else {
  48505. vnode.isAsyncPlaceholder = true;
  48506. }
  48507. return
  48508. }
  48509. // reuse element for static trees.
  48510. // note we only do this if the vnode is cloned -
  48511. // if the new node is not cloned it means the render functions have been
  48512. // reset by the hot-reload-api and we need to do a proper re-render.
  48513. if (isTrue(vnode.isStatic) &&
  48514. isTrue(oldVnode.isStatic) &&
  48515. vnode.key === oldVnode.key &&
  48516. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  48517. ) {
  48518. vnode.componentInstance = oldVnode.componentInstance;
  48519. return
  48520. }
  48521. var i;
  48522. var data = vnode.data;
  48523. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  48524. i(oldVnode, vnode);
  48525. }
  48526. var oldCh = oldVnode.children;
  48527. var ch = vnode.children;
  48528. if (isDef(data) && isPatchable(vnode)) {
  48529. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  48530. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  48531. }
  48532. if (isUndef(vnode.text)) {
  48533. if (isDef(oldCh) && isDef(ch)) {
  48534. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  48535. } else if (isDef(ch)) {
  48536. {
  48537. checkDuplicateKeys(ch);
  48538. }
  48539. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  48540. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  48541. } else if (isDef(oldCh)) {
  48542. removeVnodes(oldCh, 0, oldCh.length - 1);
  48543. } else if (isDef(oldVnode.text)) {
  48544. nodeOps.setTextContent(elm, '');
  48545. }
  48546. } else if (oldVnode.text !== vnode.text) {
  48547. nodeOps.setTextContent(elm, vnode.text);
  48548. }
  48549. if (isDef(data)) {
  48550. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  48551. }
  48552. }
  48553. function invokeInsertHook (vnode, queue, initial) {
  48554. // delay insert hooks for component root nodes, invoke them after the
  48555. // element is really inserted
  48556. if (isTrue(initial) && isDef(vnode.parent)) {
  48557. vnode.parent.data.pendingInsert = queue;
  48558. } else {
  48559. for (var i = 0; i < queue.length; ++i) {
  48560. queue[i].data.hook.insert(queue[i]);
  48561. }
  48562. }
  48563. }
  48564. var hydrationBailed = false;
  48565. // list of modules that can skip create hook during hydration because they
  48566. // are already rendered on the client or has no need for initialization
  48567. // Note: style is excluded because it relies on initial clone for future
  48568. // deep updates (#7063).
  48569. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  48570. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  48571. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  48572. var i;
  48573. var tag = vnode.tag;
  48574. var data = vnode.data;
  48575. var children = vnode.children;
  48576. inVPre = inVPre || (data && data.pre);
  48577. vnode.elm = elm;
  48578. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  48579. vnode.isAsyncPlaceholder = true;
  48580. return true
  48581. }
  48582. // assert node match
  48583. {
  48584. if (!assertNodeMatch(elm, vnode, inVPre)) {
  48585. return false
  48586. }
  48587. }
  48588. if (isDef(data)) {
  48589. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  48590. if (isDef(i = vnode.componentInstance)) {
  48591. // child component. it should have hydrated its own tree.
  48592. initComponent(vnode, insertedVnodeQueue);
  48593. return true
  48594. }
  48595. }
  48596. if (isDef(tag)) {
  48597. if (isDef(children)) {
  48598. // empty element, allow client to pick up and populate children
  48599. if (!elm.hasChildNodes()) {
  48600. createChildren(vnode, children, insertedVnodeQueue);
  48601. } else {
  48602. // v-html and domProps: innerHTML
  48603. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  48604. if (i !== elm.innerHTML) {
  48605. /* istanbul ignore if */
  48606. if (typeof console !== 'undefined' &&
  48607. !hydrationBailed
  48608. ) {
  48609. hydrationBailed = true;
  48610. console.warn('Parent: ', elm);
  48611. console.warn('server innerHTML: ', i);
  48612. console.warn('client innerHTML: ', elm.innerHTML);
  48613. }
  48614. return false
  48615. }
  48616. } else {
  48617. // iterate and compare children lists
  48618. var childrenMatch = true;
  48619. var childNode = elm.firstChild;
  48620. for (var i$1 = 0; i$1 < children.length; i$1++) {
  48621. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  48622. childrenMatch = false;
  48623. break
  48624. }
  48625. childNode = childNode.nextSibling;
  48626. }
  48627. // if childNode is not null, it means the actual childNodes list is
  48628. // longer than the virtual children list.
  48629. if (!childrenMatch || childNode) {
  48630. /* istanbul ignore if */
  48631. if (typeof console !== 'undefined' &&
  48632. !hydrationBailed
  48633. ) {
  48634. hydrationBailed = true;
  48635. console.warn('Parent: ', elm);
  48636. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  48637. }
  48638. return false
  48639. }
  48640. }
  48641. }
  48642. }
  48643. if (isDef(data)) {
  48644. var fullInvoke = false;
  48645. for (var key in data) {
  48646. if (!isRenderedModule(key)) {
  48647. fullInvoke = true;
  48648. invokeCreateHooks(vnode, insertedVnodeQueue);
  48649. break
  48650. }
  48651. }
  48652. if (!fullInvoke && data['class']) {
  48653. // ensure collecting deps for deep class bindings for future updates
  48654. traverse(data['class']);
  48655. }
  48656. }
  48657. } else if (elm.data !== vnode.text) {
  48658. elm.data = vnode.text;
  48659. }
  48660. return true
  48661. }
  48662. function assertNodeMatch (node, vnode, inVPre) {
  48663. if (isDef(vnode.tag)) {
  48664. return vnode.tag.indexOf('vue-component') === 0 || (
  48665. !isUnknownElement$$1(vnode, inVPre) &&
  48666. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  48667. )
  48668. } else {
  48669. return node.nodeType === (vnode.isComment ? 8 : 3)
  48670. }
  48671. }
  48672. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  48673. if (isUndef(vnode)) {
  48674. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  48675. return
  48676. }
  48677. var isInitialPatch = false;
  48678. var insertedVnodeQueue = [];
  48679. if (isUndef(oldVnode)) {
  48680. // empty mount (likely as component), create new root element
  48681. isInitialPatch = true;
  48682. createElm(vnode, insertedVnodeQueue);
  48683. } else {
  48684. var isRealElement = isDef(oldVnode.nodeType);
  48685. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  48686. // patch existing root node
  48687. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  48688. } else {
  48689. if (isRealElement) {
  48690. // mounting to a real element
  48691. // check if this is server-rendered content and if we can perform
  48692. // a successful hydration.
  48693. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  48694. oldVnode.removeAttribute(SSR_ATTR);
  48695. hydrating = true;
  48696. }
  48697. if (isTrue(hydrating)) {
  48698. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  48699. invokeInsertHook(vnode, insertedVnodeQueue, true);
  48700. return oldVnode
  48701. } else {
  48702. warn(
  48703. 'The client-side rendered virtual DOM tree is not matching ' +
  48704. 'server-rendered content. This is likely caused by incorrect ' +
  48705. 'HTML markup, for example nesting block-level elements inside ' +
  48706. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  48707. 'full client-side render.'
  48708. );
  48709. }
  48710. }
  48711. // either not server-rendered, or hydration failed.
  48712. // create an empty node and replace it
  48713. oldVnode = emptyNodeAt(oldVnode);
  48714. }
  48715. // replacing existing element
  48716. var oldElm = oldVnode.elm;
  48717. var parentElm = nodeOps.parentNode(oldElm);
  48718. // create new node
  48719. createElm(
  48720. vnode,
  48721. insertedVnodeQueue,
  48722. // extremely rare edge case: do not insert if old element is in a
  48723. // leaving transition. Only happens when combining transition +
  48724. // keep-alive + HOCs. (#4590)
  48725. oldElm._leaveCb ? null : parentElm,
  48726. nodeOps.nextSibling(oldElm)
  48727. );
  48728. // update parent placeholder node element, recursively
  48729. if (isDef(vnode.parent)) {
  48730. var ancestor = vnode.parent;
  48731. var patchable = isPatchable(vnode);
  48732. while (ancestor) {
  48733. for (var i = 0; i < cbs.destroy.length; ++i) {
  48734. cbs.destroy[i](ancestor);
  48735. }
  48736. ancestor.elm = vnode.elm;
  48737. if (patchable) {
  48738. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  48739. cbs.create[i$1](emptyNode, ancestor);
  48740. }
  48741. // #6513
  48742. // invoke insert hooks that may have been merged by create hooks.
  48743. // e.g. for directives that uses the "inserted" hook.
  48744. var insert = ancestor.data.hook.insert;
  48745. if (insert.merged) {
  48746. // start at index 1 to avoid re-invoking component mounted hook
  48747. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  48748. insert.fns[i$2]();
  48749. }
  48750. }
  48751. } else {
  48752. registerRef(ancestor);
  48753. }
  48754. ancestor = ancestor.parent;
  48755. }
  48756. }
  48757. // destroy old node
  48758. if (isDef(parentElm)) {
  48759. removeVnodes([oldVnode], 0, 0);
  48760. } else if (isDef(oldVnode.tag)) {
  48761. invokeDestroyHook(oldVnode);
  48762. }
  48763. }
  48764. }
  48765. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  48766. return vnode.elm
  48767. }
  48768. }
  48769. /* */
  48770. var directives = {
  48771. create: updateDirectives,
  48772. update: updateDirectives,
  48773. destroy: function unbindDirectives (vnode) {
  48774. updateDirectives(vnode, emptyNode);
  48775. }
  48776. };
  48777. function updateDirectives (oldVnode, vnode) {
  48778. if (oldVnode.data.directives || vnode.data.directives) {
  48779. _update(oldVnode, vnode);
  48780. }
  48781. }
  48782. function _update (oldVnode, vnode) {
  48783. var isCreate = oldVnode === emptyNode;
  48784. var isDestroy = vnode === emptyNode;
  48785. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  48786. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  48787. var dirsWithInsert = [];
  48788. var dirsWithPostpatch = [];
  48789. var key, oldDir, dir;
  48790. for (key in newDirs) {
  48791. oldDir = oldDirs[key];
  48792. dir = newDirs[key];
  48793. if (!oldDir) {
  48794. // new directive, bind
  48795. callHook$1(dir, 'bind', vnode, oldVnode);
  48796. if (dir.def && dir.def.inserted) {
  48797. dirsWithInsert.push(dir);
  48798. }
  48799. } else {
  48800. // existing directive, update
  48801. dir.oldValue = oldDir.value;
  48802. dir.oldArg = oldDir.arg;
  48803. callHook$1(dir, 'update', vnode, oldVnode);
  48804. if (dir.def && dir.def.componentUpdated) {
  48805. dirsWithPostpatch.push(dir);
  48806. }
  48807. }
  48808. }
  48809. if (dirsWithInsert.length) {
  48810. var callInsert = function () {
  48811. for (var i = 0; i < dirsWithInsert.length; i++) {
  48812. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  48813. }
  48814. };
  48815. if (isCreate) {
  48816. mergeVNodeHook(vnode, 'insert', callInsert);
  48817. } else {
  48818. callInsert();
  48819. }
  48820. }
  48821. if (dirsWithPostpatch.length) {
  48822. mergeVNodeHook(vnode, 'postpatch', function () {
  48823. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  48824. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  48825. }
  48826. });
  48827. }
  48828. if (!isCreate) {
  48829. for (key in oldDirs) {
  48830. if (!newDirs[key]) {
  48831. // no longer present, unbind
  48832. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  48833. }
  48834. }
  48835. }
  48836. }
  48837. var emptyModifiers = Object.create(null);
  48838. function normalizeDirectives$1 (
  48839. dirs,
  48840. vm
  48841. ) {
  48842. var res = Object.create(null);
  48843. if (!dirs) {
  48844. // $flow-disable-line
  48845. return res
  48846. }
  48847. var i, dir;
  48848. for (i = 0; i < dirs.length; i++) {
  48849. dir = dirs[i];
  48850. if (!dir.modifiers) {
  48851. // $flow-disable-line
  48852. dir.modifiers = emptyModifiers;
  48853. }
  48854. res[getRawDirName(dir)] = dir;
  48855. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  48856. }
  48857. // $flow-disable-line
  48858. return res
  48859. }
  48860. function getRawDirName (dir) {
  48861. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  48862. }
  48863. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  48864. var fn = dir.def && dir.def[hook];
  48865. if (fn) {
  48866. try {
  48867. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  48868. } catch (e) {
  48869. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  48870. }
  48871. }
  48872. }
  48873. var baseModules = [
  48874. ref,
  48875. directives
  48876. ];
  48877. /* */
  48878. function updateAttrs (oldVnode, vnode) {
  48879. var opts = vnode.componentOptions;
  48880. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  48881. return
  48882. }
  48883. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  48884. return
  48885. }
  48886. var key, cur, old;
  48887. var elm = vnode.elm;
  48888. var oldAttrs = oldVnode.data.attrs || {};
  48889. var attrs = vnode.data.attrs || {};
  48890. // clone observed objects, as the user probably wants to mutate it
  48891. if (isDef(attrs.__ob__)) {
  48892. attrs = vnode.data.attrs = extend({}, attrs);
  48893. }
  48894. for (key in attrs) {
  48895. cur = attrs[key];
  48896. old = oldAttrs[key];
  48897. if (old !== cur) {
  48898. setAttr(elm, key, cur);
  48899. }
  48900. }
  48901. // #4391: in IE9, setting type can reset value for input[type=radio]
  48902. // #6666: IE/Edge forces progress value down to 1 before setting a max
  48903. /* istanbul ignore if */
  48904. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  48905. setAttr(elm, 'value', attrs.value);
  48906. }
  48907. for (key in oldAttrs) {
  48908. if (isUndef(attrs[key])) {
  48909. if (isXlink(key)) {
  48910. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  48911. } else if (!isEnumeratedAttr(key)) {
  48912. elm.removeAttribute(key);
  48913. }
  48914. }
  48915. }
  48916. }
  48917. function setAttr (el, key, value) {
  48918. if (el.tagName.indexOf('-') > -1) {
  48919. baseSetAttr(el, key, value);
  48920. } else if (isBooleanAttr(key)) {
  48921. // set attribute for blank value
  48922. // e.g. <option disabled>Select one</option>
  48923. if (isFalsyAttrValue(value)) {
  48924. el.removeAttribute(key);
  48925. } else {
  48926. // technically allowfullscreen is a boolean attribute for <iframe>,
  48927. // but Flash expects a value of "true" when used on <embed> tag
  48928. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  48929. ? 'true'
  48930. : key;
  48931. el.setAttribute(key, value);
  48932. }
  48933. } else if (isEnumeratedAttr(key)) {
  48934. el.setAttribute(key, convertEnumeratedValue(key, value));
  48935. } else if (isXlink(key)) {
  48936. if (isFalsyAttrValue(value)) {
  48937. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  48938. } else {
  48939. el.setAttributeNS(xlinkNS, key, value);
  48940. }
  48941. } else {
  48942. baseSetAttr(el, key, value);
  48943. }
  48944. }
  48945. function baseSetAttr (el, key, value) {
  48946. if (isFalsyAttrValue(value)) {
  48947. el.removeAttribute(key);
  48948. } else {
  48949. // #7138: IE10 & 11 fires input event when setting placeholder on
  48950. // <textarea>... block the first input event and remove the blocker
  48951. // immediately.
  48952. /* istanbul ignore if */
  48953. if (
  48954. isIE && !isIE9 &&
  48955. el.tagName === 'TEXTAREA' &&
  48956. key === 'placeholder' && value !== '' && !el.__ieph
  48957. ) {
  48958. var blocker = function (e) {
  48959. e.stopImmediatePropagation();
  48960. el.removeEventListener('input', blocker);
  48961. };
  48962. el.addEventListener('input', blocker);
  48963. // $flow-disable-line
  48964. el.__ieph = true; /* IE placeholder patched */
  48965. }
  48966. el.setAttribute(key, value);
  48967. }
  48968. }
  48969. var attrs = {
  48970. create: updateAttrs,
  48971. update: updateAttrs
  48972. };
  48973. /* */
  48974. function updateClass (oldVnode, vnode) {
  48975. var el = vnode.elm;
  48976. var data = vnode.data;
  48977. var oldData = oldVnode.data;
  48978. if (
  48979. isUndef(data.staticClass) &&
  48980. isUndef(data.class) && (
  48981. isUndef(oldData) || (
  48982. isUndef(oldData.staticClass) &&
  48983. isUndef(oldData.class)
  48984. )
  48985. )
  48986. ) {
  48987. return
  48988. }
  48989. var cls = genClassForVnode(vnode);
  48990. // handle transition classes
  48991. var transitionClass = el._transitionClasses;
  48992. if (isDef(transitionClass)) {
  48993. cls = concat(cls, stringifyClass(transitionClass));
  48994. }
  48995. // set the class
  48996. if (cls !== el._prevClass) {
  48997. el.setAttribute('class', cls);
  48998. el._prevClass = cls;
  48999. }
  49000. }
  49001. var klass = {
  49002. create: updateClass,
  49003. update: updateClass
  49004. };
  49005. /* */
  49006. var validDivisionCharRE = /[\w).+\-_$\]]/;
  49007. function parseFilters (exp) {
  49008. var inSingle = false;
  49009. var inDouble = false;
  49010. var inTemplateString = false;
  49011. var inRegex = false;
  49012. var curly = 0;
  49013. var square = 0;
  49014. var paren = 0;
  49015. var lastFilterIndex = 0;
  49016. var c, prev, i, expression, filters;
  49017. for (i = 0; i < exp.length; i++) {
  49018. prev = c;
  49019. c = exp.charCodeAt(i);
  49020. if (inSingle) {
  49021. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  49022. } else if (inDouble) {
  49023. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  49024. } else if (inTemplateString) {
  49025. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  49026. } else if (inRegex) {
  49027. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  49028. } else if (
  49029. c === 0x7C && // pipe
  49030. exp.charCodeAt(i + 1) !== 0x7C &&
  49031. exp.charCodeAt(i - 1) !== 0x7C &&
  49032. !curly && !square && !paren
  49033. ) {
  49034. if (expression === undefined) {
  49035. // first filter, end of expression
  49036. lastFilterIndex = i + 1;
  49037. expression = exp.slice(0, i).trim();
  49038. } else {
  49039. pushFilter();
  49040. }
  49041. } else {
  49042. switch (c) {
  49043. case 0x22: inDouble = true; break // "
  49044. case 0x27: inSingle = true; break // '
  49045. case 0x60: inTemplateString = true; break // `
  49046. case 0x28: paren++; break // (
  49047. case 0x29: paren--; break // )
  49048. case 0x5B: square++; break // [
  49049. case 0x5D: square--; break // ]
  49050. case 0x7B: curly++; break // {
  49051. case 0x7D: curly--; break // }
  49052. }
  49053. if (c === 0x2f) { // /
  49054. var j = i - 1;
  49055. var p = (void 0);
  49056. // find first non-whitespace prev char
  49057. for (; j >= 0; j--) {
  49058. p = exp.charAt(j);
  49059. if (p !== ' ') { break }
  49060. }
  49061. if (!p || !validDivisionCharRE.test(p)) {
  49062. inRegex = true;
  49063. }
  49064. }
  49065. }
  49066. }
  49067. if (expression === undefined) {
  49068. expression = exp.slice(0, i).trim();
  49069. } else if (lastFilterIndex !== 0) {
  49070. pushFilter();
  49071. }
  49072. function pushFilter () {
  49073. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  49074. lastFilterIndex = i + 1;
  49075. }
  49076. if (filters) {
  49077. for (i = 0; i < filters.length; i++) {
  49078. expression = wrapFilter(expression, filters[i]);
  49079. }
  49080. }
  49081. return expression
  49082. }
  49083. function wrapFilter (exp, filter) {
  49084. var i = filter.indexOf('(');
  49085. if (i < 0) {
  49086. // _f: resolveFilter
  49087. return ("_f(\"" + filter + "\")(" + exp + ")")
  49088. } else {
  49089. var name = filter.slice(0, i);
  49090. var args = filter.slice(i + 1);
  49091. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  49092. }
  49093. }
  49094. /* */
  49095. /* eslint-disable no-unused-vars */
  49096. function baseWarn (msg, range) {
  49097. console.error(("[Vue compiler]: " + msg));
  49098. }
  49099. /* eslint-enable no-unused-vars */
  49100. function pluckModuleFunction (
  49101. modules,
  49102. key
  49103. ) {
  49104. return modules
  49105. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  49106. : []
  49107. }
  49108. function addProp (el, name, value, range, dynamic) {
  49109. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  49110. el.plain = false;
  49111. }
  49112. function addAttr (el, name, value, range, dynamic) {
  49113. var attrs = dynamic
  49114. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  49115. : (el.attrs || (el.attrs = []));
  49116. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  49117. el.plain = false;
  49118. }
  49119. // add a raw attr (use this in preTransforms)
  49120. function addRawAttr (el, name, value, range) {
  49121. el.attrsMap[name] = value;
  49122. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  49123. }
  49124. function addDirective (
  49125. el,
  49126. name,
  49127. rawName,
  49128. value,
  49129. arg,
  49130. isDynamicArg,
  49131. modifiers,
  49132. range
  49133. ) {
  49134. (el.directives || (el.directives = [])).push(rangeSetItem({
  49135. name: name,
  49136. rawName: rawName,
  49137. value: value,
  49138. arg: arg,
  49139. isDynamicArg: isDynamicArg,
  49140. modifiers: modifiers
  49141. }, range));
  49142. el.plain = false;
  49143. }
  49144. function prependModifierMarker (symbol, name, dynamic) {
  49145. return dynamic
  49146. ? ("_p(" + name + ",\"" + symbol + "\")")
  49147. : symbol + name // mark the event as captured
  49148. }
  49149. function addHandler (
  49150. el,
  49151. name,
  49152. value,
  49153. modifiers,
  49154. important,
  49155. warn,
  49156. range,
  49157. dynamic
  49158. ) {
  49159. modifiers = modifiers || emptyObject;
  49160. // warn prevent and passive modifier
  49161. /* istanbul ignore if */
  49162. if (
  49163. warn &&
  49164. modifiers.prevent && modifiers.passive
  49165. ) {
  49166. warn(
  49167. 'passive and prevent can\'t be used together. ' +
  49168. 'Passive handler can\'t prevent default event.',
  49169. range
  49170. );
  49171. }
  49172. // normalize click.right and click.middle since they don't actually fire
  49173. // this is technically browser-specific, but at least for now browsers are
  49174. // the only target envs that have right/middle clicks.
  49175. if (modifiers.right) {
  49176. if (dynamic) {
  49177. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  49178. } else if (name === 'click') {
  49179. name = 'contextmenu';
  49180. delete modifiers.right;
  49181. }
  49182. } else if (modifiers.middle) {
  49183. if (dynamic) {
  49184. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  49185. } else if (name === 'click') {
  49186. name = 'mouseup';
  49187. }
  49188. }
  49189. // check capture modifier
  49190. if (modifiers.capture) {
  49191. delete modifiers.capture;
  49192. name = prependModifierMarker('!', name, dynamic);
  49193. }
  49194. if (modifiers.once) {
  49195. delete modifiers.once;
  49196. name = prependModifierMarker('~', name, dynamic);
  49197. }
  49198. /* istanbul ignore if */
  49199. if (modifiers.passive) {
  49200. delete modifiers.passive;
  49201. name = prependModifierMarker('&', name, dynamic);
  49202. }
  49203. var events;
  49204. if (modifiers.native) {
  49205. delete modifiers.native;
  49206. events = el.nativeEvents || (el.nativeEvents = {});
  49207. } else {
  49208. events = el.events || (el.events = {});
  49209. }
  49210. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  49211. if (modifiers !== emptyObject) {
  49212. newHandler.modifiers = modifiers;
  49213. }
  49214. var handlers = events[name];
  49215. /* istanbul ignore if */
  49216. if (Array.isArray(handlers)) {
  49217. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  49218. } else if (handlers) {
  49219. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  49220. } else {
  49221. events[name] = newHandler;
  49222. }
  49223. el.plain = false;
  49224. }
  49225. function getRawBindingAttr (
  49226. el,
  49227. name
  49228. ) {
  49229. return el.rawAttrsMap[':' + name] ||
  49230. el.rawAttrsMap['v-bind:' + name] ||
  49231. el.rawAttrsMap[name]
  49232. }
  49233. function getBindingAttr (
  49234. el,
  49235. name,
  49236. getStatic
  49237. ) {
  49238. var dynamicValue =
  49239. getAndRemoveAttr(el, ':' + name) ||
  49240. getAndRemoveAttr(el, 'v-bind:' + name);
  49241. if (dynamicValue != null) {
  49242. return parseFilters(dynamicValue)
  49243. } else if (getStatic !== false) {
  49244. var staticValue = getAndRemoveAttr(el, name);
  49245. if (staticValue != null) {
  49246. return JSON.stringify(staticValue)
  49247. }
  49248. }
  49249. }
  49250. // note: this only removes the attr from the Array (attrsList) so that it
  49251. // doesn't get processed by processAttrs.
  49252. // By default it does NOT remove it from the map (attrsMap) because the map is
  49253. // needed during codegen.
  49254. function getAndRemoveAttr (
  49255. el,
  49256. name,
  49257. removeFromMap
  49258. ) {
  49259. var val;
  49260. if ((val = el.attrsMap[name]) != null) {
  49261. var list = el.attrsList;
  49262. for (var i = 0, l = list.length; i < l; i++) {
  49263. if (list[i].name === name) {
  49264. list.splice(i, 1);
  49265. break
  49266. }
  49267. }
  49268. }
  49269. if (removeFromMap) {
  49270. delete el.attrsMap[name];
  49271. }
  49272. return val
  49273. }
  49274. function getAndRemoveAttrByRegex (
  49275. el,
  49276. name
  49277. ) {
  49278. var list = el.attrsList;
  49279. for (var i = 0, l = list.length; i < l; i++) {
  49280. var attr = list[i];
  49281. if (name.test(attr.name)) {
  49282. list.splice(i, 1);
  49283. return attr
  49284. }
  49285. }
  49286. }
  49287. function rangeSetItem (
  49288. item,
  49289. range
  49290. ) {
  49291. if (range) {
  49292. if (range.start != null) {
  49293. item.start = range.start;
  49294. }
  49295. if (range.end != null) {
  49296. item.end = range.end;
  49297. }
  49298. }
  49299. return item
  49300. }
  49301. /* */
  49302. /**
  49303. * Cross-platform code generation for component v-model
  49304. */
  49305. function genComponentModel (
  49306. el,
  49307. value,
  49308. modifiers
  49309. ) {
  49310. var ref = modifiers || {};
  49311. var number = ref.number;
  49312. var trim = ref.trim;
  49313. var baseValueExpression = '$$v';
  49314. var valueExpression = baseValueExpression;
  49315. if (trim) {
  49316. valueExpression =
  49317. "(typeof " + baseValueExpression + " === 'string'" +
  49318. "? " + baseValueExpression + ".trim()" +
  49319. ": " + baseValueExpression + ")";
  49320. }
  49321. if (number) {
  49322. valueExpression = "_n(" + valueExpression + ")";
  49323. }
  49324. var assignment = genAssignmentCode(value, valueExpression);
  49325. el.model = {
  49326. value: ("(" + value + ")"),
  49327. expression: JSON.stringify(value),
  49328. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  49329. };
  49330. }
  49331. /**
  49332. * Cross-platform codegen helper for generating v-model value assignment code.
  49333. */
  49334. function genAssignmentCode (
  49335. value,
  49336. assignment
  49337. ) {
  49338. var res = parseModel(value);
  49339. if (res.key === null) {
  49340. return (value + "=" + assignment)
  49341. } else {
  49342. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  49343. }
  49344. }
  49345. /**
  49346. * Parse a v-model expression into a base path and a final key segment.
  49347. * Handles both dot-path and possible square brackets.
  49348. *
  49349. * Possible cases:
  49350. *
  49351. * - test
  49352. * - test[key]
  49353. * - test[test1[key]]
  49354. * - test["a"][key]
  49355. * - xxx.test[a[a].test1[key]]
  49356. * - test.xxx.a["asa"][test1[key]]
  49357. *
  49358. */
  49359. var len, str, chr, index$1, expressionPos, expressionEndPos;
  49360. function parseModel (val) {
  49361. // Fix https://github.com/vuejs/vue/pull/7730
  49362. // allow v-model="obj.val " (trailing whitespace)
  49363. val = val.trim();
  49364. len = val.length;
  49365. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  49366. index$1 = val.lastIndexOf('.');
  49367. if (index$1 > -1) {
  49368. return {
  49369. exp: val.slice(0, index$1),
  49370. key: '"' + val.slice(index$1 + 1) + '"'
  49371. }
  49372. } else {
  49373. return {
  49374. exp: val,
  49375. key: null
  49376. }
  49377. }
  49378. }
  49379. str = val;
  49380. index$1 = expressionPos = expressionEndPos = 0;
  49381. while (!eof()) {
  49382. chr = next();
  49383. /* istanbul ignore if */
  49384. if (isStringStart(chr)) {
  49385. parseString(chr);
  49386. } else if (chr === 0x5B) {
  49387. parseBracket(chr);
  49388. }
  49389. }
  49390. return {
  49391. exp: val.slice(0, expressionPos),
  49392. key: val.slice(expressionPos + 1, expressionEndPos)
  49393. }
  49394. }
  49395. function next () {
  49396. return str.charCodeAt(++index$1)
  49397. }
  49398. function eof () {
  49399. return index$1 >= len
  49400. }
  49401. function isStringStart (chr) {
  49402. return chr === 0x22 || chr === 0x27
  49403. }
  49404. function parseBracket (chr) {
  49405. var inBracket = 1;
  49406. expressionPos = index$1;
  49407. while (!eof()) {
  49408. chr = next();
  49409. if (isStringStart(chr)) {
  49410. parseString(chr);
  49411. continue
  49412. }
  49413. if (chr === 0x5B) { inBracket++; }
  49414. if (chr === 0x5D) { inBracket--; }
  49415. if (inBracket === 0) {
  49416. expressionEndPos = index$1;
  49417. break
  49418. }
  49419. }
  49420. }
  49421. function parseString (chr) {
  49422. var stringQuote = chr;
  49423. while (!eof()) {
  49424. chr = next();
  49425. if (chr === stringQuote) {
  49426. break
  49427. }
  49428. }
  49429. }
  49430. /* */
  49431. var warn$1;
  49432. // in some cases, the event used has to be determined at runtime
  49433. // so we used some reserved tokens during compile.
  49434. var RANGE_TOKEN = '__r';
  49435. var CHECKBOX_RADIO_TOKEN = '__c';
  49436. function model (
  49437. el,
  49438. dir,
  49439. _warn
  49440. ) {
  49441. warn$1 = _warn;
  49442. var value = dir.value;
  49443. var modifiers = dir.modifiers;
  49444. var tag = el.tag;
  49445. var type = el.attrsMap.type;
  49446. {
  49447. // inputs with type="file" are read only and setting the input's
  49448. // value will throw an error.
  49449. if (tag === 'input' && type === 'file') {
  49450. warn$1(
  49451. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  49452. "File inputs are read only. Use a v-on:change listener instead.",
  49453. el.rawAttrsMap['v-model']
  49454. );
  49455. }
  49456. }
  49457. if (el.component) {
  49458. genComponentModel(el, value, modifiers);
  49459. // component v-model doesn't need extra runtime
  49460. return false
  49461. } else if (tag === 'select') {
  49462. genSelect(el, value, modifiers);
  49463. } else if (tag === 'input' && type === 'checkbox') {
  49464. genCheckboxModel(el, value, modifiers);
  49465. } else if (tag === 'input' && type === 'radio') {
  49466. genRadioModel(el, value, modifiers);
  49467. } else if (tag === 'input' || tag === 'textarea') {
  49468. genDefaultModel(el, value, modifiers);
  49469. } else if (!config.isReservedTag(tag)) {
  49470. genComponentModel(el, value, modifiers);
  49471. // component v-model doesn't need extra runtime
  49472. return false
  49473. } else {
  49474. warn$1(
  49475. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  49476. "v-model is not supported on this element type. " +
  49477. 'If you are working with contenteditable, it\'s recommended to ' +
  49478. 'wrap a library dedicated for that purpose inside a custom component.',
  49479. el.rawAttrsMap['v-model']
  49480. );
  49481. }
  49482. // ensure runtime directive metadata
  49483. return true
  49484. }
  49485. function genCheckboxModel (
  49486. el,
  49487. value,
  49488. modifiers
  49489. ) {
  49490. var number = modifiers && modifiers.number;
  49491. var valueBinding = getBindingAttr(el, 'value') || 'null';
  49492. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  49493. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  49494. addProp(el, 'checked',
  49495. "Array.isArray(" + value + ")" +
  49496. "?_i(" + value + "," + valueBinding + ")>-1" + (
  49497. trueValueBinding === 'true'
  49498. ? (":(" + value + ")")
  49499. : (":_q(" + value + "," + trueValueBinding + ")")
  49500. )
  49501. );
  49502. addHandler(el, 'change',
  49503. "var $$a=" + value + "," +
  49504. '$$el=$event.target,' +
  49505. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  49506. 'if(Array.isArray($$a)){' +
  49507. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  49508. '$$i=_i($$a,$$v);' +
  49509. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  49510. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  49511. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  49512. null, true
  49513. );
  49514. }
  49515. function genRadioModel (
  49516. el,
  49517. value,
  49518. modifiers
  49519. ) {
  49520. var number = modifiers && modifiers.number;
  49521. var valueBinding = getBindingAttr(el, 'value') || 'null';
  49522. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  49523. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  49524. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  49525. }
  49526. function genSelect (
  49527. el,
  49528. value,
  49529. modifiers
  49530. ) {
  49531. var number = modifiers && modifiers.number;
  49532. var selectedVal = "Array.prototype.filter" +
  49533. ".call($event.target.options,function(o){return o.selected})" +
  49534. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  49535. "return " + (number ? '_n(val)' : 'val') + "})";
  49536. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  49537. var code = "var $$selectedVal = " + selectedVal + ";";
  49538. code = code + " " + (genAssignmentCode(value, assignment));
  49539. addHandler(el, 'change', code, null, true);
  49540. }
  49541. function genDefaultModel (
  49542. el,
  49543. value,
  49544. modifiers
  49545. ) {
  49546. var type = el.attrsMap.type;
  49547. // warn if v-bind:value conflicts with v-model
  49548. // except for inputs with v-bind:type
  49549. {
  49550. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  49551. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  49552. if (value$1 && !typeBinding) {
  49553. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  49554. warn$1(
  49555. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  49556. 'because the latter already expands to a value binding internally',
  49557. el.rawAttrsMap[binding]
  49558. );
  49559. }
  49560. }
  49561. var ref = modifiers || {};
  49562. var lazy = ref.lazy;
  49563. var number = ref.number;
  49564. var trim = ref.trim;
  49565. var needCompositionGuard = !lazy && type !== 'range';
  49566. var event = lazy
  49567. ? 'change'
  49568. : type === 'range'
  49569. ? RANGE_TOKEN
  49570. : 'input';
  49571. var valueExpression = '$event.target.value';
  49572. if (trim) {
  49573. valueExpression = "$event.target.value.trim()";
  49574. }
  49575. if (number) {
  49576. valueExpression = "_n(" + valueExpression + ")";
  49577. }
  49578. var code = genAssignmentCode(value, valueExpression);
  49579. if (needCompositionGuard) {
  49580. code = "if($event.target.composing)return;" + code;
  49581. }
  49582. addProp(el, 'value', ("(" + value + ")"));
  49583. addHandler(el, event, code, null, true);
  49584. if (trim || number) {
  49585. addHandler(el, 'blur', '$forceUpdate()');
  49586. }
  49587. }
  49588. /* */
  49589. // normalize v-model event tokens that can only be determined at runtime.
  49590. // it's important to place the event as the first in the array because
  49591. // the whole point is ensuring the v-model callback gets called before
  49592. // user-attached handlers.
  49593. function normalizeEvents (on) {
  49594. /* istanbul ignore if */
  49595. if (isDef(on[RANGE_TOKEN])) {
  49596. // IE input[type=range] only supports `change` event
  49597. var event = isIE ? 'change' : 'input';
  49598. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  49599. delete on[RANGE_TOKEN];
  49600. }
  49601. // This was originally intended to fix #4521 but no longer necessary
  49602. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  49603. /* istanbul ignore if */
  49604. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  49605. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  49606. delete on[CHECKBOX_RADIO_TOKEN];
  49607. }
  49608. }
  49609. var target$1;
  49610. function createOnceHandler$1 (event, handler, capture) {
  49611. var _target = target$1; // save current target element in closure
  49612. return function onceHandler () {
  49613. var res = handler.apply(null, arguments);
  49614. if (res !== null) {
  49615. remove$2(event, onceHandler, capture, _target);
  49616. }
  49617. }
  49618. }
  49619. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  49620. // implementation and does not fire microtasks in between event propagation, so
  49621. // safe to exclude.
  49622. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  49623. function add$1 (
  49624. name,
  49625. handler,
  49626. capture,
  49627. passive
  49628. ) {
  49629. // async edge case #6566: inner click event triggers patch, event handler
  49630. // attached to outer element during patch, and triggered again. This
  49631. // happens because browsers fire microtask ticks between event propagation.
  49632. // the solution is simple: we save the timestamp when a handler is attached,
  49633. // and the handler would only fire if the event passed to it was fired
  49634. // AFTER it was attached.
  49635. if (useMicrotaskFix) {
  49636. var attachedTimestamp = currentFlushTimestamp;
  49637. var original = handler;
  49638. handler = original._wrapper = function (e) {
  49639. if (
  49640. // no bubbling, should always fire.
  49641. // this is just a safety net in case event.timeStamp is unreliable in
  49642. // certain weird environments...
  49643. e.target === e.currentTarget ||
  49644. // event is fired after handler attachment
  49645. e.timeStamp >= attachedTimestamp ||
  49646. // bail for environments that have buggy event.timeStamp implementations
  49647. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  49648. // #9681 QtWebEngine event.timeStamp is negative value
  49649. e.timeStamp <= 0 ||
  49650. // #9448 bail if event is fired in another document in a multi-page
  49651. // electron/nw.js app, since event.timeStamp will be using a different
  49652. // starting reference
  49653. e.target.ownerDocument !== document
  49654. ) {
  49655. return original.apply(this, arguments)
  49656. }
  49657. };
  49658. }
  49659. target$1.addEventListener(
  49660. name,
  49661. handler,
  49662. supportsPassive
  49663. ? { capture: capture, passive: passive }
  49664. : capture
  49665. );
  49666. }
  49667. function remove$2 (
  49668. name,
  49669. handler,
  49670. capture,
  49671. _target
  49672. ) {
  49673. (_target || target$1).removeEventListener(
  49674. name,
  49675. handler._wrapper || handler,
  49676. capture
  49677. );
  49678. }
  49679. function updateDOMListeners (oldVnode, vnode) {
  49680. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  49681. return
  49682. }
  49683. var on = vnode.data.on || {};
  49684. var oldOn = oldVnode.data.on || {};
  49685. target$1 = vnode.elm;
  49686. normalizeEvents(on);
  49687. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  49688. target$1 = undefined;
  49689. }
  49690. var events = {
  49691. create: updateDOMListeners,
  49692. update: updateDOMListeners
  49693. };
  49694. /* */
  49695. var svgContainer;
  49696. function updateDOMProps (oldVnode, vnode) {
  49697. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  49698. return
  49699. }
  49700. var key, cur;
  49701. var elm = vnode.elm;
  49702. var oldProps = oldVnode.data.domProps || {};
  49703. var props = vnode.data.domProps || {};
  49704. // clone observed objects, as the user probably wants to mutate it
  49705. if (isDef(props.__ob__)) {
  49706. props = vnode.data.domProps = extend({}, props);
  49707. }
  49708. for (key in oldProps) {
  49709. if (!(key in props)) {
  49710. elm[key] = '';
  49711. }
  49712. }
  49713. for (key in props) {
  49714. cur = props[key];
  49715. // ignore children if the node has textContent or innerHTML,
  49716. // as these will throw away existing DOM nodes and cause removal errors
  49717. // on subsequent patches (#3360)
  49718. if (key === 'textContent' || key === 'innerHTML') {
  49719. if (vnode.children) { vnode.children.length = 0; }
  49720. if (cur === oldProps[key]) { continue }
  49721. // #6601 work around Chrome version <= 55 bug where single textNode
  49722. // replaced by innerHTML/textContent retains its parentNode property
  49723. if (elm.childNodes.length === 1) {
  49724. elm.removeChild(elm.childNodes[0]);
  49725. }
  49726. }
  49727. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  49728. // store value as _value as well since
  49729. // non-string values will be stringified
  49730. elm._value = cur;
  49731. // avoid resetting cursor position when value is the same
  49732. var strCur = isUndef(cur) ? '' : String(cur);
  49733. if (shouldUpdateValue(elm, strCur)) {
  49734. elm.value = strCur;
  49735. }
  49736. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  49737. // IE doesn't support innerHTML for SVG elements
  49738. svgContainer = svgContainer || document.createElement('div');
  49739. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  49740. var svg = svgContainer.firstChild;
  49741. while (elm.firstChild) {
  49742. elm.removeChild(elm.firstChild);
  49743. }
  49744. while (svg.firstChild) {
  49745. elm.appendChild(svg.firstChild);
  49746. }
  49747. } else if (
  49748. // skip the update if old and new VDOM state is the same.
  49749. // `value` is handled separately because the DOM value may be temporarily
  49750. // out of sync with VDOM state due to focus, composition and modifiers.
  49751. // This #4521 by skipping the unnecesarry `checked` update.
  49752. cur !== oldProps[key]
  49753. ) {
  49754. // some property updates can throw
  49755. // e.g. `value` on <progress> w/ non-finite value
  49756. try {
  49757. elm[key] = cur;
  49758. } catch (e) {}
  49759. }
  49760. }
  49761. }
  49762. // check platforms/web/util/attrs.js acceptValue
  49763. function shouldUpdateValue (elm, checkVal) {
  49764. return (!elm.composing && (
  49765. elm.tagName === 'OPTION' ||
  49766. isNotInFocusAndDirty(elm, checkVal) ||
  49767. isDirtyWithModifiers(elm, checkVal)
  49768. ))
  49769. }
  49770. function isNotInFocusAndDirty (elm, checkVal) {
  49771. // return true when textbox (.number and .trim) loses focus and its value is
  49772. // not equal to the updated value
  49773. var notInFocus = true;
  49774. // #6157
  49775. // work around IE bug when accessing document.activeElement in an iframe
  49776. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  49777. return notInFocus && elm.value !== checkVal
  49778. }
  49779. function isDirtyWithModifiers (elm, newVal) {
  49780. var value = elm.value;
  49781. var modifiers = elm._vModifiers; // injected by v-model runtime
  49782. if (isDef(modifiers)) {
  49783. if (modifiers.number) {
  49784. return toNumber(value) !== toNumber(newVal)
  49785. }
  49786. if (modifiers.trim) {
  49787. return value.trim() !== newVal.trim()
  49788. }
  49789. }
  49790. return value !== newVal
  49791. }
  49792. var domProps = {
  49793. create: updateDOMProps,
  49794. update: updateDOMProps
  49795. };
  49796. /* */
  49797. var parseStyleText = cached(function (cssText) {
  49798. var res = {};
  49799. var listDelimiter = /;(?![^(]*\))/g;
  49800. var propertyDelimiter = /:(.+)/;
  49801. cssText.split(listDelimiter).forEach(function (item) {
  49802. if (item) {
  49803. var tmp = item.split(propertyDelimiter);
  49804. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  49805. }
  49806. });
  49807. return res
  49808. });
  49809. // merge static and dynamic style data on the same vnode
  49810. function normalizeStyleData (data) {
  49811. var style = normalizeStyleBinding(data.style);
  49812. // static style is pre-processed into an object during compilation
  49813. // and is always a fresh object, so it's safe to merge into it
  49814. return data.staticStyle
  49815. ? extend(data.staticStyle, style)
  49816. : style
  49817. }
  49818. // normalize possible array / string values into Object
  49819. function normalizeStyleBinding (bindingStyle) {
  49820. if (Array.isArray(bindingStyle)) {
  49821. return toObject(bindingStyle)
  49822. }
  49823. if (typeof bindingStyle === 'string') {
  49824. return parseStyleText(bindingStyle)
  49825. }
  49826. return bindingStyle
  49827. }
  49828. /**
  49829. * parent component style should be after child's
  49830. * so that parent component's style could override it
  49831. */
  49832. function getStyle (vnode, checkChild) {
  49833. var res = {};
  49834. var styleData;
  49835. if (checkChild) {
  49836. var childNode = vnode;
  49837. while (childNode.componentInstance) {
  49838. childNode = childNode.componentInstance._vnode;
  49839. if (
  49840. childNode && childNode.data &&
  49841. (styleData = normalizeStyleData(childNode.data))
  49842. ) {
  49843. extend(res, styleData);
  49844. }
  49845. }
  49846. }
  49847. if ((styleData = normalizeStyleData(vnode.data))) {
  49848. extend(res, styleData);
  49849. }
  49850. var parentNode = vnode;
  49851. while ((parentNode = parentNode.parent)) {
  49852. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  49853. extend(res, styleData);
  49854. }
  49855. }
  49856. return res
  49857. }
  49858. /* */
  49859. var cssVarRE = /^--/;
  49860. var importantRE = /\s*!important$/;
  49861. var setProp = function (el, name, val) {
  49862. /* istanbul ignore if */
  49863. if (cssVarRE.test(name)) {
  49864. el.style.setProperty(name, val);
  49865. } else if (importantRE.test(val)) {
  49866. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  49867. } else {
  49868. var normalizedName = normalize(name);
  49869. if (Array.isArray(val)) {
  49870. // Support values array created by autoprefixer, e.g.
  49871. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  49872. // Set them one by one, and the browser will only set those it can recognize
  49873. for (var i = 0, len = val.length; i < len; i++) {
  49874. el.style[normalizedName] = val[i];
  49875. }
  49876. } else {
  49877. el.style[normalizedName] = val;
  49878. }
  49879. }
  49880. };
  49881. var vendorNames = ['Webkit', 'Moz', 'ms'];
  49882. var emptyStyle;
  49883. var normalize = cached(function (prop) {
  49884. emptyStyle = emptyStyle || document.createElement('div').style;
  49885. prop = camelize(prop);
  49886. if (prop !== 'filter' && (prop in emptyStyle)) {
  49887. return prop
  49888. }
  49889. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  49890. for (var i = 0; i < vendorNames.length; i++) {
  49891. var name = vendorNames[i] + capName;
  49892. if (name in emptyStyle) {
  49893. return name
  49894. }
  49895. }
  49896. });
  49897. function updateStyle (oldVnode, vnode) {
  49898. var data = vnode.data;
  49899. var oldData = oldVnode.data;
  49900. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  49901. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  49902. ) {
  49903. return
  49904. }
  49905. var cur, name;
  49906. var el = vnode.elm;
  49907. var oldStaticStyle = oldData.staticStyle;
  49908. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  49909. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  49910. var oldStyle = oldStaticStyle || oldStyleBinding;
  49911. var style = normalizeStyleBinding(vnode.data.style) || {};
  49912. // store normalized style under a different key for next diff
  49913. // make sure to clone it if it's reactive, since the user likely wants
  49914. // to mutate it.
  49915. vnode.data.normalizedStyle = isDef(style.__ob__)
  49916. ? extend({}, style)
  49917. : style;
  49918. var newStyle = getStyle(vnode, true);
  49919. for (name in oldStyle) {
  49920. if (isUndef(newStyle[name])) {
  49921. setProp(el, name, '');
  49922. }
  49923. }
  49924. for (name in newStyle) {
  49925. cur = newStyle[name];
  49926. if (cur !== oldStyle[name]) {
  49927. // ie9 setting to null has no effect, must use empty string
  49928. setProp(el, name, cur == null ? '' : cur);
  49929. }
  49930. }
  49931. }
  49932. var style = {
  49933. create: updateStyle,
  49934. update: updateStyle
  49935. };
  49936. /* */
  49937. var whitespaceRE = /\s+/;
  49938. /**
  49939. * Add class with compatibility for SVG since classList is not supported on
  49940. * SVG elements in IE
  49941. */
  49942. function addClass (el, cls) {
  49943. /* istanbul ignore if */
  49944. if (!cls || !(cls = cls.trim())) {
  49945. return
  49946. }
  49947. /* istanbul ignore else */
  49948. if (el.classList) {
  49949. if (cls.indexOf(' ') > -1) {
  49950. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  49951. } else {
  49952. el.classList.add(cls);
  49953. }
  49954. } else {
  49955. var cur = " " + (el.getAttribute('class') || '') + " ";
  49956. if (cur.indexOf(' ' + cls + ' ') < 0) {
  49957. el.setAttribute('class', (cur + cls).trim());
  49958. }
  49959. }
  49960. }
  49961. /**
  49962. * Remove class with compatibility for SVG since classList is not supported on
  49963. * SVG elements in IE
  49964. */
  49965. function removeClass (el, cls) {
  49966. /* istanbul ignore if */
  49967. if (!cls || !(cls = cls.trim())) {
  49968. return
  49969. }
  49970. /* istanbul ignore else */
  49971. if (el.classList) {
  49972. if (cls.indexOf(' ') > -1) {
  49973. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  49974. } else {
  49975. el.classList.remove(cls);
  49976. }
  49977. if (!el.classList.length) {
  49978. el.removeAttribute('class');
  49979. }
  49980. } else {
  49981. var cur = " " + (el.getAttribute('class') || '') + " ";
  49982. var tar = ' ' + cls + ' ';
  49983. while (cur.indexOf(tar) >= 0) {
  49984. cur = cur.replace(tar, ' ');
  49985. }
  49986. cur = cur.trim();
  49987. if (cur) {
  49988. el.setAttribute('class', cur);
  49989. } else {
  49990. el.removeAttribute('class');
  49991. }
  49992. }
  49993. }
  49994. /* */
  49995. function resolveTransition (def$$1) {
  49996. if (!def$$1) {
  49997. return
  49998. }
  49999. /* istanbul ignore else */
  50000. if (typeof def$$1 === 'object') {
  50001. var res = {};
  50002. if (def$$1.css !== false) {
  50003. extend(res, autoCssTransition(def$$1.name || 'v'));
  50004. }
  50005. extend(res, def$$1);
  50006. return res
  50007. } else if (typeof def$$1 === 'string') {
  50008. return autoCssTransition(def$$1)
  50009. }
  50010. }
  50011. var autoCssTransition = cached(function (name) {
  50012. return {
  50013. enterClass: (name + "-enter"),
  50014. enterToClass: (name + "-enter-to"),
  50015. enterActiveClass: (name + "-enter-active"),
  50016. leaveClass: (name + "-leave"),
  50017. leaveToClass: (name + "-leave-to"),
  50018. leaveActiveClass: (name + "-leave-active")
  50019. }
  50020. });
  50021. var hasTransition = inBrowser && !isIE9;
  50022. var TRANSITION = 'transition';
  50023. var ANIMATION = 'animation';
  50024. // Transition property/event sniffing
  50025. var transitionProp = 'transition';
  50026. var transitionEndEvent = 'transitionend';
  50027. var animationProp = 'animation';
  50028. var animationEndEvent = 'animationend';
  50029. if (hasTransition) {
  50030. /* istanbul ignore if */
  50031. if (window.ontransitionend === undefined &&
  50032. window.onwebkittransitionend !== undefined
  50033. ) {
  50034. transitionProp = 'WebkitTransition';
  50035. transitionEndEvent = 'webkitTransitionEnd';
  50036. }
  50037. if (window.onanimationend === undefined &&
  50038. window.onwebkitanimationend !== undefined
  50039. ) {
  50040. animationProp = 'WebkitAnimation';
  50041. animationEndEvent = 'webkitAnimationEnd';
  50042. }
  50043. }
  50044. // binding to window is necessary to make hot reload work in IE in strict mode
  50045. var raf = inBrowser
  50046. ? window.requestAnimationFrame
  50047. ? window.requestAnimationFrame.bind(window)
  50048. : setTimeout
  50049. : /* istanbul ignore next */ function (fn) { return fn(); };
  50050. function nextFrame (fn) {
  50051. raf(function () {
  50052. raf(fn);
  50053. });
  50054. }
  50055. function addTransitionClass (el, cls) {
  50056. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  50057. if (transitionClasses.indexOf(cls) < 0) {
  50058. transitionClasses.push(cls);
  50059. addClass(el, cls);
  50060. }
  50061. }
  50062. function removeTransitionClass (el, cls) {
  50063. if (el._transitionClasses) {
  50064. remove(el._transitionClasses, cls);
  50065. }
  50066. removeClass(el, cls);
  50067. }
  50068. function whenTransitionEnds (
  50069. el,
  50070. expectedType,
  50071. cb
  50072. ) {
  50073. var ref = getTransitionInfo(el, expectedType);
  50074. var type = ref.type;
  50075. var timeout = ref.timeout;
  50076. var propCount = ref.propCount;
  50077. if (!type) { return cb() }
  50078. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  50079. var ended = 0;
  50080. var end = function () {
  50081. el.removeEventListener(event, onEnd);
  50082. cb();
  50083. };
  50084. var onEnd = function (e) {
  50085. if (e.target === el) {
  50086. if (++ended >= propCount) {
  50087. end();
  50088. }
  50089. }
  50090. };
  50091. setTimeout(function () {
  50092. if (ended < propCount) {
  50093. end();
  50094. }
  50095. }, timeout + 1);
  50096. el.addEventListener(event, onEnd);
  50097. }
  50098. var transformRE = /\b(transform|all)(,|$)/;
  50099. function getTransitionInfo (el, expectedType) {
  50100. var styles = window.getComputedStyle(el);
  50101. // JSDOM may return undefined for transition properties
  50102. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  50103. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  50104. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  50105. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  50106. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  50107. var animationTimeout = getTimeout(animationDelays, animationDurations);
  50108. var type;
  50109. var timeout = 0;
  50110. var propCount = 0;
  50111. /* istanbul ignore if */
  50112. if (expectedType === TRANSITION) {
  50113. if (transitionTimeout > 0) {
  50114. type = TRANSITION;
  50115. timeout = transitionTimeout;
  50116. propCount = transitionDurations.length;
  50117. }
  50118. } else if (expectedType === ANIMATION) {
  50119. if (animationTimeout > 0) {
  50120. type = ANIMATION;
  50121. timeout = animationTimeout;
  50122. propCount = animationDurations.length;
  50123. }
  50124. } else {
  50125. timeout = Math.max(transitionTimeout, animationTimeout);
  50126. type = timeout > 0
  50127. ? transitionTimeout > animationTimeout
  50128. ? TRANSITION
  50129. : ANIMATION
  50130. : null;
  50131. propCount = type
  50132. ? type === TRANSITION
  50133. ? transitionDurations.length
  50134. : animationDurations.length
  50135. : 0;
  50136. }
  50137. var hasTransform =
  50138. type === TRANSITION &&
  50139. transformRE.test(styles[transitionProp + 'Property']);
  50140. return {
  50141. type: type,
  50142. timeout: timeout,
  50143. propCount: propCount,
  50144. hasTransform: hasTransform
  50145. }
  50146. }
  50147. function getTimeout (delays, durations) {
  50148. /* istanbul ignore next */
  50149. while (delays.length < durations.length) {
  50150. delays = delays.concat(delays);
  50151. }
  50152. return Math.max.apply(null, durations.map(function (d, i) {
  50153. return toMs(d) + toMs(delays[i])
  50154. }))
  50155. }
  50156. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  50157. // in a locale-dependent way, using a comma instead of a dot.
  50158. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  50159. // as a floor function) causing unexpected behaviors
  50160. function toMs (s) {
  50161. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  50162. }
  50163. /* */
  50164. function enter (vnode, toggleDisplay) {
  50165. var el = vnode.elm;
  50166. // call leave callback now
  50167. if (isDef(el._leaveCb)) {
  50168. el._leaveCb.cancelled = true;
  50169. el._leaveCb();
  50170. }
  50171. var data = resolveTransition(vnode.data.transition);
  50172. if (isUndef(data)) {
  50173. return
  50174. }
  50175. /* istanbul ignore if */
  50176. if (isDef(el._enterCb) || el.nodeType !== 1) {
  50177. return
  50178. }
  50179. var css = data.css;
  50180. var type = data.type;
  50181. var enterClass = data.enterClass;
  50182. var enterToClass = data.enterToClass;
  50183. var enterActiveClass = data.enterActiveClass;
  50184. var appearClass = data.appearClass;
  50185. var appearToClass = data.appearToClass;
  50186. var appearActiveClass = data.appearActiveClass;
  50187. var beforeEnter = data.beforeEnter;
  50188. var enter = data.enter;
  50189. var afterEnter = data.afterEnter;
  50190. var enterCancelled = data.enterCancelled;
  50191. var beforeAppear = data.beforeAppear;
  50192. var appear = data.appear;
  50193. var afterAppear = data.afterAppear;
  50194. var appearCancelled = data.appearCancelled;
  50195. var duration = data.duration;
  50196. // activeInstance will always be the <transition> component managing this
  50197. // transition. One edge case to check is when the <transition> is placed
  50198. // as the root node of a child component. In that case we need to check
  50199. // <transition>'s parent for appear check.
  50200. var context = activeInstance;
  50201. var transitionNode = activeInstance.$vnode;
  50202. while (transitionNode && transitionNode.parent) {
  50203. context = transitionNode.context;
  50204. transitionNode = transitionNode.parent;
  50205. }
  50206. var isAppear = !context._isMounted || !vnode.isRootInsert;
  50207. if (isAppear && !appear && appear !== '') {
  50208. return
  50209. }
  50210. var startClass = isAppear && appearClass
  50211. ? appearClass
  50212. : enterClass;
  50213. var activeClass = isAppear && appearActiveClass
  50214. ? appearActiveClass
  50215. : enterActiveClass;
  50216. var toClass = isAppear && appearToClass
  50217. ? appearToClass
  50218. : enterToClass;
  50219. var beforeEnterHook = isAppear
  50220. ? (beforeAppear || beforeEnter)
  50221. : beforeEnter;
  50222. var enterHook = isAppear
  50223. ? (typeof appear === 'function' ? appear : enter)
  50224. : enter;
  50225. var afterEnterHook = isAppear
  50226. ? (afterAppear || afterEnter)
  50227. : afterEnter;
  50228. var enterCancelledHook = isAppear
  50229. ? (appearCancelled || enterCancelled)
  50230. : enterCancelled;
  50231. var explicitEnterDuration = toNumber(
  50232. isObject(duration)
  50233. ? duration.enter
  50234. : duration
  50235. );
  50236. if (explicitEnterDuration != null) {
  50237. checkDuration(explicitEnterDuration, 'enter', vnode);
  50238. }
  50239. var expectsCSS = css !== false && !isIE9;
  50240. var userWantsControl = getHookArgumentsLength(enterHook);
  50241. var cb = el._enterCb = once(function () {
  50242. if (expectsCSS) {
  50243. removeTransitionClass(el, toClass);
  50244. removeTransitionClass(el, activeClass);
  50245. }
  50246. if (cb.cancelled) {
  50247. if (expectsCSS) {
  50248. removeTransitionClass(el, startClass);
  50249. }
  50250. enterCancelledHook && enterCancelledHook(el);
  50251. } else {
  50252. afterEnterHook && afterEnterHook(el);
  50253. }
  50254. el._enterCb = null;
  50255. });
  50256. if (!vnode.data.show) {
  50257. // remove pending leave element on enter by injecting an insert hook
  50258. mergeVNodeHook(vnode, 'insert', function () {
  50259. var parent = el.parentNode;
  50260. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  50261. if (pendingNode &&
  50262. pendingNode.tag === vnode.tag &&
  50263. pendingNode.elm._leaveCb
  50264. ) {
  50265. pendingNode.elm._leaveCb();
  50266. }
  50267. enterHook && enterHook(el, cb);
  50268. });
  50269. }
  50270. // start enter transition
  50271. beforeEnterHook && beforeEnterHook(el);
  50272. if (expectsCSS) {
  50273. addTransitionClass(el, startClass);
  50274. addTransitionClass(el, activeClass);
  50275. nextFrame(function () {
  50276. removeTransitionClass(el, startClass);
  50277. if (!cb.cancelled) {
  50278. addTransitionClass(el, toClass);
  50279. if (!userWantsControl) {
  50280. if (isValidDuration(explicitEnterDuration)) {
  50281. setTimeout(cb, explicitEnterDuration);
  50282. } else {
  50283. whenTransitionEnds(el, type, cb);
  50284. }
  50285. }
  50286. }
  50287. });
  50288. }
  50289. if (vnode.data.show) {
  50290. toggleDisplay && toggleDisplay();
  50291. enterHook && enterHook(el, cb);
  50292. }
  50293. if (!expectsCSS && !userWantsControl) {
  50294. cb();
  50295. }
  50296. }
  50297. function leave (vnode, rm) {
  50298. var el = vnode.elm;
  50299. // call enter callback now
  50300. if (isDef(el._enterCb)) {
  50301. el._enterCb.cancelled = true;
  50302. el._enterCb();
  50303. }
  50304. var data = resolveTransition(vnode.data.transition);
  50305. if (isUndef(data) || el.nodeType !== 1) {
  50306. return rm()
  50307. }
  50308. /* istanbul ignore if */
  50309. if (isDef(el._leaveCb)) {
  50310. return
  50311. }
  50312. var css = data.css;
  50313. var type = data.type;
  50314. var leaveClass = data.leaveClass;
  50315. var leaveToClass = data.leaveToClass;
  50316. var leaveActiveClass = data.leaveActiveClass;
  50317. var beforeLeave = data.beforeLeave;
  50318. var leave = data.leave;
  50319. var afterLeave = data.afterLeave;
  50320. var leaveCancelled = data.leaveCancelled;
  50321. var delayLeave = data.delayLeave;
  50322. var duration = data.duration;
  50323. var expectsCSS = css !== false && !isIE9;
  50324. var userWantsControl = getHookArgumentsLength(leave);
  50325. var explicitLeaveDuration = toNumber(
  50326. isObject(duration)
  50327. ? duration.leave
  50328. : duration
  50329. );
  50330. if (isDef(explicitLeaveDuration)) {
  50331. checkDuration(explicitLeaveDuration, 'leave', vnode);
  50332. }
  50333. var cb = el._leaveCb = once(function () {
  50334. if (el.parentNode && el.parentNode._pending) {
  50335. el.parentNode._pending[vnode.key] = null;
  50336. }
  50337. if (expectsCSS) {
  50338. removeTransitionClass(el, leaveToClass);
  50339. removeTransitionClass(el, leaveActiveClass);
  50340. }
  50341. if (cb.cancelled) {
  50342. if (expectsCSS) {
  50343. removeTransitionClass(el, leaveClass);
  50344. }
  50345. leaveCancelled && leaveCancelled(el);
  50346. } else {
  50347. rm();
  50348. afterLeave && afterLeave(el);
  50349. }
  50350. el._leaveCb = null;
  50351. });
  50352. if (delayLeave) {
  50353. delayLeave(performLeave);
  50354. } else {
  50355. performLeave();
  50356. }
  50357. function performLeave () {
  50358. // the delayed leave may have already been cancelled
  50359. if (cb.cancelled) {
  50360. return
  50361. }
  50362. // record leaving element
  50363. if (!vnode.data.show && el.parentNode) {
  50364. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  50365. }
  50366. beforeLeave && beforeLeave(el);
  50367. if (expectsCSS) {
  50368. addTransitionClass(el, leaveClass);
  50369. addTransitionClass(el, leaveActiveClass);
  50370. nextFrame(function () {
  50371. removeTransitionClass(el, leaveClass);
  50372. if (!cb.cancelled) {
  50373. addTransitionClass(el, leaveToClass);
  50374. if (!userWantsControl) {
  50375. if (isValidDuration(explicitLeaveDuration)) {
  50376. setTimeout(cb, explicitLeaveDuration);
  50377. } else {
  50378. whenTransitionEnds(el, type, cb);
  50379. }
  50380. }
  50381. }
  50382. });
  50383. }
  50384. leave && leave(el, cb);
  50385. if (!expectsCSS && !userWantsControl) {
  50386. cb();
  50387. }
  50388. }
  50389. }
  50390. // only used in dev mode
  50391. function checkDuration (val, name, vnode) {
  50392. if (typeof val !== 'number') {
  50393. warn(
  50394. "<transition> explicit " + name + " duration is not a valid number - " +
  50395. "got " + (JSON.stringify(val)) + ".",
  50396. vnode.context
  50397. );
  50398. } else if (isNaN(val)) {
  50399. warn(
  50400. "<transition> explicit " + name + " duration is NaN - " +
  50401. 'the duration expression might be incorrect.',
  50402. vnode.context
  50403. );
  50404. }
  50405. }
  50406. function isValidDuration (val) {
  50407. return typeof val === 'number' && !isNaN(val)
  50408. }
  50409. /**
  50410. * Normalize a transition hook's argument length. The hook may be:
  50411. * - a merged hook (invoker) with the original in .fns
  50412. * - a wrapped component method (check ._length)
  50413. * - a plain function (.length)
  50414. */
  50415. function getHookArgumentsLength (fn) {
  50416. if (isUndef(fn)) {
  50417. return false
  50418. }
  50419. var invokerFns = fn.fns;
  50420. if (isDef(invokerFns)) {
  50421. // invoker
  50422. return getHookArgumentsLength(
  50423. Array.isArray(invokerFns)
  50424. ? invokerFns[0]
  50425. : invokerFns
  50426. )
  50427. } else {
  50428. return (fn._length || fn.length) > 1
  50429. }
  50430. }
  50431. function _enter (_, vnode) {
  50432. if (vnode.data.show !== true) {
  50433. enter(vnode);
  50434. }
  50435. }
  50436. var transition = inBrowser ? {
  50437. create: _enter,
  50438. activate: _enter,
  50439. remove: function remove$$1 (vnode, rm) {
  50440. /* istanbul ignore else */
  50441. if (vnode.data.show !== true) {
  50442. leave(vnode, rm);
  50443. } else {
  50444. rm();
  50445. }
  50446. }
  50447. } : {};
  50448. var platformModules = [
  50449. attrs,
  50450. klass,
  50451. events,
  50452. domProps,
  50453. style,
  50454. transition
  50455. ];
  50456. /* */
  50457. // the directive module should be applied last, after all
  50458. // built-in modules have been applied.
  50459. var modules = platformModules.concat(baseModules);
  50460. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  50461. /**
  50462. * Not type checking this file because flow doesn't like attaching
  50463. * properties to Elements.
  50464. */
  50465. /* istanbul ignore if */
  50466. if (isIE9) {
  50467. // http://www.matts411.com/post/internet-explorer-9-oninput/
  50468. document.addEventListener('selectionchange', function () {
  50469. var el = document.activeElement;
  50470. if (el && el.vmodel) {
  50471. trigger(el, 'input');
  50472. }
  50473. });
  50474. }
  50475. var directive = {
  50476. inserted: function inserted (el, binding, vnode, oldVnode) {
  50477. if (vnode.tag === 'select') {
  50478. // #6903
  50479. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  50480. mergeVNodeHook(vnode, 'postpatch', function () {
  50481. directive.componentUpdated(el, binding, vnode);
  50482. });
  50483. } else {
  50484. setSelected(el, binding, vnode.context);
  50485. }
  50486. el._vOptions = [].map.call(el.options, getValue);
  50487. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  50488. el._vModifiers = binding.modifiers;
  50489. if (!binding.modifiers.lazy) {
  50490. el.addEventListener('compositionstart', onCompositionStart);
  50491. el.addEventListener('compositionend', onCompositionEnd);
  50492. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  50493. // switching focus before confirming composition choice
  50494. // this also fixes the issue where some browsers e.g. iOS Chrome
  50495. // fires "change" instead of "input" on autocomplete.
  50496. el.addEventListener('change', onCompositionEnd);
  50497. /* istanbul ignore if */
  50498. if (isIE9) {
  50499. el.vmodel = true;
  50500. }
  50501. }
  50502. }
  50503. },
  50504. componentUpdated: function componentUpdated (el, binding, vnode) {
  50505. if (vnode.tag === 'select') {
  50506. setSelected(el, binding, vnode.context);
  50507. // in case the options rendered by v-for have changed,
  50508. // it's possible that the value is out-of-sync with the rendered options.
  50509. // detect such cases and filter out values that no longer has a matching
  50510. // option in the DOM.
  50511. var prevOptions = el._vOptions;
  50512. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  50513. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  50514. // trigger change event if
  50515. // no matching option found for at least one value
  50516. var needReset = el.multiple
  50517. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  50518. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  50519. if (needReset) {
  50520. trigger(el, 'change');
  50521. }
  50522. }
  50523. }
  50524. }
  50525. };
  50526. function setSelected (el, binding, vm) {
  50527. actuallySetSelected(el, binding, vm);
  50528. /* istanbul ignore if */
  50529. if (isIE || isEdge) {
  50530. setTimeout(function () {
  50531. actuallySetSelected(el, binding, vm);
  50532. }, 0);
  50533. }
  50534. }
  50535. function actuallySetSelected (el, binding, vm) {
  50536. var value = binding.value;
  50537. var isMultiple = el.multiple;
  50538. if (isMultiple && !Array.isArray(value)) {
  50539. warn(
  50540. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  50541. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  50542. vm
  50543. );
  50544. return
  50545. }
  50546. var selected, option;
  50547. for (var i = 0, l = el.options.length; i < l; i++) {
  50548. option = el.options[i];
  50549. if (isMultiple) {
  50550. selected = looseIndexOf(value, getValue(option)) > -1;
  50551. if (option.selected !== selected) {
  50552. option.selected = selected;
  50553. }
  50554. } else {
  50555. if (looseEqual(getValue(option), value)) {
  50556. if (el.selectedIndex !== i) {
  50557. el.selectedIndex = i;
  50558. }
  50559. return
  50560. }
  50561. }
  50562. }
  50563. if (!isMultiple) {
  50564. el.selectedIndex = -1;
  50565. }
  50566. }
  50567. function hasNoMatchingOption (value, options) {
  50568. return options.every(function (o) { return !looseEqual(o, value); })
  50569. }
  50570. function getValue (option) {
  50571. return '_value' in option
  50572. ? option._value
  50573. : option.value
  50574. }
  50575. function onCompositionStart (e) {
  50576. e.target.composing = true;
  50577. }
  50578. function onCompositionEnd (e) {
  50579. // prevent triggering an input event for no reason
  50580. if (!e.target.composing) { return }
  50581. e.target.composing = false;
  50582. trigger(e.target, 'input');
  50583. }
  50584. function trigger (el, type) {
  50585. var e = document.createEvent('HTMLEvents');
  50586. e.initEvent(type, true, true);
  50587. el.dispatchEvent(e);
  50588. }
  50589. /* */
  50590. // recursively search for possible transition defined inside the component root
  50591. function locateNode (vnode) {
  50592. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  50593. ? locateNode(vnode.componentInstance._vnode)
  50594. : vnode
  50595. }
  50596. var show = {
  50597. bind: function bind (el, ref, vnode) {
  50598. var value = ref.value;
  50599. vnode = locateNode(vnode);
  50600. var transition$$1 = vnode.data && vnode.data.transition;
  50601. var originalDisplay = el.__vOriginalDisplay =
  50602. el.style.display === 'none' ? '' : el.style.display;
  50603. if (value && transition$$1) {
  50604. vnode.data.show = true;
  50605. enter(vnode, function () {
  50606. el.style.display = originalDisplay;
  50607. });
  50608. } else {
  50609. el.style.display = value ? originalDisplay : 'none';
  50610. }
  50611. },
  50612. update: function update (el, ref, vnode) {
  50613. var value = ref.value;
  50614. var oldValue = ref.oldValue;
  50615. /* istanbul ignore if */
  50616. if (!value === !oldValue) { return }
  50617. vnode = locateNode(vnode);
  50618. var transition$$1 = vnode.data && vnode.data.transition;
  50619. if (transition$$1) {
  50620. vnode.data.show = true;
  50621. if (value) {
  50622. enter(vnode, function () {
  50623. el.style.display = el.__vOriginalDisplay;
  50624. });
  50625. } else {
  50626. leave(vnode, function () {
  50627. el.style.display = 'none';
  50628. });
  50629. }
  50630. } else {
  50631. el.style.display = value ? el.__vOriginalDisplay : 'none';
  50632. }
  50633. },
  50634. unbind: function unbind (
  50635. el,
  50636. binding,
  50637. vnode,
  50638. oldVnode,
  50639. isDestroy
  50640. ) {
  50641. if (!isDestroy) {
  50642. el.style.display = el.__vOriginalDisplay;
  50643. }
  50644. }
  50645. };
  50646. var platformDirectives = {
  50647. model: directive,
  50648. show: show
  50649. };
  50650. /* */
  50651. var transitionProps = {
  50652. name: String,
  50653. appear: Boolean,
  50654. css: Boolean,
  50655. mode: String,
  50656. type: String,
  50657. enterClass: String,
  50658. leaveClass: String,
  50659. enterToClass: String,
  50660. leaveToClass: String,
  50661. enterActiveClass: String,
  50662. leaveActiveClass: String,
  50663. appearClass: String,
  50664. appearActiveClass: String,
  50665. appearToClass: String,
  50666. duration: [Number, String, Object]
  50667. };
  50668. // in case the child is also an abstract component, e.g. <keep-alive>
  50669. // we want to recursively retrieve the real component to be rendered
  50670. function getRealChild (vnode) {
  50671. var compOptions = vnode && vnode.componentOptions;
  50672. if (compOptions && compOptions.Ctor.options.abstract) {
  50673. return getRealChild(getFirstComponentChild(compOptions.children))
  50674. } else {
  50675. return vnode
  50676. }
  50677. }
  50678. function extractTransitionData (comp) {
  50679. var data = {};
  50680. var options = comp.$options;
  50681. // props
  50682. for (var key in options.propsData) {
  50683. data[key] = comp[key];
  50684. }
  50685. // events.
  50686. // extract listeners and pass them directly to the transition methods
  50687. var listeners = options._parentListeners;
  50688. for (var key$1 in listeners) {
  50689. data[camelize(key$1)] = listeners[key$1];
  50690. }
  50691. return data
  50692. }
  50693. function placeholder (h, rawChild) {
  50694. if (/\d-keep-alive$/.test(rawChild.tag)) {
  50695. return h('keep-alive', {
  50696. props: rawChild.componentOptions.propsData
  50697. })
  50698. }
  50699. }
  50700. function hasParentTransition (vnode) {
  50701. while ((vnode = vnode.parent)) {
  50702. if (vnode.data.transition) {
  50703. return true
  50704. }
  50705. }
  50706. }
  50707. function isSameChild (child, oldChild) {
  50708. return oldChild.key === child.key && oldChild.tag === child.tag
  50709. }
  50710. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  50711. var isVShowDirective = function (d) { return d.name === 'show'; };
  50712. var Transition = {
  50713. name: 'transition',
  50714. props: transitionProps,
  50715. abstract: true,
  50716. render: function render (h) {
  50717. var this$1 = this;
  50718. var children = this.$slots.default;
  50719. if (!children) {
  50720. return
  50721. }
  50722. // filter out text nodes (possible whitespaces)
  50723. children = children.filter(isNotTextNode);
  50724. /* istanbul ignore if */
  50725. if (!children.length) {
  50726. return
  50727. }
  50728. // warn multiple elements
  50729. if (children.length > 1) {
  50730. warn(
  50731. '<transition> can only be used on a single element. Use ' +
  50732. '<transition-group> for lists.',
  50733. this.$parent
  50734. );
  50735. }
  50736. var mode = this.mode;
  50737. // warn invalid mode
  50738. if (mode && mode !== 'in-out' && mode !== 'out-in'
  50739. ) {
  50740. warn(
  50741. 'invalid <transition> mode: ' + mode,
  50742. this.$parent
  50743. );
  50744. }
  50745. var rawChild = children[0];
  50746. // if this is a component root node and the component's
  50747. // parent container node also has transition, skip.
  50748. if (hasParentTransition(this.$vnode)) {
  50749. return rawChild
  50750. }
  50751. // apply transition data to child
  50752. // use getRealChild() to ignore abstract components e.g. keep-alive
  50753. var child = getRealChild(rawChild);
  50754. /* istanbul ignore if */
  50755. if (!child) {
  50756. return rawChild
  50757. }
  50758. if (this._leaving) {
  50759. return placeholder(h, rawChild)
  50760. }
  50761. // ensure a key that is unique to the vnode type and to this transition
  50762. // component instance. This key will be used to remove pending leaving nodes
  50763. // during entering.
  50764. var id = "__transition-" + (this._uid) + "-";
  50765. child.key = child.key == null
  50766. ? child.isComment
  50767. ? id + 'comment'
  50768. : id + child.tag
  50769. : isPrimitive(child.key)
  50770. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  50771. : child.key;
  50772. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  50773. var oldRawChild = this._vnode;
  50774. var oldChild = getRealChild(oldRawChild);
  50775. // mark v-show
  50776. // so that the transition module can hand over the control to the directive
  50777. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  50778. child.data.show = true;
  50779. }
  50780. if (
  50781. oldChild &&
  50782. oldChild.data &&
  50783. !isSameChild(child, oldChild) &&
  50784. !isAsyncPlaceholder(oldChild) &&
  50785. // #6687 component root is a comment node
  50786. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  50787. ) {
  50788. // replace old child transition data with fresh one
  50789. // important for dynamic transitions!
  50790. var oldData = oldChild.data.transition = extend({}, data);
  50791. // handle transition mode
  50792. if (mode === 'out-in') {
  50793. // return placeholder node and queue update when leave finishes
  50794. this._leaving = true;
  50795. mergeVNodeHook(oldData, 'afterLeave', function () {
  50796. this$1._leaving = false;
  50797. this$1.$forceUpdate();
  50798. });
  50799. return placeholder(h, rawChild)
  50800. } else if (mode === 'in-out') {
  50801. if (isAsyncPlaceholder(child)) {
  50802. return oldRawChild
  50803. }
  50804. var delayedLeave;
  50805. var performLeave = function () { delayedLeave(); };
  50806. mergeVNodeHook(data, 'afterEnter', performLeave);
  50807. mergeVNodeHook(data, 'enterCancelled', performLeave);
  50808. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  50809. }
  50810. }
  50811. return rawChild
  50812. }
  50813. };
  50814. /* */
  50815. var props = extend({
  50816. tag: String,
  50817. moveClass: String
  50818. }, transitionProps);
  50819. delete props.mode;
  50820. var TransitionGroup = {
  50821. props: props,
  50822. beforeMount: function beforeMount () {
  50823. var this$1 = this;
  50824. var update = this._update;
  50825. this._update = function (vnode, hydrating) {
  50826. var restoreActiveInstance = setActiveInstance(this$1);
  50827. // force removing pass
  50828. this$1.__patch__(
  50829. this$1._vnode,
  50830. this$1.kept,
  50831. false, // hydrating
  50832. true // removeOnly (!important, avoids unnecessary moves)
  50833. );
  50834. this$1._vnode = this$1.kept;
  50835. restoreActiveInstance();
  50836. update.call(this$1, vnode, hydrating);
  50837. };
  50838. },
  50839. render: function render (h) {
  50840. var tag = this.tag || this.$vnode.data.tag || 'span';
  50841. var map = Object.create(null);
  50842. var prevChildren = this.prevChildren = this.children;
  50843. var rawChildren = this.$slots.default || [];
  50844. var children = this.children = [];
  50845. var transitionData = extractTransitionData(this);
  50846. for (var i = 0; i < rawChildren.length; i++) {
  50847. var c = rawChildren[i];
  50848. if (c.tag) {
  50849. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  50850. children.push(c);
  50851. map[c.key] = c
  50852. ;(c.data || (c.data = {})).transition = transitionData;
  50853. } else {
  50854. var opts = c.componentOptions;
  50855. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  50856. warn(("<transition-group> children must be keyed: <" + name + ">"));
  50857. }
  50858. }
  50859. }
  50860. if (prevChildren) {
  50861. var kept = [];
  50862. var removed = [];
  50863. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  50864. var c$1 = prevChildren[i$1];
  50865. c$1.data.transition = transitionData;
  50866. c$1.data.pos = c$1.elm.getBoundingClientRect();
  50867. if (map[c$1.key]) {
  50868. kept.push(c$1);
  50869. } else {
  50870. removed.push(c$1);
  50871. }
  50872. }
  50873. this.kept = h(tag, null, kept);
  50874. this.removed = removed;
  50875. }
  50876. return h(tag, null, children)
  50877. },
  50878. updated: function updated () {
  50879. var children = this.prevChildren;
  50880. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  50881. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  50882. return
  50883. }
  50884. // we divide the work into three loops to avoid mixing DOM reads and writes
  50885. // in each iteration - which helps prevent layout thrashing.
  50886. children.forEach(callPendingCbs);
  50887. children.forEach(recordPosition);
  50888. children.forEach(applyTranslation);
  50889. // force reflow to put everything in position
  50890. // assign to this to avoid being removed in tree-shaking
  50891. // $flow-disable-line
  50892. this._reflow = document.body.offsetHeight;
  50893. children.forEach(function (c) {
  50894. if (c.data.moved) {
  50895. var el = c.elm;
  50896. var s = el.style;
  50897. addTransitionClass(el, moveClass);
  50898. s.transform = s.WebkitTransform = s.transitionDuration = '';
  50899. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  50900. if (e && e.target !== el) {
  50901. return
  50902. }
  50903. if (!e || /transform$/.test(e.propertyName)) {
  50904. el.removeEventListener(transitionEndEvent, cb);
  50905. el._moveCb = null;
  50906. removeTransitionClass(el, moveClass);
  50907. }
  50908. });
  50909. }
  50910. });
  50911. },
  50912. methods: {
  50913. hasMove: function hasMove (el, moveClass) {
  50914. /* istanbul ignore if */
  50915. if (!hasTransition) {
  50916. return false
  50917. }
  50918. /* istanbul ignore if */
  50919. if (this._hasMove) {
  50920. return this._hasMove
  50921. }
  50922. // Detect whether an element with the move class applied has
  50923. // CSS transitions. Since the element may be inside an entering
  50924. // transition at this very moment, we make a clone of it and remove
  50925. // all other transition classes applied to ensure only the move class
  50926. // is applied.
  50927. var clone = el.cloneNode();
  50928. if (el._transitionClasses) {
  50929. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  50930. }
  50931. addClass(clone, moveClass);
  50932. clone.style.display = 'none';
  50933. this.$el.appendChild(clone);
  50934. var info = getTransitionInfo(clone);
  50935. this.$el.removeChild(clone);
  50936. return (this._hasMove = info.hasTransform)
  50937. }
  50938. }
  50939. };
  50940. function callPendingCbs (c) {
  50941. /* istanbul ignore if */
  50942. if (c.elm._moveCb) {
  50943. c.elm._moveCb();
  50944. }
  50945. /* istanbul ignore if */
  50946. if (c.elm._enterCb) {
  50947. c.elm._enterCb();
  50948. }
  50949. }
  50950. function recordPosition (c) {
  50951. c.data.newPos = c.elm.getBoundingClientRect();
  50952. }
  50953. function applyTranslation (c) {
  50954. var oldPos = c.data.pos;
  50955. var newPos = c.data.newPos;
  50956. var dx = oldPos.left - newPos.left;
  50957. var dy = oldPos.top - newPos.top;
  50958. if (dx || dy) {
  50959. c.data.moved = true;
  50960. var s = c.elm.style;
  50961. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  50962. s.transitionDuration = '0s';
  50963. }
  50964. }
  50965. var platformComponents = {
  50966. Transition: Transition,
  50967. TransitionGroup: TransitionGroup
  50968. };
  50969. /* */
  50970. // install platform specific utils
  50971. Vue.config.mustUseProp = mustUseProp;
  50972. Vue.config.isReservedTag = isReservedTag;
  50973. Vue.config.isReservedAttr = isReservedAttr;
  50974. Vue.config.getTagNamespace = getTagNamespace;
  50975. Vue.config.isUnknownElement = isUnknownElement;
  50976. // install platform runtime directives & components
  50977. extend(Vue.options.directives, platformDirectives);
  50978. extend(Vue.options.components, platformComponents);
  50979. // install platform patch function
  50980. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  50981. // public mount method
  50982. Vue.prototype.$mount = function (
  50983. el,
  50984. hydrating
  50985. ) {
  50986. el = el && inBrowser ? query(el) : undefined;
  50987. return mountComponent(this, el, hydrating)
  50988. };
  50989. // devtools global hook
  50990. /* istanbul ignore next */
  50991. if (inBrowser) {
  50992. setTimeout(function () {
  50993. if (config.devtools) {
  50994. if (devtools) {
  50995. devtools.emit('init', Vue);
  50996. } else {
  50997. console[console.info ? 'info' : 'log'](
  50998. 'Download the Vue Devtools extension for a better development experience:\n' +
  50999. 'https://github.com/vuejs/vue-devtools'
  51000. );
  51001. }
  51002. }
  51003. if (config.productionTip !== false &&
  51004. typeof console !== 'undefined'
  51005. ) {
  51006. console[console.info ? 'info' : 'log'](
  51007. "You are running Vue in development mode.\n" +
  51008. "Make sure to turn on production mode when deploying for production.\n" +
  51009. "See more tips at https://vuejs.org/guide/deployment.html"
  51010. );
  51011. }
  51012. }, 0);
  51013. }
  51014. /* */
  51015. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  51016. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  51017. var buildRegex = cached(function (delimiters) {
  51018. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  51019. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  51020. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  51021. });
  51022. function parseText (
  51023. text,
  51024. delimiters
  51025. ) {
  51026. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  51027. if (!tagRE.test(text)) {
  51028. return
  51029. }
  51030. var tokens = [];
  51031. var rawTokens = [];
  51032. var lastIndex = tagRE.lastIndex = 0;
  51033. var match, index, tokenValue;
  51034. while ((match = tagRE.exec(text))) {
  51035. index = match.index;
  51036. // push text token
  51037. if (index > lastIndex) {
  51038. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  51039. tokens.push(JSON.stringify(tokenValue));
  51040. }
  51041. // tag token
  51042. var exp = parseFilters(match[1].trim());
  51043. tokens.push(("_s(" + exp + ")"));
  51044. rawTokens.push({ '@binding': exp });
  51045. lastIndex = index + match[0].length;
  51046. }
  51047. if (lastIndex < text.length) {
  51048. rawTokens.push(tokenValue = text.slice(lastIndex));
  51049. tokens.push(JSON.stringify(tokenValue));
  51050. }
  51051. return {
  51052. expression: tokens.join('+'),
  51053. tokens: rawTokens
  51054. }
  51055. }
  51056. /* */
  51057. function transformNode (el, options) {
  51058. var warn = options.warn || baseWarn;
  51059. var staticClass = getAndRemoveAttr(el, 'class');
  51060. if (staticClass) {
  51061. var res = parseText(staticClass, options.delimiters);
  51062. if (res) {
  51063. warn(
  51064. "class=\"" + staticClass + "\": " +
  51065. 'Interpolation inside attributes has been removed. ' +
  51066. 'Use v-bind or the colon shorthand instead. For example, ' +
  51067. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  51068. el.rawAttrsMap['class']
  51069. );
  51070. }
  51071. }
  51072. if (staticClass) {
  51073. el.staticClass = JSON.stringify(staticClass);
  51074. }
  51075. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  51076. if (classBinding) {
  51077. el.classBinding = classBinding;
  51078. }
  51079. }
  51080. function genData (el) {
  51081. var data = '';
  51082. if (el.staticClass) {
  51083. data += "staticClass:" + (el.staticClass) + ",";
  51084. }
  51085. if (el.classBinding) {
  51086. data += "class:" + (el.classBinding) + ",";
  51087. }
  51088. return data
  51089. }
  51090. var klass$1 = {
  51091. staticKeys: ['staticClass'],
  51092. transformNode: transformNode,
  51093. genData: genData
  51094. };
  51095. /* */
  51096. function transformNode$1 (el, options) {
  51097. var warn = options.warn || baseWarn;
  51098. var staticStyle = getAndRemoveAttr(el, 'style');
  51099. if (staticStyle) {
  51100. /* istanbul ignore if */
  51101. {
  51102. var res = parseText(staticStyle, options.delimiters);
  51103. if (res) {
  51104. warn(
  51105. "style=\"" + staticStyle + "\": " +
  51106. 'Interpolation inside attributes has been removed. ' +
  51107. 'Use v-bind or the colon shorthand instead. For example, ' +
  51108. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  51109. el.rawAttrsMap['style']
  51110. );
  51111. }
  51112. }
  51113. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  51114. }
  51115. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  51116. if (styleBinding) {
  51117. el.styleBinding = styleBinding;
  51118. }
  51119. }
  51120. function genData$1 (el) {
  51121. var data = '';
  51122. if (el.staticStyle) {
  51123. data += "staticStyle:" + (el.staticStyle) + ",";
  51124. }
  51125. if (el.styleBinding) {
  51126. data += "style:(" + (el.styleBinding) + "),";
  51127. }
  51128. return data
  51129. }
  51130. var style$1 = {
  51131. staticKeys: ['staticStyle'],
  51132. transformNode: transformNode$1,
  51133. genData: genData$1
  51134. };
  51135. /* */
  51136. var decoder;
  51137. var he = {
  51138. decode: function decode (html) {
  51139. decoder = decoder || document.createElement('div');
  51140. decoder.innerHTML = html;
  51141. return decoder.textContent
  51142. }
  51143. };
  51144. /* */
  51145. var isUnaryTag = makeMap(
  51146. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  51147. 'link,meta,param,source,track,wbr'
  51148. );
  51149. // Elements that you can, intentionally, leave open
  51150. // (and which close themselves)
  51151. var canBeLeftOpenTag = makeMap(
  51152. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  51153. );
  51154. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  51155. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  51156. var isNonPhrasingTag = makeMap(
  51157. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  51158. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  51159. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  51160. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  51161. 'title,tr,track'
  51162. );
  51163. /**
  51164. * Not type-checking this file because it's mostly vendor code.
  51165. */
  51166. // Regular Expressions for parsing tags and attributes
  51167. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  51168. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  51169. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  51170. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  51171. var startTagOpen = new RegExp(("^<" + qnameCapture));
  51172. var startTagClose = /^\s*(\/?)>/;
  51173. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  51174. var doctype = /^<!DOCTYPE [^>]+>/i;
  51175. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  51176. var comment = /^<!\--/;
  51177. var conditionalComment = /^<!\[/;
  51178. // Special Elements (can contain anything)
  51179. var isPlainTextElement = makeMap('script,style,textarea', true);
  51180. var reCache = {};
  51181. var decodingMap = {
  51182. '&lt;': '<',
  51183. '&gt;': '>',
  51184. '&quot;': '"',
  51185. '&amp;': '&',
  51186. '&#10;': '\n',
  51187. '&#9;': '\t',
  51188. '&#39;': "'"
  51189. };
  51190. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  51191. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  51192. // #5992
  51193. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  51194. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  51195. function decodeAttr (value, shouldDecodeNewlines) {
  51196. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  51197. return value.replace(re, function (match) { return decodingMap[match]; })
  51198. }
  51199. function parseHTML (html, options) {
  51200. var stack = [];
  51201. var expectHTML = options.expectHTML;
  51202. var isUnaryTag$$1 = options.isUnaryTag || no;
  51203. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  51204. var index = 0;
  51205. var last, lastTag;
  51206. while (html) {
  51207. last = html;
  51208. // Make sure we're not in a plaintext content element like script/style
  51209. if (!lastTag || !isPlainTextElement(lastTag)) {
  51210. var textEnd = html.indexOf('<');
  51211. if (textEnd === 0) {
  51212. // Comment:
  51213. if (comment.test(html)) {
  51214. var commentEnd = html.indexOf('-->');
  51215. if (commentEnd >= 0) {
  51216. if (options.shouldKeepComment) {
  51217. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  51218. }
  51219. advance(commentEnd + 3);
  51220. continue
  51221. }
  51222. }
  51223. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  51224. if (conditionalComment.test(html)) {
  51225. var conditionalEnd = html.indexOf(']>');
  51226. if (conditionalEnd >= 0) {
  51227. advance(conditionalEnd + 2);
  51228. continue
  51229. }
  51230. }
  51231. // Doctype:
  51232. var doctypeMatch = html.match(doctype);
  51233. if (doctypeMatch) {
  51234. advance(doctypeMatch[0].length);
  51235. continue
  51236. }
  51237. // End tag:
  51238. var endTagMatch = html.match(endTag);
  51239. if (endTagMatch) {
  51240. var curIndex = index;
  51241. advance(endTagMatch[0].length);
  51242. parseEndTag(endTagMatch[1], curIndex, index);
  51243. continue
  51244. }
  51245. // Start tag:
  51246. var startTagMatch = parseStartTag();
  51247. if (startTagMatch) {
  51248. handleStartTag(startTagMatch);
  51249. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  51250. advance(1);
  51251. }
  51252. continue
  51253. }
  51254. }
  51255. var text = (void 0), rest = (void 0), next = (void 0);
  51256. if (textEnd >= 0) {
  51257. rest = html.slice(textEnd);
  51258. while (
  51259. !endTag.test(rest) &&
  51260. !startTagOpen.test(rest) &&
  51261. !comment.test(rest) &&
  51262. !conditionalComment.test(rest)
  51263. ) {
  51264. // < in plain text, be forgiving and treat it as text
  51265. next = rest.indexOf('<', 1);
  51266. if (next < 0) { break }
  51267. textEnd += next;
  51268. rest = html.slice(textEnd);
  51269. }
  51270. text = html.substring(0, textEnd);
  51271. }
  51272. if (textEnd < 0) {
  51273. text = html;
  51274. }
  51275. if (text) {
  51276. advance(text.length);
  51277. }
  51278. if (options.chars && text) {
  51279. options.chars(text, index - text.length, index);
  51280. }
  51281. } else {
  51282. var endTagLength = 0;
  51283. var stackedTag = lastTag.toLowerCase();
  51284. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  51285. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  51286. endTagLength = endTag.length;
  51287. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  51288. text = text
  51289. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  51290. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  51291. }
  51292. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  51293. text = text.slice(1);
  51294. }
  51295. if (options.chars) {
  51296. options.chars(text);
  51297. }
  51298. return ''
  51299. });
  51300. index += html.length - rest$1.length;
  51301. html = rest$1;
  51302. parseEndTag(stackedTag, index - endTagLength, index);
  51303. }
  51304. if (html === last) {
  51305. options.chars && options.chars(html);
  51306. if (!stack.length && options.warn) {
  51307. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  51308. }
  51309. break
  51310. }
  51311. }
  51312. // Clean up any remaining tags
  51313. parseEndTag();
  51314. function advance (n) {
  51315. index += n;
  51316. html = html.substring(n);
  51317. }
  51318. function parseStartTag () {
  51319. var start = html.match(startTagOpen);
  51320. if (start) {
  51321. var match = {
  51322. tagName: start[1],
  51323. attrs: [],
  51324. start: index
  51325. };
  51326. advance(start[0].length);
  51327. var end, attr;
  51328. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  51329. attr.start = index;
  51330. advance(attr[0].length);
  51331. attr.end = index;
  51332. match.attrs.push(attr);
  51333. }
  51334. if (end) {
  51335. match.unarySlash = end[1];
  51336. advance(end[0].length);
  51337. match.end = index;
  51338. return match
  51339. }
  51340. }
  51341. }
  51342. function handleStartTag (match) {
  51343. var tagName = match.tagName;
  51344. var unarySlash = match.unarySlash;
  51345. if (expectHTML) {
  51346. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  51347. parseEndTag(lastTag);
  51348. }
  51349. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  51350. parseEndTag(tagName);
  51351. }
  51352. }
  51353. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  51354. var l = match.attrs.length;
  51355. var attrs = new Array(l);
  51356. for (var i = 0; i < l; i++) {
  51357. var args = match.attrs[i];
  51358. var value = args[3] || args[4] || args[5] || '';
  51359. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  51360. ? options.shouldDecodeNewlinesForHref
  51361. : options.shouldDecodeNewlines;
  51362. attrs[i] = {
  51363. name: args[1],
  51364. value: decodeAttr(value, shouldDecodeNewlines)
  51365. };
  51366. if (options.outputSourceRange) {
  51367. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  51368. attrs[i].end = args.end;
  51369. }
  51370. }
  51371. if (!unary) {
  51372. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  51373. lastTag = tagName;
  51374. }
  51375. if (options.start) {
  51376. options.start(tagName, attrs, unary, match.start, match.end);
  51377. }
  51378. }
  51379. function parseEndTag (tagName, start, end) {
  51380. var pos, lowerCasedTagName;
  51381. if (start == null) { start = index; }
  51382. if (end == null) { end = index; }
  51383. // Find the closest opened tag of the same type
  51384. if (tagName) {
  51385. lowerCasedTagName = tagName.toLowerCase();
  51386. for (pos = stack.length - 1; pos >= 0; pos--) {
  51387. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  51388. break
  51389. }
  51390. }
  51391. } else {
  51392. // If no tag name is provided, clean shop
  51393. pos = 0;
  51394. }
  51395. if (pos >= 0) {
  51396. // Close all the open elements, up the stack
  51397. for (var i = stack.length - 1; i >= pos; i--) {
  51398. if (i > pos || !tagName &&
  51399. options.warn
  51400. ) {
  51401. options.warn(
  51402. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  51403. { start: stack[i].start, end: stack[i].end }
  51404. );
  51405. }
  51406. if (options.end) {
  51407. options.end(stack[i].tag, start, end);
  51408. }
  51409. }
  51410. // Remove the open elements from the stack
  51411. stack.length = pos;
  51412. lastTag = pos && stack[pos - 1].tag;
  51413. } else if (lowerCasedTagName === 'br') {
  51414. if (options.start) {
  51415. options.start(tagName, [], true, start, end);
  51416. }
  51417. } else if (lowerCasedTagName === 'p') {
  51418. if (options.start) {
  51419. options.start(tagName, [], false, start, end);
  51420. }
  51421. if (options.end) {
  51422. options.end(tagName, start, end);
  51423. }
  51424. }
  51425. }
  51426. }
  51427. /* */
  51428. var onRE = /^@|^v-on:/;
  51429. var dirRE = /^v-|^@|^:|^#/;
  51430. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  51431. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  51432. var stripParensRE = /^\(|\)$/g;
  51433. var dynamicArgRE = /^\[.*\]$/;
  51434. var argRE = /:(.*)$/;
  51435. var bindRE = /^:|^\.|^v-bind:/;
  51436. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  51437. var slotRE = /^v-slot(:|$)|^#/;
  51438. var lineBreakRE = /[\r\n]/;
  51439. var whitespaceRE$1 = /\s+/g;
  51440. var invalidAttributeRE = /[\s"'<>\/=]/;
  51441. var decodeHTMLCached = cached(he.decode);
  51442. var emptySlotScopeToken = "_empty_";
  51443. // configurable state
  51444. var warn$2;
  51445. var delimiters;
  51446. var transforms;
  51447. var preTransforms;
  51448. var postTransforms;
  51449. var platformIsPreTag;
  51450. var platformMustUseProp;
  51451. var platformGetTagNamespace;
  51452. var maybeComponent;
  51453. function createASTElement (
  51454. tag,
  51455. attrs,
  51456. parent
  51457. ) {
  51458. return {
  51459. type: 1,
  51460. tag: tag,
  51461. attrsList: attrs,
  51462. attrsMap: makeAttrsMap(attrs),
  51463. rawAttrsMap: {},
  51464. parent: parent,
  51465. children: []
  51466. }
  51467. }
  51468. /**
  51469. * Convert HTML string to AST.
  51470. */
  51471. function parse (
  51472. template,
  51473. options
  51474. ) {
  51475. warn$2 = options.warn || baseWarn;
  51476. platformIsPreTag = options.isPreTag || no;
  51477. platformMustUseProp = options.mustUseProp || no;
  51478. platformGetTagNamespace = options.getTagNamespace || no;
  51479. var isReservedTag = options.isReservedTag || no;
  51480. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  51481. transforms = pluckModuleFunction(options.modules, 'transformNode');
  51482. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  51483. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  51484. delimiters = options.delimiters;
  51485. var stack = [];
  51486. var preserveWhitespace = options.preserveWhitespace !== false;
  51487. var whitespaceOption = options.whitespace;
  51488. var root;
  51489. var currentParent;
  51490. var inVPre = false;
  51491. var inPre = false;
  51492. var warned = false;
  51493. function warnOnce (msg, range) {
  51494. if (!warned) {
  51495. warned = true;
  51496. warn$2(msg, range);
  51497. }
  51498. }
  51499. function closeElement (element) {
  51500. trimEndingWhitespace(element);
  51501. if (!inVPre && !element.processed) {
  51502. element = processElement(element, options);
  51503. }
  51504. // tree management
  51505. if (!stack.length && element !== root) {
  51506. // allow root elements with v-if, v-else-if and v-else
  51507. if (root.if && (element.elseif || element.else)) {
  51508. {
  51509. checkRootConstraints(element);
  51510. }
  51511. addIfCondition(root, {
  51512. exp: element.elseif,
  51513. block: element
  51514. });
  51515. } else {
  51516. warnOnce(
  51517. "Component template should contain exactly one root element. " +
  51518. "If you are using v-if on multiple elements, " +
  51519. "use v-else-if to chain them instead.",
  51520. { start: element.start }
  51521. );
  51522. }
  51523. }
  51524. if (currentParent && !element.forbidden) {
  51525. if (element.elseif || element.else) {
  51526. processIfConditions(element, currentParent);
  51527. } else {
  51528. if (element.slotScope) {
  51529. // scoped slot
  51530. // keep it in the children list so that v-else(-if) conditions can
  51531. // find it as the prev node.
  51532. var name = element.slotTarget || '"default"'
  51533. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  51534. }
  51535. currentParent.children.push(element);
  51536. element.parent = currentParent;
  51537. }
  51538. }
  51539. // final children cleanup
  51540. // filter out scoped slots
  51541. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  51542. // remove trailing whitespace node again
  51543. trimEndingWhitespace(element);
  51544. // check pre state
  51545. if (element.pre) {
  51546. inVPre = false;
  51547. }
  51548. if (platformIsPreTag(element.tag)) {
  51549. inPre = false;
  51550. }
  51551. // apply post-transforms
  51552. for (var i = 0; i < postTransforms.length; i++) {
  51553. postTransforms[i](element, options);
  51554. }
  51555. }
  51556. function trimEndingWhitespace (el) {
  51557. // remove trailing whitespace node
  51558. if (!inPre) {
  51559. var lastNode;
  51560. while (
  51561. (lastNode = el.children[el.children.length - 1]) &&
  51562. lastNode.type === 3 &&
  51563. lastNode.text === ' '
  51564. ) {
  51565. el.children.pop();
  51566. }
  51567. }
  51568. }
  51569. function checkRootConstraints (el) {
  51570. if (el.tag === 'slot' || el.tag === 'template') {
  51571. warnOnce(
  51572. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  51573. 'contain multiple nodes.',
  51574. { start: el.start }
  51575. );
  51576. }
  51577. if (el.attrsMap.hasOwnProperty('v-for')) {
  51578. warnOnce(
  51579. 'Cannot use v-for on stateful component root element because ' +
  51580. 'it renders multiple elements.',
  51581. el.rawAttrsMap['v-for']
  51582. );
  51583. }
  51584. }
  51585. parseHTML(template, {
  51586. warn: warn$2,
  51587. expectHTML: options.expectHTML,
  51588. isUnaryTag: options.isUnaryTag,
  51589. canBeLeftOpenTag: options.canBeLeftOpenTag,
  51590. shouldDecodeNewlines: options.shouldDecodeNewlines,
  51591. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  51592. shouldKeepComment: options.comments,
  51593. outputSourceRange: options.outputSourceRange,
  51594. start: function start (tag, attrs, unary, start$1, end) {
  51595. // check namespace.
  51596. // inherit parent ns if there is one
  51597. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  51598. // handle IE svg bug
  51599. /* istanbul ignore if */
  51600. if (isIE && ns === 'svg') {
  51601. attrs = guardIESVGBug(attrs);
  51602. }
  51603. var element = createASTElement(tag, attrs, currentParent);
  51604. if (ns) {
  51605. element.ns = ns;
  51606. }
  51607. {
  51608. if (options.outputSourceRange) {
  51609. element.start = start$1;
  51610. element.end = end;
  51611. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  51612. cumulated[attr.name] = attr;
  51613. return cumulated
  51614. }, {});
  51615. }
  51616. attrs.forEach(function (attr) {
  51617. if (invalidAttributeRE.test(attr.name)) {
  51618. warn$2(
  51619. "Invalid dynamic argument expression: attribute names cannot contain " +
  51620. "spaces, quotes, <, >, / or =.",
  51621. {
  51622. start: attr.start + attr.name.indexOf("["),
  51623. end: attr.start + attr.name.length
  51624. }
  51625. );
  51626. }
  51627. });
  51628. }
  51629. if (isForbiddenTag(element) && !isServerRendering()) {
  51630. element.forbidden = true;
  51631. warn$2(
  51632. 'Templates should only be responsible for mapping the state to the ' +
  51633. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  51634. "<" + tag + ">" + ', as they will not be parsed.',
  51635. { start: element.start }
  51636. );
  51637. }
  51638. // apply pre-transforms
  51639. for (var i = 0; i < preTransforms.length; i++) {
  51640. element = preTransforms[i](element, options) || element;
  51641. }
  51642. if (!inVPre) {
  51643. processPre(element);
  51644. if (element.pre) {
  51645. inVPre = true;
  51646. }
  51647. }
  51648. if (platformIsPreTag(element.tag)) {
  51649. inPre = true;
  51650. }
  51651. if (inVPre) {
  51652. processRawAttrs(element);
  51653. } else if (!element.processed) {
  51654. // structural directives
  51655. processFor(element);
  51656. processIf(element);
  51657. processOnce(element);
  51658. }
  51659. if (!root) {
  51660. root = element;
  51661. {
  51662. checkRootConstraints(root);
  51663. }
  51664. }
  51665. if (!unary) {
  51666. currentParent = element;
  51667. stack.push(element);
  51668. } else {
  51669. closeElement(element);
  51670. }
  51671. },
  51672. end: function end (tag, start, end$1) {
  51673. var element = stack[stack.length - 1];
  51674. // pop stack
  51675. stack.length -= 1;
  51676. currentParent = stack[stack.length - 1];
  51677. if (options.outputSourceRange) {
  51678. element.end = end$1;
  51679. }
  51680. closeElement(element);
  51681. },
  51682. chars: function chars (text, start, end) {
  51683. if (!currentParent) {
  51684. {
  51685. if (text === template) {
  51686. warnOnce(
  51687. 'Component template requires a root element, rather than just text.',
  51688. { start: start }
  51689. );
  51690. } else if ((text = text.trim())) {
  51691. warnOnce(
  51692. ("text \"" + text + "\" outside root element will be ignored."),
  51693. { start: start }
  51694. );
  51695. }
  51696. }
  51697. return
  51698. }
  51699. // IE textarea placeholder bug
  51700. /* istanbul ignore if */
  51701. if (isIE &&
  51702. currentParent.tag === 'textarea' &&
  51703. currentParent.attrsMap.placeholder === text
  51704. ) {
  51705. return
  51706. }
  51707. var children = currentParent.children;
  51708. if (inPre || text.trim()) {
  51709. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  51710. } else if (!children.length) {
  51711. // remove the whitespace-only node right after an opening tag
  51712. text = '';
  51713. } else if (whitespaceOption) {
  51714. if (whitespaceOption === 'condense') {
  51715. // in condense mode, remove the whitespace node if it contains
  51716. // line break, otherwise condense to a single space
  51717. text = lineBreakRE.test(text) ? '' : ' ';
  51718. } else {
  51719. text = ' ';
  51720. }
  51721. } else {
  51722. text = preserveWhitespace ? ' ' : '';
  51723. }
  51724. if (text) {
  51725. if (!inPre && whitespaceOption === 'condense') {
  51726. // condense consecutive whitespaces into single space
  51727. text = text.replace(whitespaceRE$1, ' ');
  51728. }
  51729. var res;
  51730. var child;
  51731. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  51732. child = {
  51733. type: 2,
  51734. expression: res.expression,
  51735. tokens: res.tokens,
  51736. text: text
  51737. };
  51738. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  51739. child = {
  51740. type: 3,
  51741. text: text
  51742. };
  51743. }
  51744. if (child) {
  51745. if (options.outputSourceRange) {
  51746. child.start = start;
  51747. child.end = end;
  51748. }
  51749. children.push(child);
  51750. }
  51751. }
  51752. },
  51753. comment: function comment (text, start, end) {
  51754. // adding anyting as a sibling to the root node is forbidden
  51755. // comments should still be allowed, but ignored
  51756. if (currentParent) {
  51757. var child = {
  51758. type: 3,
  51759. text: text,
  51760. isComment: true
  51761. };
  51762. if (options.outputSourceRange) {
  51763. child.start = start;
  51764. child.end = end;
  51765. }
  51766. currentParent.children.push(child);
  51767. }
  51768. }
  51769. });
  51770. return root
  51771. }
  51772. function processPre (el) {
  51773. if (getAndRemoveAttr(el, 'v-pre') != null) {
  51774. el.pre = true;
  51775. }
  51776. }
  51777. function processRawAttrs (el) {
  51778. var list = el.attrsList;
  51779. var len = list.length;
  51780. if (len) {
  51781. var attrs = el.attrs = new Array(len);
  51782. for (var i = 0; i < len; i++) {
  51783. attrs[i] = {
  51784. name: list[i].name,
  51785. value: JSON.stringify(list[i].value)
  51786. };
  51787. if (list[i].start != null) {
  51788. attrs[i].start = list[i].start;
  51789. attrs[i].end = list[i].end;
  51790. }
  51791. }
  51792. } else if (!el.pre) {
  51793. // non root node in pre blocks with no attributes
  51794. el.plain = true;
  51795. }
  51796. }
  51797. function processElement (
  51798. element,
  51799. options
  51800. ) {
  51801. processKey(element);
  51802. // determine whether this is a plain element after
  51803. // removing structural attributes
  51804. element.plain = (
  51805. !element.key &&
  51806. !element.scopedSlots &&
  51807. !element.attrsList.length
  51808. );
  51809. processRef(element);
  51810. processSlotContent(element);
  51811. processSlotOutlet(element);
  51812. processComponent(element);
  51813. for (var i = 0; i < transforms.length; i++) {
  51814. element = transforms[i](element, options) || element;
  51815. }
  51816. processAttrs(element);
  51817. return element
  51818. }
  51819. function processKey (el) {
  51820. var exp = getBindingAttr(el, 'key');
  51821. if (exp) {
  51822. {
  51823. if (el.tag === 'template') {
  51824. warn$2(
  51825. "<template> cannot be keyed. Place the key on real elements instead.",
  51826. getRawBindingAttr(el, 'key')
  51827. );
  51828. }
  51829. if (el.for) {
  51830. var iterator = el.iterator2 || el.iterator1;
  51831. var parent = el.parent;
  51832. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  51833. warn$2(
  51834. "Do not use v-for index as key on <transition-group> children, " +
  51835. "this is the same as not using keys.",
  51836. getRawBindingAttr(el, 'key'),
  51837. true /* tip */
  51838. );
  51839. }
  51840. }
  51841. }
  51842. el.key = exp;
  51843. }
  51844. }
  51845. function processRef (el) {
  51846. var ref = getBindingAttr(el, 'ref');
  51847. if (ref) {
  51848. el.ref = ref;
  51849. el.refInFor = checkInFor(el);
  51850. }
  51851. }
  51852. function processFor (el) {
  51853. var exp;
  51854. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  51855. var res = parseFor(exp);
  51856. if (res) {
  51857. extend(el, res);
  51858. } else {
  51859. warn$2(
  51860. ("Invalid v-for expression: " + exp),
  51861. el.rawAttrsMap['v-for']
  51862. );
  51863. }
  51864. }
  51865. }
  51866. function parseFor (exp) {
  51867. var inMatch = exp.match(forAliasRE);
  51868. if (!inMatch) { return }
  51869. var res = {};
  51870. res.for = inMatch[2].trim();
  51871. var alias = inMatch[1].trim().replace(stripParensRE, '');
  51872. var iteratorMatch = alias.match(forIteratorRE);
  51873. if (iteratorMatch) {
  51874. res.alias = alias.replace(forIteratorRE, '').trim();
  51875. res.iterator1 = iteratorMatch[1].trim();
  51876. if (iteratorMatch[2]) {
  51877. res.iterator2 = iteratorMatch[2].trim();
  51878. }
  51879. } else {
  51880. res.alias = alias;
  51881. }
  51882. return res
  51883. }
  51884. function processIf (el) {
  51885. var exp = getAndRemoveAttr(el, 'v-if');
  51886. if (exp) {
  51887. el.if = exp;
  51888. addIfCondition(el, {
  51889. exp: exp,
  51890. block: el
  51891. });
  51892. } else {
  51893. if (getAndRemoveAttr(el, 'v-else') != null) {
  51894. el.else = true;
  51895. }
  51896. var elseif = getAndRemoveAttr(el, 'v-else-if');
  51897. if (elseif) {
  51898. el.elseif = elseif;
  51899. }
  51900. }
  51901. }
  51902. function processIfConditions (el, parent) {
  51903. var prev = findPrevElement(parent.children);
  51904. if (prev && prev.if) {
  51905. addIfCondition(prev, {
  51906. exp: el.elseif,
  51907. block: el
  51908. });
  51909. } else {
  51910. warn$2(
  51911. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  51912. "used on element <" + (el.tag) + "> without corresponding v-if.",
  51913. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  51914. );
  51915. }
  51916. }
  51917. function findPrevElement (children) {
  51918. var i = children.length;
  51919. while (i--) {
  51920. if (children[i].type === 1) {
  51921. return children[i]
  51922. } else {
  51923. if (children[i].text !== ' ') {
  51924. warn$2(
  51925. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  51926. "will be ignored.",
  51927. children[i]
  51928. );
  51929. }
  51930. children.pop();
  51931. }
  51932. }
  51933. }
  51934. function addIfCondition (el, condition) {
  51935. if (!el.ifConditions) {
  51936. el.ifConditions = [];
  51937. }
  51938. el.ifConditions.push(condition);
  51939. }
  51940. function processOnce (el) {
  51941. var once$$1 = getAndRemoveAttr(el, 'v-once');
  51942. if (once$$1 != null) {
  51943. el.once = true;
  51944. }
  51945. }
  51946. // handle content being passed to a component as slot,
  51947. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  51948. function processSlotContent (el) {
  51949. var slotScope;
  51950. if (el.tag === 'template') {
  51951. slotScope = getAndRemoveAttr(el, 'scope');
  51952. /* istanbul ignore if */
  51953. if (slotScope) {
  51954. warn$2(
  51955. "the \"scope\" attribute for scoped slots have been deprecated and " +
  51956. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  51957. "can also be used on plain elements in addition to <template> to " +
  51958. "denote scoped slots.",
  51959. el.rawAttrsMap['scope'],
  51960. true
  51961. );
  51962. }
  51963. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  51964. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  51965. /* istanbul ignore if */
  51966. if (el.attrsMap['v-for']) {
  51967. warn$2(
  51968. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  51969. "(v-for takes higher priority). Use a wrapper <template> for the " +
  51970. "scoped slot to make it clearer.",
  51971. el.rawAttrsMap['slot-scope'],
  51972. true
  51973. );
  51974. }
  51975. el.slotScope = slotScope;
  51976. }
  51977. // slot="xxx"
  51978. var slotTarget = getBindingAttr(el, 'slot');
  51979. if (slotTarget) {
  51980. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  51981. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  51982. // preserve slot as an attribute for native shadow DOM compat
  51983. // only for non-scoped slots.
  51984. if (el.tag !== 'template' && !el.slotScope) {
  51985. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  51986. }
  51987. }
  51988. // 2.6 v-slot syntax
  51989. {
  51990. if (el.tag === 'template') {
  51991. // v-slot on <template>
  51992. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  51993. if (slotBinding) {
  51994. {
  51995. if (el.slotTarget || el.slotScope) {
  51996. warn$2(
  51997. "Unexpected mixed usage of different slot syntaxes.",
  51998. el
  51999. );
  52000. }
  52001. if (el.parent && !maybeComponent(el.parent)) {
  52002. warn$2(
  52003. "<template v-slot> can only appear at the root level inside " +
  52004. "the receiving component",
  52005. el
  52006. );
  52007. }
  52008. }
  52009. var ref = getSlotName(slotBinding);
  52010. var name = ref.name;
  52011. var dynamic = ref.dynamic;
  52012. el.slotTarget = name;
  52013. el.slotTargetDynamic = dynamic;
  52014. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  52015. }
  52016. } else {
  52017. // v-slot on component, denotes default slot
  52018. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  52019. if (slotBinding$1) {
  52020. {
  52021. if (!maybeComponent(el)) {
  52022. warn$2(
  52023. "v-slot can only be used on components or <template>.",
  52024. slotBinding$1
  52025. );
  52026. }
  52027. if (el.slotScope || el.slotTarget) {
  52028. warn$2(
  52029. "Unexpected mixed usage of different slot syntaxes.",
  52030. el
  52031. );
  52032. }
  52033. if (el.scopedSlots) {
  52034. warn$2(
  52035. "To avoid scope ambiguity, the default slot should also use " +
  52036. "<template> syntax when there are other named slots.",
  52037. slotBinding$1
  52038. );
  52039. }
  52040. }
  52041. // add the component's children to its default slot
  52042. var slots = el.scopedSlots || (el.scopedSlots = {});
  52043. var ref$1 = getSlotName(slotBinding$1);
  52044. var name$1 = ref$1.name;
  52045. var dynamic$1 = ref$1.dynamic;
  52046. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  52047. slotContainer.slotTarget = name$1;
  52048. slotContainer.slotTargetDynamic = dynamic$1;
  52049. slotContainer.children = el.children.filter(function (c) {
  52050. if (!c.slotScope) {
  52051. c.parent = slotContainer;
  52052. return true
  52053. }
  52054. });
  52055. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  52056. // remove children as they are returned from scopedSlots now
  52057. el.children = [];
  52058. // mark el non-plain so data gets generated
  52059. el.plain = false;
  52060. }
  52061. }
  52062. }
  52063. }
  52064. function getSlotName (binding) {
  52065. var name = binding.name.replace(slotRE, '');
  52066. if (!name) {
  52067. if (binding.name[0] !== '#') {
  52068. name = 'default';
  52069. } else {
  52070. warn$2(
  52071. "v-slot shorthand syntax requires a slot name.",
  52072. binding
  52073. );
  52074. }
  52075. }
  52076. return dynamicArgRE.test(name)
  52077. // dynamic [name]
  52078. ? { name: name.slice(1, -1), dynamic: true }
  52079. // static name
  52080. : { name: ("\"" + name + "\""), dynamic: false }
  52081. }
  52082. // handle <slot/> outlets
  52083. function processSlotOutlet (el) {
  52084. if (el.tag === 'slot') {
  52085. el.slotName = getBindingAttr(el, 'name');
  52086. if (el.key) {
  52087. warn$2(
  52088. "`key` does not work on <slot> because slots are abstract outlets " +
  52089. "and can possibly expand into multiple elements. " +
  52090. "Use the key on a wrapping element instead.",
  52091. getRawBindingAttr(el, 'key')
  52092. );
  52093. }
  52094. }
  52095. }
  52096. function processComponent (el) {
  52097. var binding;
  52098. if ((binding = getBindingAttr(el, 'is'))) {
  52099. el.component = binding;
  52100. }
  52101. if (getAndRemoveAttr(el, 'inline-template') != null) {
  52102. el.inlineTemplate = true;
  52103. }
  52104. }
  52105. function processAttrs (el) {
  52106. var list = el.attrsList;
  52107. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  52108. for (i = 0, l = list.length; i < l; i++) {
  52109. name = rawName = list[i].name;
  52110. value = list[i].value;
  52111. if (dirRE.test(name)) {
  52112. // mark element as dynamic
  52113. el.hasBindings = true;
  52114. // modifiers
  52115. modifiers = parseModifiers(name.replace(dirRE, ''));
  52116. // support .foo shorthand syntax for the .prop modifier
  52117. if (modifiers) {
  52118. name = name.replace(modifierRE, '');
  52119. }
  52120. if (bindRE.test(name)) { // v-bind
  52121. name = name.replace(bindRE, '');
  52122. value = parseFilters(value);
  52123. isDynamic = dynamicArgRE.test(name);
  52124. if (isDynamic) {
  52125. name = name.slice(1, -1);
  52126. }
  52127. if (
  52128. value.trim().length === 0
  52129. ) {
  52130. warn$2(
  52131. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  52132. );
  52133. }
  52134. if (modifiers) {
  52135. if (modifiers.prop && !isDynamic) {
  52136. name = camelize(name);
  52137. if (name === 'innerHtml') { name = 'innerHTML'; }
  52138. }
  52139. if (modifiers.camel && !isDynamic) {
  52140. name = camelize(name);
  52141. }
  52142. if (modifiers.sync) {
  52143. syncGen = genAssignmentCode(value, "$event");
  52144. if (!isDynamic) {
  52145. addHandler(
  52146. el,
  52147. ("update:" + (camelize(name))),
  52148. syncGen,
  52149. null,
  52150. false,
  52151. warn$2,
  52152. list[i]
  52153. );
  52154. if (hyphenate(name) !== camelize(name)) {
  52155. addHandler(
  52156. el,
  52157. ("update:" + (hyphenate(name))),
  52158. syncGen,
  52159. null,
  52160. false,
  52161. warn$2,
  52162. list[i]
  52163. );
  52164. }
  52165. } else {
  52166. // handler w/ dynamic event name
  52167. addHandler(
  52168. el,
  52169. ("\"update:\"+(" + name + ")"),
  52170. syncGen,
  52171. null,
  52172. false,
  52173. warn$2,
  52174. list[i],
  52175. true // dynamic
  52176. );
  52177. }
  52178. }
  52179. }
  52180. if ((modifiers && modifiers.prop) || (
  52181. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  52182. )) {
  52183. addProp(el, name, value, list[i], isDynamic);
  52184. } else {
  52185. addAttr(el, name, value, list[i], isDynamic);
  52186. }
  52187. } else if (onRE.test(name)) { // v-on
  52188. name = name.replace(onRE, '');
  52189. isDynamic = dynamicArgRE.test(name);
  52190. if (isDynamic) {
  52191. name = name.slice(1, -1);
  52192. }
  52193. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  52194. } else { // normal directives
  52195. name = name.replace(dirRE, '');
  52196. // parse arg
  52197. var argMatch = name.match(argRE);
  52198. var arg = argMatch && argMatch[1];
  52199. isDynamic = false;
  52200. if (arg) {
  52201. name = name.slice(0, -(arg.length + 1));
  52202. if (dynamicArgRE.test(arg)) {
  52203. arg = arg.slice(1, -1);
  52204. isDynamic = true;
  52205. }
  52206. }
  52207. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  52208. if (name === 'model') {
  52209. checkForAliasModel(el, value);
  52210. }
  52211. }
  52212. } else {
  52213. // literal attribute
  52214. {
  52215. var res = parseText(value, delimiters);
  52216. if (res) {
  52217. warn$2(
  52218. name + "=\"" + value + "\": " +
  52219. 'Interpolation inside attributes has been removed. ' +
  52220. 'Use v-bind or the colon shorthand instead. For example, ' +
  52221. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  52222. list[i]
  52223. );
  52224. }
  52225. }
  52226. addAttr(el, name, JSON.stringify(value), list[i]);
  52227. // #6887 firefox doesn't update muted state if set via attribute
  52228. // even immediately after element creation
  52229. if (!el.component &&
  52230. name === 'muted' &&
  52231. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  52232. addProp(el, name, 'true', list[i]);
  52233. }
  52234. }
  52235. }
  52236. }
  52237. function checkInFor (el) {
  52238. var parent = el;
  52239. while (parent) {
  52240. if (parent.for !== undefined) {
  52241. return true
  52242. }
  52243. parent = parent.parent;
  52244. }
  52245. return false
  52246. }
  52247. function parseModifiers (name) {
  52248. var match = name.match(modifierRE);
  52249. if (match) {
  52250. var ret = {};
  52251. match.forEach(function (m) { ret[m.slice(1)] = true; });
  52252. return ret
  52253. }
  52254. }
  52255. function makeAttrsMap (attrs) {
  52256. var map = {};
  52257. for (var i = 0, l = attrs.length; i < l; i++) {
  52258. if (
  52259. map[attrs[i].name] && !isIE && !isEdge
  52260. ) {
  52261. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  52262. }
  52263. map[attrs[i].name] = attrs[i].value;
  52264. }
  52265. return map
  52266. }
  52267. // for script (e.g. type="x/template") or style, do not decode content
  52268. function isTextTag (el) {
  52269. return el.tag === 'script' || el.tag === 'style'
  52270. }
  52271. function isForbiddenTag (el) {
  52272. return (
  52273. el.tag === 'style' ||
  52274. (el.tag === 'script' && (
  52275. !el.attrsMap.type ||
  52276. el.attrsMap.type === 'text/javascript'
  52277. ))
  52278. )
  52279. }
  52280. var ieNSBug = /^xmlns:NS\d+/;
  52281. var ieNSPrefix = /^NS\d+:/;
  52282. /* istanbul ignore next */
  52283. function guardIESVGBug (attrs) {
  52284. var res = [];
  52285. for (var i = 0; i < attrs.length; i++) {
  52286. var attr = attrs[i];
  52287. if (!ieNSBug.test(attr.name)) {
  52288. attr.name = attr.name.replace(ieNSPrefix, '');
  52289. res.push(attr);
  52290. }
  52291. }
  52292. return res
  52293. }
  52294. function checkForAliasModel (el, value) {
  52295. var _el = el;
  52296. while (_el) {
  52297. if (_el.for && _el.alias === value) {
  52298. warn$2(
  52299. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  52300. "You are binding v-model directly to a v-for iteration alias. " +
  52301. "This will not be able to modify the v-for source array because " +
  52302. "writing to the alias is like modifying a function local variable. " +
  52303. "Consider using an array of objects and use v-model on an object property instead.",
  52304. el.rawAttrsMap['v-model']
  52305. );
  52306. }
  52307. _el = _el.parent;
  52308. }
  52309. }
  52310. /* */
  52311. function preTransformNode (el, options) {
  52312. if (el.tag === 'input') {
  52313. var map = el.attrsMap;
  52314. if (!map['v-model']) {
  52315. return
  52316. }
  52317. var typeBinding;
  52318. if (map[':type'] || map['v-bind:type']) {
  52319. typeBinding = getBindingAttr(el, 'type');
  52320. }
  52321. if (!map.type && !typeBinding && map['v-bind']) {
  52322. typeBinding = "(" + (map['v-bind']) + ").type";
  52323. }
  52324. if (typeBinding) {
  52325. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  52326. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  52327. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  52328. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  52329. // 1. checkbox
  52330. var branch0 = cloneASTElement(el);
  52331. // process for on the main node
  52332. processFor(branch0);
  52333. addRawAttr(branch0, 'type', 'checkbox');
  52334. processElement(branch0, options);
  52335. branch0.processed = true; // prevent it from double-processed
  52336. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  52337. addIfCondition(branch0, {
  52338. exp: branch0.if,
  52339. block: branch0
  52340. });
  52341. // 2. add radio else-if condition
  52342. var branch1 = cloneASTElement(el);
  52343. getAndRemoveAttr(branch1, 'v-for', true);
  52344. addRawAttr(branch1, 'type', 'radio');
  52345. processElement(branch1, options);
  52346. addIfCondition(branch0, {
  52347. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  52348. block: branch1
  52349. });
  52350. // 3. other
  52351. var branch2 = cloneASTElement(el);
  52352. getAndRemoveAttr(branch2, 'v-for', true);
  52353. addRawAttr(branch2, ':type', typeBinding);
  52354. processElement(branch2, options);
  52355. addIfCondition(branch0, {
  52356. exp: ifCondition,
  52357. block: branch2
  52358. });
  52359. if (hasElse) {
  52360. branch0.else = true;
  52361. } else if (elseIfCondition) {
  52362. branch0.elseif = elseIfCondition;
  52363. }
  52364. return branch0
  52365. }
  52366. }
  52367. }
  52368. function cloneASTElement (el) {
  52369. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  52370. }
  52371. var model$1 = {
  52372. preTransformNode: preTransformNode
  52373. };
  52374. var modules$1 = [
  52375. klass$1,
  52376. style$1,
  52377. model$1
  52378. ];
  52379. /* */
  52380. function text (el, dir) {
  52381. if (dir.value) {
  52382. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  52383. }
  52384. }
  52385. /* */
  52386. function html (el, dir) {
  52387. if (dir.value) {
  52388. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  52389. }
  52390. }
  52391. var directives$1 = {
  52392. model: model,
  52393. text: text,
  52394. html: html
  52395. };
  52396. /* */
  52397. var baseOptions = {
  52398. expectHTML: true,
  52399. modules: modules$1,
  52400. directives: directives$1,
  52401. isPreTag: isPreTag,
  52402. isUnaryTag: isUnaryTag,
  52403. mustUseProp: mustUseProp,
  52404. canBeLeftOpenTag: canBeLeftOpenTag,
  52405. isReservedTag: isReservedTag,
  52406. getTagNamespace: getTagNamespace,
  52407. staticKeys: genStaticKeys(modules$1)
  52408. };
  52409. /* */
  52410. var isStaticKey;
  52411. var isPlatformReservedTag;
  52412. var genStaticKeysCached = cached(genStaticKeys$1);
  52413. /**
  52414. * Goal of the optimizer: walk the generated template AST tree
  52415. * and detect sub-trees that are purely static, i.e. parts of
  52416. * the DOM that never needs to change.
  52417. *
  52418. * Once we detect these sub-trees, we can:
  52419. *
  52420. * 1. Hoist them into constants, so that we no longer need to
  52421. * create fresh nodes for them on each re-render;
  52422. * 2. Completely skip them in the patching process.
  52423. */
  52424. function optimize (root, options) {
  52425. if (!root) { return }
  52426. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  52427. isPlatformReservedTag = options.isReservedTag || no;
  52428. // first pass: mark all non-static nodes.
  52429. markStatic$1(root);
  52430. // second pass: mark static roots.
  52431. markStaticRoots(root, false);
  52432. }
  52433. function genStaticKeys$1 (keys) {
  52434. return makeMap(
  52435. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  52436. (keys ? ',' + keys : '')
  52437. )
  52438. }
  52439. function markStatic$1 (node) {
  52440. node.static = isStatic(node);
  52441. if (node.type === 1) {
  52442. // do not make component slot content static. this avoids
  52443. // 1. components not able to mutate slot nodes
  52444. // 2. static slot content fails for hot-reloading
  52445. if (
  52446. !isPlatformReservedTag(node.tag) &&
  52447. node.tag !== 'slot' &&
  52448. node.attrsMap['inline-template'] == null
  52449. ) {
  52450. return
  52451. }
  52452. for (var i = 0, l = node.children.length; i < l; i++) {
  52453. var child = node.children[i];
  52454. markStatic$1(child);
  52455. if (!child.static) {
  52456. node.static = false;
  52457. }
  52458. }
  52459. if (node.ifConditions) {
  52460. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  52461. var block = node.ifConditions[i$1].block;
  52462. markStatic$1(block);
  52463. if (!block.static) {
  52464. node.static = false;
  52465. }
  52466. }
  52467. }
  52468. }
  52469. }
  52470. function markStaticRoots (node, isInFor) {
  52471. if (node.type === 1) {
  52472. if (node.static || node.once) {
  52473. node.staticInFor = isInFor;
  52474. }
  52475. // For a node to qualify as a static root, it should have children that
  52476. // are not just static text. Otherwise the cost of hoisting out will
  52477. // outweigh the benefits and it's better off to just always render it fresh.
  52478. if (node.static && node.children.length && !(
  52479. node.children.length === 1 &&
  52480. node.children[0].type === 3
  52481. )) {
  52482. node.staticRoot = true;
  52483. return
  52484. } else {
  52485. node.staticRoot = false;
  52486. }
  52487. if (node.children) {
  52488. for (var i = 0, l = node.children.length; i < l; i++) {
  52489. markStaticRoots(node.children[i], isInFor || !!node.for);
  52490. }
  52491. }
  52492. if (node.ifConditions) {
  52493. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  52494. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  52495. }
  52496. }
  52497. }
  52498. }
  52499. function isStatic (node) {
  52500. if (node.type === 2) { // expression
  52501. return false
  52502. }
  52503. if (node.type === 3) { // text
  52504. return true
  52505. }
  52506. return !!(node.pre || (
  52507. !node.hasBindings && // no dynamic bindings
  52508. !node.if && !node.for && // not v-if or v-for or v-else
  52509. !isBuiltInTag(node.tag) && // not a built-in
  52510. isPlatformReservedTag(node.tag) && // not a component
  52511. !isDirectChildOfTemplateFor(node) &&
  52512. Object.keys(node).every(isStaticKey)
  52513. ))
  52514. }
  52515. function isDirectChildOfTemplateFor (node) {
  52516. while (node.parent) {
  52517. node = node.parent;
  52518. if (node.tag !== 'template') {
  52519. return false
  52520. }
  52521. if (node.for) {
  52522. return true
  52523. }
  52524. }
  52525. return false
  52526. }
  52527. /* */
  52528. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  52529. var fnInvokeRE = /\([^)]*?\);*$/;
  52530. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  52531. // KeyboardEvent.keyCode aliases
  52532. var keyCodes = {
  52533. esc: 27,
  52534. tab: 9,
  52535. enter: 13,
  52536. space: 32,
  52537. up: 38,
  52538. left: 37,
  52539. right: 39,
  52540. down: 40,
  52541. 'delete': [8, 46]
  52542. };
  52543. // KeyboardEvent.key aliases
  52544. var keyNames = {
  52545. // #7880: IE11 and Edge use `Esc` for Escape key name.
  52546. esc: ['Esc', 'Escape'],
  52547. tab: 'Tab',
  52548. enter: 'Enter',
  52549. // #9112: IE11 uses `Spacebar` for Space key name.
  52550. space: [' ', 'Spacebar'],
  52551. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  52552. up: ['Up', 'ArrowUp'],
  52553. left: ['Left', 'ArrowLeft'],
  52554. right: ['Right', 'ArrowRight'],
  52555. down: ['Down', 'ArrowDown'],
  52556. // #9112: IE11 uses `Del` for Delete key name.
  52557. 'delete': ['Backspace', 'Delete', 'Del']
  52558. };
  52559. // #4868: modifiers that prevent the execution of the listener
  52560. // need to explicitly return null so that we can determine whether to remove
  52561. // the listener for .once
  52562. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  52563. var modifierCode = {
  52564. stop: '$event.stopPropagation();',
  52565. prevent: '$event.preventDefault();',
  52566. self: genGuard("$event.target !== $event.currentTarget"),
  52567. ctrl: genGuard("!$event.ctrlKey"),
  52568. shift: genGuard("!$event.shiftKey"),
  52569. alt: genGuard("!$event.altKey"),
  52570. meta: genGuard("!$event.metaKey"),
  52571. left: genGuard("'button' in $event && $event.button !== 0"),
  52572. middle: genGuard("'button' in $event && $event.button !== 1"),
  52573. right: genGuard("'button' in $event && $event.button !== 2")
  52574. };
  52575. function genHandlers (
  52576. events,
  52577. isNative
  52578. ) {
  52579. var prefix = isNative ? 'nativeOn:' : 'on:';
  52580. var staticHandlers = "";
  52581. var dynamicHandlers = "";
  52582. for (var name in events) {
  52583. var handlerCode = genHandler(events[name]);
  52584. if (events[name] && events[name].dynamic) {
  52585. dynamicHandlers += name + "," + handlerCode + ",";
  52586. } else {
  52587. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  52588. }
  52589. }
  52590. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  52591. if (dynamicHandlers) {
  52592. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  52593. } else {
  52594. return prefix + staticHandlers
  52595. }
  52596. }
  52597. function genHandler (handler) {
  52598. if (!handler) {
  52599. return 'function(){}'
  52600. }
  52601. if (Array.isArray(handler)) {
  52602. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  52603. }
  52604. var isMethodPath = simplePathRE.test(handler.value);
  52605. var isFunctionExpression = fnExpRE.test(handler.value);
  52606. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  52607. if (!handler.modifiers) {
  52608. if (isMethodPath || isFunctionExpression) {
  52609. return handler.value
  52610. }
  52611. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  52612. } else {
  52613. var code = '';
  52614. var genModifierCode = '';
  52615. var keys = [];
  52616. for (var key in handler.modifiers) {
  52617. if (modifierCode[key]) {
  52618. genModifierCode += modifierCode[key];
  52619. // left/right
  52620. if (keyCodes[key]) {
  52621. keys.push(key);
  52622. }
  52623. } else if (key === 'exact') {
  52624. var modifiers = (handler.modifiers);
  52625. genModifierCode += genGuard(
  52626. ['ctrl', 'shift', 'alt', 'meta']
  52627. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  52628. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  52629. .join('||')
  52630. );
  52631. } else {
  52632. keys.push(key);
  52633. }
  52634. }
  52635. if (keys.length) {
  52636. code += genKeyFilter(keys);
  52637. }
  52638. // Make sure modifiers like prevent and stop get executed after key filtering
  52639. if (genModifierCode) {
  52640. code += genModifierCode;
  52641. }
  52642. var handlerCode = isMethodPath
  52643. ? ("return " + (handler.value) + "($event)")
  52644. : isFunctionExpression
  52645. ? ("return (" + (handler.value) + ")($event)")
  52646. : isFunctionInvocation
  52647. ? ("return " + (handler.value))
  52648. : handler.value;
  52649. return ("function($event){" + code + handlerCode + "}")
  52650. }
  52651. }
  52652. function genKeyFilter (keys) {
  52653. return (
  52654. // make sure the key filters only apply to KeyboardEvents
  52655. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  52656. // key events that do not have keyCode property...
  52657. "if(!$event.type.indexOf('key')&&" +
  52658. (keys.map(genFilterCode).join('&&')) + ")return null;"
  52659. )
  52660. }
  52661. function genFilterCode (key) {
  52662. var keyVal = parseInt(key, 10);
  52663. if (keyVal) {
  52664. return ("$event.keyCode!==" + keyVal)
  52665. }
  52666. var keyCode = keyCodes[key];
  52667. var keyName = keyNames[key];
  52668. return (
  52669. "_k($event.keyCode," +
  52670. (JSON.stringify(key)) + "," +
  52671. (JSON.stringify(keyCode)) + "," +
  52672. "$event.key," +
  52673. "" + (JSON.stringify(keyName)) +
  52674. ")"
  52675. )
  52676. }
  52677. /* */
  52678. function on (el, dir) {
  52679. if (dir.modifiers) {
  52680. warn("v-on without argument does not support modifiers.");
  52681. }
  52682. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  52683. }
  52684. /* */
  52685. function bind$1 (el, dir) {
  52686. el.wrapData = function (code) {
  52687. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  52688. };
  52689. }
  52690. /* */
  52691. var baseDirectives = {
  52692. on: on,
  52693. bind: bind$1,
  52694. cloak: noop
  52695. };
  52696. /* */
  52697. var CodegenState = function CodegenState (options) {
  52698. this.options = options;
  52699. this.warn = options.warn || baseWarn;
  52700. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  52701. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  52702. this.directives = extend(extend({}, baseDirectives), options.directives);
  52703. var isReservedTag = options.isReservedTag || no;
  52704. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  52705. this.onceId = 0;
  52706. this.staticRenderFns = [];
  52707. this.pre = false;
  52708. };
  52709. function generate (
  52710. ast,
  52711. options
  52712. ) {
  52713. var state = new CodegenState(options);
  52714. var code = ast ? genElement(ast, state) : '_c("div")';
  52715. return {
  52716. render: ("with(this){return " + code + "}"),
  52717. staticRenderFns: state.staticRenderFns
  52718. }
  52719. }
  52720. function genElement (el, state) {
  52721. if (el.parent) {
  52722. el.pre = el.pre || el.parent.pre;
  52723. }
  52724. if (el.staticRoot && !el.staticProcessed) {
  52725. return genStatic(el, state)
  52726. } else if (el.once && !el.onceProcessed) {
  52727. return genOnce(el, state)
  52728. } else if (el.for && !el.forProcessed) {
  52729. return genFor(el, state)
  52730. } else if (el.if && !el.ifProcessed) {
  52731. return genIf(el, state)
  52732. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  52733. return genChildren(el, state) || 'void 0'
  52734. } else if (el.tag === 'slot') {
  52735. return genSlot(el, state)
  52736. } else {
  52737. // component or element
  52738. var code;
  52739. if (el.component) {
  52740. code = genComponent(el.component, el, state);
  52741. } else {
  52742. var data;
  52743. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  52744. data = genData$2(el, state);
  52745. }
  52746. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  52747. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  52748. }
  52749. // module transforms
  52750. for (var i = 0; i < state.transforms.length; i++) {
  52751. code = state.transforms[i](el, code);
  52752. }
  52753. return code
  52754. }
  52755. }
  52756. // hoist static sub-trees out
  52757. function genStatic (el, state) {
  52758. el.staticProcessed = true;
  52759. // Some elements (templates) need to behave differently inside of a v-pre
  52760. // node. All pre nodes are static roots, so we can use this as a location to
  52761. // wrap a state change and reset it upon exiting the pre node.
  52762. var originalPreState = state.pre;
  52763. if (el.pre) {
  52764. state.pre = el.pre;
  52765. }
  52766. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  52767. state.pre = originalPreState;
  52768. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  52769. }
  52770. // v-once
  52771. function genOnce (el, state) {
  52772. el.onceProcessed = true;
  52773. if (el.if && !el.ifProcessed) {
  52774. return genIf(el, state)
  52775. } else if (el.staticInFor) {
  52776. var key = '';
  52777. var parent = el.parent;
  52778. while (parent) {
  52779. if (parent.for) {
  52780. key = parent.key;
  52781. break
  52782. }
  52783. parent = parent.parent;
  52784. }
  52785. if (!key) {
  52786. state.warn(
  52787. "v-once can only be used inside v-for that is keyed. ",
  52788. el.rawAttrsMap['v-once']
  52789. );
  52790. return genElement(el, state)
  52791. }
  52792. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  52793. } else {
  52794. return genStatic(el, state)
  52795. }
  52796. }
  52797. function genIf (
  52798. el,
  52799. state,
  52800. altGen,
  52801. altEmpty
  52802. ) {
  52803. el.ifProcessed = true; // avoid recursion
  52804. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  52805. }
  52806. function genIfConditions (
  52807. conditions,
  52808. state,
  52809. altGen,
  52810. altEmpty
  52811. ) {
  52812. if (!conditions.length) {
  52813. return altEmpty || '_e()'
  52814. }
  52815. var condition = conditions.shift();
  52816. if (condition.exp) {
  52817. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  52818. } else {
  52819. return ("" + (genTernaryExp(condition.block)))
  52820. }
  52821. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  52822. function genTernaryExp (el) {
  52823. return altGen
  52824. ? altGen(el, state)
  52825. : el.once
  52826. ? genOnce(el, state)
  52827. : genElement(el, state)
  52828. }
  52829. }
  52830. function genFor (
  52831. el,
  52832. state,
  52833. altGen,
  52834. altHelper
  52835. ) {
  52836. var exp = el.for;
  52837. var alias = el.alias;
  52838. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  52839. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  52840. if (state.maybeComponent(el) &&
  52841. el.tag !== 'slot' &&
  52842. el.tag !== 'template' &&
  52843. !el.key
  52844. ) {
  52845. state.warn(
  52846. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  52847. "v-for should have explicit keys. " +
  52848. "See https://vuejs.org/guide/list.html#key for more info.",
  52849. el.rawAttrsMap['v-for'],
  52850. true /* tip */
  52851. );
  52852. }
  52853. el.forProcessed = true; // avoid recursion
  52854. return (altHelper || '_l') + "((" + exp + ")," +
  52855. "function(" + alias + iterator1 + iterator2 + "){" +
  52856. "return " + ((altGen || genElement)(el, state)) +
  52857. '})'
  52858. }
  52859. function genData$2 (el, state) {
  52860. var data = '{';
  52861. // directives first.
  52862. // directives may mutate the el's other properties before they are generated.
  52863. var dirs = genDirectives(el, state);
  52864. if (dirs) { data += dirs + ','; }
  52865. // key
  52866. if (el.key) {
  52867. data += "key:" + (el.key) + ",";
  52868. }
  52869. // ref
  52870. if (el.ref) {
  52871. data += "ref:" + (el.ref) + ",";
  52872. }
  52873. if (el.refInFor) {
  52874. data += "refInFor:true,";
  52875. }
  52876. // pre
  52877. if (el.pre) {
  52878. data += "pre:true,";
  52879. }
  52880. // record original tag name for components using "is" attribute
  52881. if (el.component) {
  52882. data += "tag:\"" + (el.tag) + "\",";
  52883. }
  52884. // module data generation functions
  52885. for (var i = 0; i < state.dataGenFns.length; i++) {
  52886. data += state.dataGenFns[i](el);
  52887. }
  52888. // attributes
  52889. if (el.attrs) {
  52890. data += "attrs:" + (genProps(el.attrs)) + ",";
  52891. }
  52892. // DOM props
  52893. if (el.props) {
  52894. data += "domProps:" + (genProps(el.props)) + ",";
  52895. }
  52896. // event handlers
  52897. if (el.events) {
  52898. data += (genHandlers(el.events, false)) + ",";
  52899. }
  52900. if (el.nativeEvents) {
  52901. data += (genHandlers(el.nativeEvents, true)) + ",";
  52902. }
  52903. // slot target
  52904. // only for non-scoped slots
  52905. if (el.slotTarget && !el.slotScope) {
  52906. data += "slot:" + (el.slotTarget) + ",";
  52907. }
  52908. // scoped slots
  52909. if (el.scopedSlots) {
  52910. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  52911. }
  52912. // component v-model
  52913. if (el.model) {
  52914. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  52915. }
  52916. // inline-template
  52917. if (el.inlineTemplate) {
  52918. var inlineTemplate = genInlineTemplate(el, state);
  52919. if (inlineTemplate) {
  52920. data += inlineTemplate + ",";
  52921. }
  52922. }
  52923. data = data.replace(/,$/, '') + '}';
  52924. // v-bind dynamic argument wrap
  52925. // v-bind with dynamic arguments must be applied using the same v-bind object
  52926. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  52927. if (el.dynamicAttrs) {
  52928. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  52929. }
  52930. // v-bind data wrap
  52931. if (el.wrapData) {
  52932. data = el.wrapData(data);
  52933. }
  52934. // v-on data wrap
  52935. if (el.wrapListeners) {
  52936. data = el.wrapListeners(data);
  52937. }
  52938. return data
  52939. }
  52940. function genDirectives (el, state) {
  52941. var dirs = el.directives;
  52942. if (!dirs) { return }
  52943. var res = 'directives:[';
  52944. var hasRuntime = false;
  52945. var i, l, dir, needRuntime;
  52946. for (i = 0, l = dirs.length; i < l; i++) {
  52947. dir = dirs[i];
  52948. needRuntime = true;
  52949. var gen = state.directives[dir.name];
  52950. if (gen) {
  52951. // compile-time directive that manipulates AST.
  52952. // returns true if it also needs a runtime counterpart.
  52953. needRuntime = !!gen(el, dir, state.warn);
  52954. }
  52955. if (needRuntime) {
  52956. hasRuntime = true;
  52957. 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))) : '') + "},";
  52958. }
  52959. }
  52960. if (hasRuntime) {
  52961. return res.slice(0, -1) + ']'
  52962. }
  52963. }
  52964. function genInlineTemplate (el, state) {
  52965. var ast = el.children[0];
  52966. if (el.children.length !== 1 || ast.type !== 1) {
  52967. state.warn(
  52968. 'Inline-template components must have exactly one child element.',
  52969. { start: el.start }
  52970. );
  52971. }
  52972. if (ast && ast.type === 1) {
  52973. var inlineRenderFns = generate(ast, state.options);
  52974. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  52975. }
  52976. }
  52977. function genScopedSlots (
  52978. el,
  52979. slots,
  52980. state
  52981. ) {
  52982. // by default scoped slots are considered "stable", this allows child
  52983. // components with only scoped slots to skip forced updates from parent.
  52984. // but in some cases we have to bail-out of this optimization
  52985. // for example if the slot contains dynamic names, has v-if or v-for on them...
  52986. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  52987. var slot = slots[key];
  52988. return (
  52989. slot.slotTargetDynamic ||
  52990. slot.if ||
  52991. slot.for ||
  52992. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  52993. )
  52994. });
  52995. // #9534: if a component with scoped slots is inside a conditional branch,
  52996. // it's possible for the same component to be reused but with different
  52997. // compiled slot content. To avoid that, we generate a unique key based on
  52998. // the generated code of all the slot contents.
  52999. var needsKey = !!el.if;
  53000. // OR when it is inside another scoped slot or v-for (the reactivity may be
  53001. // disconnected due to the intermediate scope variable)
  53002. // #9438, #9506
  53003. // TODO: this can be further optimized by properly analyzing in-scope bindings
  53004. // and skip force updating ones that do not actually use scope variables.
  53005. if (!needsForceUpdate) {
  53006. var parent = el.parent;
  53007. while (parent) {
  53008. if (
  53009. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  53010. parent.for
  53011. ) {
  53012. needsForceUpdate = true;
  53013. break
  53014. }
  53015. if (parent.if) {
  53016. needsKey = true;
  53017. }
  53018. parent = parent.parent;
  53019. }
  53020. }
  53021. var generatedSlots = Object.keys(slots)
  53022. .map(function (key) { return genScopedSlot(slots[key], state); })
  53023. .join(',');
  53024. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  53025. }
  53026. function hash(str) {
  53027. var hash = 5381;
  53028. var i = str.length;
  53029. while(i) {
  53030. hash = (hash * 33) ^ str.charCodeAt(--i);
  53031. }
  53032. return hash >>> 0
  53033. }
  53034. function containsSlotChild (el) {
  53035. if (el.type === 1) {
  53036. if (el.tag === 'slot') {
  53037. return true
  53038. }
  53039. return el.children.some(containsSlotChild)
  53040. }
  53041. return false
  53042. }
  53043. function genScopedSlot (
  53044. el,
  53045. state
  53046. ) {
  53047. var isLegacySyntax = el.attrsMap['slot-scope'];
  53048. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  53049. return genIf(el, state, genScopedSlot, "null")
  53050. }
  53051. if (el.for && !el.forProcessed) {
  53052. return genFor(el, state, genScopedSlot)
  53053. }
  53054. var slotScope = el.slotScope === emptySlotScopeToken
  53055. ? ""
  53056. : String(el.slotScope);
  53057. var fn = "function(" + slotScope + "){" +
  53058. "return " + (el.tag === 'template'
  53059. ? el.if && isLegacySyntax
  53060. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  53061. : genChildren(el, state) || 'undefined'
  53062. : genElement(el, state)) + "}";
  53063. // reverse proxy v-slot without scope on this.$slots
  53064. var reverseProxy = slotScope ? "" : ",proxy:true";
  53065. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  53066. }
  53067. function genChildren (
  53068. el,
  53069. state,
  53070. checkSkip,
  53071. altGenElement,
  53072. altGenNode
  53073. ) {
  53074. var children = el.children;
  53075. if (children.length) {
  53076. var el$1 = children[0];
  53077. // optimize single v-for
  53078. if (children.length === 1 &&
  53079. el$1.for &&
  53080. el$1.tag !== 'template' &&
  53081. el$1.tag !== 'slot'
  53082. ) {
  53083. var normalizationType = checkSkip
  53084. ? state.maybeComponent(el$1) ? ",1" : ",0"
  53085. : "";
  53086. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  53087. }
  53088. var normalizationType$1 = checkSkip
  53089. ? getNormalizationType(children, state.maybeComponent)
  53090. : 0;
  53091. var gen = altGenNode || genNode;
  53092. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  53093. }
  53094. }
  53095. // determine the normalization needed for the children array.
  53096. // 0: no normalization needed
  53097. // 1: simple normalization needed (possible 1-level deep nested array)
  53098. // 2: full normalization needed
  53099. function getNormalizationType (
  53100. children,
  53101. maybeComponent
  53102. ) {
  53103. var res = 0;
  53104. for (var i = 0; i < children.length; i++) {
  53105. var el = children[i];
  53106. if (el.type !== 1) {
  53107. continue
  53108. }
  53109. if (needsNormalization(el) ||
  53110. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  53111. res = 2;
  53112. break
  53113. }
  53114. if (maybeComponent(el) ||
  53115. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  53116. res = 1;
  53117. }
  53118. }
  53119. return res
  53120. }
  53121. function needsNormalization (el) {
  53122. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  53123. }
  53124. function genNode (node, state) {
  53125. if (node.type === 1) {
  53126. return genElement(node, state)
  53127. } else if (node.type === 3 && node.isComment) {
  53128. return genComment(node)
  53129. } else {
  53130. return genText(node)
  53131. }
  53132. }
  53133. function genText (text) {
  53134. return ("_v(" + (text.type === 2
  53135. ? text.expression // no need for () because already wrapped in _s()
  53136. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  53137. }
  53138. function genComment (comment) {
  53139. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  53140. }
  53141. function genSlot (el, state) {
  53142. var slotName = el.slotName || '"default"';
  53143. var children = genChildren(el, state);
  53144. var res = "_t(" + slotName + (children ? ("," + children) : '');
  53145. var attrs = el.attrs || el.dynamicAttrs
  53146. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  53147. // slot props are camelized
  53148. name: camelize(attr.name),
  53149. value: attr.value,
  53150. dynamic: attr.dynamic
  53151. }); }))
  53152. : null;
  53153. var bind$$1 = el.attrsMap['v-bind'];
  53154. if ((attrs || bind$$1) && !children) {
  53155. res += ",null";
  53156. }
  53157. if (attrs) {
  53158. res += "," + attrs;
  53159. }
  53160. if (bind$$1) {
  53161. res += (attrs ? '' : ',null') + "," + bind$$1;
  53162. }
  53163. return res + ')'
  53164. }
  53165. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  53166. function genComponent (
  53167. componentName,
  53168. el,
  53169. state
  53170. ) {
  53171. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53172. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  53173. }
  53174. function genProps (props) {
  53175. var staticProps = "";
  53176. var dynamicProps = "";
  53177. for (var i = 0; i < props.length; i++) {
  53178. var prop = props[i];
  53179. var value = transformSpecialNewlines(prop.value);
  53180. if (prop.dynamic) {
  53181. dynamicProps += (prop.name) + "," + value + ",";
  53182. } else {
  53183. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  53184. }
  53185. }
  53186. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  53187. if (dynamicProps) {
  53188. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  53189. } else {
  53190. return staticProps
  53191. }
  53192. }
  53193. // #3895, #4268
  53194. function transformSpecialNewlines (text) {
  53195. return text
  53196. .replace(/\u2028/g, '\\u2028')
  53197. .replace(/\u2029/g, '\\u2029')
  53198. }
  53199. /* */
  53200. // these keywords should not appear inside expressions, but operators like
  53201. // typeof, instanceof and in are allowed
  53202. var prohibitedKeywordRE = new RegExp('\\b' + (
  53203. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  53204. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  53205. 'extends,finally,continue,debugger,function,arguments'
  53206. ).split(',').join('\\b|\\b') + '\\b');
  53207. // these unary operators should not be used as property/method names
  53208. var unaryOperatorsRE = new RegExp('\\b' + (
  53209. 'delete,typeof,void'
  53210. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  53211. // strip strings in expressions
  53212. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  53213. // detect problematic expressions in a template
  53214. function detectErrors (ast, warn) {
  53215. if (ast) {
  53216. checkNode(ast, warn);
  53217. }
  53218. }
  53219. function checkNode (node, warn) {
  53220. if (node.type === 1) {
  53221. for (var name in node.attrsMap) {
  53222. if (dirRE.test(name)) {
  53223. var value = node.attrsMap[name];
  53224. if (value) {
  53225. var range = node.rawAttrsMap[name];
  53226. if (name === 'v-for') {
  53227. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  53228. } else if (name === 'v-slot' || name[0] === '#') {
  53229. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  53230. } else if (onRE.test(name)) {
  53231. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  53232. } else {
  53233. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  53234. }
  53235. }
  53236. }
  53237. }
  53238. if (node.children) {
  53239. for (var i = 0; i < node.children.length; i++) {
  53240. checkNode(node.children[i], warn);
  53241. }
  53242. }
  53243. } else if (node.type === 2) {
  53244. checkExpression(node.expression, node.text, warn, node);
  53245. }
  53246. }
  53247. function checkEvent (exp, text, warn, range) {
  53248. var stripped = exp.replace(stripStringRE, '');
  53249. var keywordMatch = stripped.match(unaryOperatorsRE);
  53250. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  53251. warn(
  53252. "avoid using JavaScript unary operator as property name: " +
  53253. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  53254. range
  53255. );
  53256. }
  53257. checkExpression(exp, text, warn, range);
  53258. }
  53259. function checkFor (node, text, warn, range) {
  53260. checkExpression(node.for || '', text, warn, range);
  53261. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  53262. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  53263. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  53264. }
  53265. function checkIdentifier (
  53266. ident,
  53267. type,
  53268. text,
  53269. warn,
  53270. range
  53271. ) {
  53272. if (typeof ident === 'string') {
  53273. try {
  53274. new Function(("var " + ident + "=_"));
  53275. } catch (e) {
  53276. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  53277. }
  53278. }
  53279. }
  53280. function checkExpression (exp, text, warn, range) {
  53281. try {
  53282. new Function(("return " + exp));
  53283. } catch (e) {
  53284. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  53285. if (keywordMatch) {
  53286. warn(
  53287. "avoid using JavaScript keyword as property name: " +
  53288. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  53289. range
  53290. );
  53291. } else {
  53292. warn(
  53293. "invalid expression: " + (e.message) + " in\n\n" +
  53294. " " + exp + "\n\n" +
  53295. " Raw expression: " + (text.trim()) + "\n",
  53296. range
  53297. );
  53298. }
  53299. }
  53300. }
  53301. function checkFunctionParameterExpression (exp, text, warn, range) {
  53302. try {
  53303. new Function(exp, '');
  53304. } catch (e) {
  53305. warn(
  53306. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  53307. " " + exp + "\n\n" +
  53308. " Raw expression: " + (text.trim()) + "\n",
  53309. range
  53310. );
  53311. }
  53312. }
  53313. /* */
  53314. var range = 2;
  53315. function generateCodeFrame (
  53316. source,
  53317. start,
  53318. end
  53319. ) {
  53320. if ( start === void 0 ) start = 0;
  53321. if ( end === void 0 ) end = source.length;
  53322. var lines = source.split(/\r?\n/);
  53323. var count = 0;
  53324. var res = [];
  53325. for (var i = 0; i < lines.length; i++) {
  53326. count += lines[i].length + 1;
  53327. if (count >= start) {
  53328. for (var j = i - range; j <= i + range || end > count; j++) {
  53329. if (j < 0 || j >= lines.length) { continue }
  53330. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  53331. var lineLength = lines[j].length;
  53332. if (j === i) {
  53333. // push underline
  53334. var pad = start - (count - lineLength) + 1;
  53335. var length = end > count ? lineLength - pad : end - start;
  53336. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  53337. } else if (j > i) {
  53338. if (end > count) {
  53339. var length$1 = Math.min(end - count, lineLength);
  53340. res.push(" | " + repeat$1("^", length$1));
  53341. }
  53342. count += lineLength + 1;
  53343. }
  53344. }
  53345. break
  53346. }
  53347. }
  53348. return res.join('\n')
  53349. }
  53350. function repeat$1 (str, n) {
  53351. var result = '';
  53352. if (n > 0) {
  53353. while (true) { // eslint-disable-line
  53354. if (n & 1) { result += str; }
  53355. n >>>= 1;
  53356. if (n <= 0) { break }
  53357. str += str;
  53358. }
  53359. }
  53360. return result
  53361. }
  53362. /* */
  53363. function createFunction (code, errors) {
  53364. try {
  53365. return new Function(code)
  53366. } catch (err) {
  53367. errors.push({ err: err, code: code });
  53368. return noop
  53369. }
  53370. }
  53371. function createCompileToFunctionFn (compile) {
  53372. var cache = Object.create(null);
  53373. return function compileToFunctions (
  53374. template,
  53375. options,
  53376. vm
  53377. ) {
  53378. options = extend({}, options);
  53379. var warn$$1 = options.warn || warn;
  53380. delete options.warn;
  53381. /* istanbul ignore if */
  53382. {
  53383. // detect possible CSP restriction
  53384. try {
  53385. new Function('return 1');
  53386. } catch (e) {
  53387. if (e.toString().match(/unsafe-eval|CSP/)) {
  53388. warn$$1(
  53389. 'It seems you are using the standalone build of Vue.js in an ' +
  53390. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  53391. 'The template compiler cannot work in this environment. Consider ' +
  53392. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  53393. 'templates into render functions.'
  53394. );
  53395. }
  53396. }
  53397. }
  53398. // check cache
  53399. var key = options.delimiters
  53400. ? String(options.delimiters) + template
  53401. : template;
  53402. if (cache[key]) {
  53403. return cache[key]
  53404. }
  53405. // compile
  53406. var compiled = compile(template, options);
  53407. // check compilation errors/tips
  53408. {
  53409. if (compiled.errors && compiled.errors.length) {
  53410. if (options.outputSourceRange) {
  53411. compiled.errors.forEach(function (e) {
  53412. warn$$1(
  53413. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  53414. generateCodeFrame(template, e.start, e.end),
  53415. vm
  53416. );
  53417. });
  53418. } else {
  53419. warn$$1(
  53420. "Error compiling template:\n\n" + template + "\n\n" +
  53421. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  53422. vm
  53423. );
  53424. }
  53425. }
  53426. if (compiled.tips && compiled.tips.length) {
  53427. if (options.outputSourceRange) {
  53428. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  53429. } else {
  53430. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  53431. }
  53432. }
  53433. }
  53434. // turn code into functions
  53435. var res = {};
  53436. var fnGenErrors = [];
  53437. res.render = createFunction(compiled.render, fnGenErrors);
  53438. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  53439. return createFunction(code, fnGenErrors)
  53440. });
  53441. // check function generation errors.
  53442. // this should only happen if there is a bug in the compiler itself.
  53443. // mostly for codegen development use
  53444. /* istanbul ignore if */
  53445. {
  53446. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  53447. warn$$1(
  53448. "Failed to generate render function:\n\n" +
  53449. fnGenErrors.map(function (ref) {
  53450. var err = ref.err;
  53451. var code = ref.code;
  53452. return ((err.toString()) + " in\n\n" + code + "\n");
  53453. }).join('\n'),
  53454. vm
  53455. );
  53456. }
  53457. }
  53458. return (cache[key] = res)
  53459. }
  53460. }
  53461. /* */
  53462. function createCompilerCreator (baseCompile) {
  53463. return function createCompiler (baseOptions) {
  53464. function compile (
  53465. template,
  53466. options
  53467. ) {
  53468. var finalOptions = Object.create(baseOptions);
  53469. var errors = [];
  53470. var tips = [];
  53471. var warn = function (msg, range, tip) {
  53472. (tip ? tips : errors).push(msg);
  53473. };
  53474. if (options) {
  53475. if (options.outputSourceRange) {
  53476. // $flow-disable-line
  53477. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  53478. warn = function (msg, range, tip) {
  53479. var data = { msg: msg };
  53480. if (range) {
  53481. if (range.start != null) {
  53482. data.start = range.start + leadingSpaceLength;
  53483. }
  53484. if (range.end != null) {
  53485. data.end = range.end + leadingSpaceLength;
  53486. }
  53487. }
  53488. (tip ? tips : errors).push(data);
  53489. };
  53490. }
  53491. // merge custom modules
  53492. if (options.modules) {
  53493. finalOptions.modules =
  53494. (baseOptions.modules || []).concat(options.modules);
  53495. }
  53496. // merge custom directives
  53497. if (options.directives) {
  53498. finalOptions.directives = extend(
  53499. Object.create(baseOptions.directives || null),
  53500. options.directives
  53501. );
  53502. }
  53503. // copy other options
  53504. for (var key in options) {
  53505. if (key !== 'modules' && key !== 'directives') {
  53506. finalOptions[key] = options[key];
  53507. }
  53508. }
  53509. }
  53510. finalOptions.warn = warn;
  53511. var compiled = baseCompile(template.trim(), finalOptions);
  53512. {
  53513. detectErrors(compiled.ast, warn);
  53514. }
  53515. compiled.errors = errors;
  53516. compiled.tips = tips;
  53517. return compiled
  53518. }
  53519. return {
  53520. compile: compile,
  53521. compileToFunctions: createCompileToFunctionFn(compile)
  53522. }
  53523. }
  53524. }
  53525. /* */
  53526. // `createCompilerCreator` allows creating compilers that use alternative
  53527. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  53528. // Here we just export a default compiler using the default parts.
  53529. var createCompiler = createCompilerCreator(function baseCompile (
  53530. template,
  53531. options
  53532. ) {
  53533. var ast = parse(template.trim(), options);
  53534. if (options.optimize !== false) {
  53535. optimize(ast, options);
  53536. }
  53537. var code = generate(ast, options);
  53538. return {
  53539. ast: ast,
  53540. render: code.render,
  53541. staticRenderFns: code.staticRenderFns
  53542. }
  53543. });
  53544. /* */
  53545. var ref$1 = createCompiler(baseOptions);
  53546. var compile = ref$1.compile;
  53547. var compileToFunctions = ref$1.compileToFunctions;
  53548. /* */
  53549. // check whether current browser encodes a char inside attribute values
  53550. var div;
  53551. function getShouldDecode (href) {
  53552. div = div || document.createElement('div');
  53553. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  53554. return div.innerHTML.indexOf('&#10;') > 0
  53555. }
  53556. // #3663: IE encodes newlines inside attribute values while other browsers don't
  53557. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  53558. // #6828: chrome encodes content in a[href]
  53559. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  53560. /* */
  53561. var idToTemplate = cached(function (id) {
  53562. var el = query(id);
  53563. return el && el.innerHTML
  53564. });
  53565. var mount = Vue.prototype.$mount;
  53566. Vue.prototype.$mount = function (
  53567. el,
  53568. hydrating
  53569. ) {
  53570. el = el && query(el);
  53571. /* istanbul ignore if */
  53572. if (el === document.body || el === document.documentElement) {
  53573. warn(
  53574. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  53575. );
  53576. return this
  53577. }
  53578. var options = this.$options;
  53579. // resolve template/el and convert to render function
  53580. if (!options.render) {
  53581. var template = options.template;
  53582. if (template) {
  53583. if (typeof template === 'string') {
  53584. if (template.charAt(0) === '#') {
  53585. template = idToTemplate(template);
  53586. /* istanbul ignore if */
  53587. if (!template) {
  53588. warn(
  53589. ("Template element not found or is empty: " + (options.template)),
  53590. this
  53591. );
  53592. }
  53593. }
  53594. } else if (template.nodeType) {
  53595. template = template.innerHTML;
  53596. } else {
  53597. {
  53598. warn('invalid template option:' + template, this);
  53599. }
  53600. return this
  53601. }
  53602. } else if (el) {
  53603. template = getOuterHTML(el);
  53604. }
  53605. if (template) {
  53606. /* istanbul ignore if */
  53607. if (config.performance && mark) {
  53608. mark('compile');
  53609. }
  53610. var ref = compileToFunctions(template, {
  53611. outputSourceRange: "development" !== 'production',
  53612. shouldDecodeNewlines: shouldDecodeNewlines,
  53613. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  53614. delimiters: options.delimiters,
  53615. comments: options.comments
  53616. }, this);
  53617. var render = ref.render;
  53618. var staticRenderFns = ref.staticRenderFns;
  53619. options.render = render;
  53620. options.staticRenderFns = staticRenderFns;
  53621. /* istanbul ignore if */
  53622. if (config.performance && mark) {
  53623. mark('compile end');
  53624. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  53625. }
  53626. }
  53627. }
  53628. return mount.call(this, el, hydrating)
  53629. };
  53630. /**
  53631. * Get outerHTML of elements, taking care
  53632. * of SVG elements in IE as well.
  53633. */
  53634. function getOuterHTML (el) {
  53635. if (el.outerHTML) {
  53636. return el.outerHTML
  53637. } else {
  53638. var container = document.createElement('div');
  53639. container.appendChild(el.cloneNode(true));
  53640. return container.innerHTML
  53641. }
  53642. }
  53643. Vue.compile = compileToFunctions;
  53644. module.exports = Vue;
  53645. /* 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))
  53646. /***/ }),
  53647. /***/ "./node_modules/vue/dist/vue.common.js":
  53648. /*!*********************************************!*\
  53649. !*** ./node_modules/vue/dist/vue.common.js ***!
  53650. \*********************************************/
  53651. /*! no static exports found */
  53652. /***/ (function(module, exports, __webpack_require__) {
  53653. if (false) {} else {
  53654. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  53655. }
  53656. /***/ }),
  53657. /***/ "./node_modules/webpack/buildin/global.js":
  53658. /*!***********************************!*\
  53659. !*** (webpack)/buildin/global.js ***!
  53660. \***********************************/
  53661. /*! no static exports found */
  53662. /***/ (function(module, exports) {
  53663. var g;
  53664. // This works in non-strict mode
  53665. g = (function() {
  53666. return this;
  53667. })();
  53668. try {
  53669. // This works if eval is allowed (see CSP)
  53670. g = g || new Function("return this")();
  53671. } catch (e) {
  53672. // This works if the window reference is available
  53673. if (typeof window === "object") g = window;
  53674. }
  53675. // g can still be undefined, but nothing to do about it...
  53676. // We return undefined, instead of nothing here, so it's
  53677. // easier to handle this case. if(!global) { ...}
  53678. module.exports = g;
  53679. /***/ }),
  53680. /***/ "./node_modules/webpack/buildin/module.js":
  53681. /*!***********************************!*\
  53682. !*** (webpack)/buildin/module.js ***!
  53683. \***********************************/
  53684. /*! no static exports found */
  53685. /***/ (function(module, exports) {
  53686. module.exports = function(module) {
  53687. if (!module.webpackPolyfill) {
  53688. module.deprecate = function() {};
  53689. module.paths = [];
  53690. // module.parent = undefined by default
  53691. if (!module.children) module.children = [];
  53692. Object.defineProperty(module, "loaded", {
  53693. enumerable: true,
  53694. get: function() {
  53695. return module.l;
  53696. }
  53697. });
  53698. Object.defineProperty(module, "id", {
  53699. enumerable: true,
  53700. get: function() {
  53701. return module.i;
  53702. }
  53703. });
  53704. module.webpackPolyfill = 1;
  53705. }
  53706. return module;
  53707. };
  53708. /***/ }),
  53709. /***/ "./resources/js/app.js":
  53710. /*!*****************************!*\
  53711. !*** ./resources/js/app.js ***!
  53712. \*****************************/
  53713. /*! no static exports found */
  53714. /***/ (function(module, exports, __webpack_require__) {
  53715. /**
  53716. * First we will load all of this project's JavaScript dependencies which
  53717. * includes Vue and other libraries. It is a great starting point when
  53718. * building robust, powerful web applications using Vue and Laravel.
  53719. */
  53720. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  53721. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  53722. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  53723. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  53724. /**
  53725. * The following block of code may be used to automatically register your
  53726. * Vue components. It will recursively scan this directory for the Vue
  53727. * components and automatically register them with their "basename".
  53728. *
  53729. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  53730. */
  53731. // const files = require.context('./', true, /\.vue$/i)
  53732. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  53733. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  53734. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  53735. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  53736. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  53737. /**
  53738. * Next, we will create a fresh Vue application instance and attach it to
  53739. * the page. Then, you may begin adding components to this application
  53740. * or customize the JavaScript scaffolding to fit your unique needs.
  53741. */
  53742. var app = new Vue({
  53743. el: '#app'
  53744. });
  53745. $(function () {
  53746. $('[data-toggle="tooltip"]').tooltip();
  53747. });
  53748. var clipboard = new Clipboard('.btn-clip');
  53749. clipboard.on('success', function (e) {
  53750. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  53751. position: "right",
  53752. className: 'success'
  53753. });
  53754. e.clearSelection();
  53755. });
  53756. /***/ }),
  53757. /***/ "./resources/js/bootstrap.js":
  53758. /*!***********************************!*\
  53759. !*** ./resources/js/bootstrap.js ***!
  53760. \***********************************/
  53761. /*! no exports provided */
  53762. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53763. "use strict";
  53764. __webpack_require__.r(__webpack_exports__);
  53765. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  53766. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  53767. /**
  53768. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  53769. * for JavaScript based Bootstrap features such as modals and tabs. This
  53770. * code may be modified to fit the specific needs of your application.
  53771. */
  53772. try {
  53773. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  53774. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  53775. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  53776. } catch (e) {}
  53777. /**
  53778. * We'll load the axios HTTP library which allows us to easily issue requests
  53779. * to our Laravel back-end. This library automatically handles sending the
  53780. * CSRF token as a header based on the value of the "XSRF" token cookie.
  53781. */
  53782. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  53783. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  53784. /**
  53785. * Echo exposes an expressive API for subscribing to channels and listening
  53786. * for events that are broadcast by Laravel. Echo and event broadcasting
  53787. * allows your team to easily build robust real-time web applications.
  53788. */
  53789. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  53790. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  53791. broadcaster: 'pusher',
  53792. key: "upccrt",
  53793. wsHost: window.location.hostname,
  53794. wsPort: 6001,
  53795. disableStats: true
  53796. });
  53797. /***/ }),
  53798. /***/ "./resources/js/components/ExampleComponent.vue":
  53799. /*!******************************************************!*\
  53800. !*** ./resources/js/components/ExampleComponent.vue ***!
  53801. \******************************************************/
  53802. /*! exports provided: default */
  53803. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53804. "use strict";
  53805. __webpack_require__.r(__webpack_exports__);
  53806. /* harmony import */ var _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  53807. /* harmony import */ var _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=script&lang=js& */ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  53808. /* 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");
  53809. /* normalize component */
  53810. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  53811. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  53812. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  53813. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  53814. false,
  53815. null,
  53816. null,
  53817. null
  53818. )
  53819. /* hot reload */
  53820. if (false) { var api; }
  53821. component.options.__file = "resources/js/components/ExampleComponent.vue"
  53822. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  53823. /***/ }),
  53824. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  53825. /*!*******************************************************************************!*\
  53826. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  53827. \*******************************************************************************/
  53828. /*! exports provided: default */
  53829. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53830. "use strict";
  53831. __webpack_require__.r(__webpack_exports__);
  53832. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  53833. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  53834. /***/ }),
  53835. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  53836. /*!*************************************************************************************!*\
  53837. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  53838. \*************************************************************************************/
  53839. /*! exports provided: render, staticRenderFns */
  53840. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53841. "use strict";
  53842. __webpack_require__.r(__webpack_exports__);
  53843. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  53844. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  53845. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  53846. /***/ }),
  53847. /***/ "./resources/js/components/assetinfo.vue":
  53848. /*!***********************************************!*\
  53849. !*** ./resources/js/components/assetinfo.vue ***!
  53850. \***********************************************/
  53851. /*! exports provided: default */
  53852. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53853. "use strict";
  53854. __webpack_require__.r(__webpack_exports__);
  53855. /* harmony import */ var _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assetinfo.vue?vue&type=template&id=4fe1d2e3& */ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  53856. /* harmony import */ var _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assetinfo.vue?vue&type=script&lang=js& */ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&");
  53857. /* 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");
  53858. /* normalize component */
  53859. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  53860. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  53861. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  53862. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  53863. false,
  53864. null,
  53865. null,
  53866. null
  53867. )
  53868. /* hot reload */
  53869. if (false) { var api; }
  53870. component.options.__file = "resources/js/components/assetinfo.vue"
  53871. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  53872. /***/ }),
  53873. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  53874. /*!************************************************************************!*\
  53875. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  53876. \************************************************************************/
  53877. /*! exports provided: default */
  53878. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53879. "use strict";
  53880. __webpack_require__.r(__webpack_exports__);
  53881. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_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!./assetinfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&");
  53882. /* 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_assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  53883. /***/ }),
  53884. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  53885. /*!******************************************************************************!*\
  53886. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  53887. \******************************************************************************/
  53888. /*! exports provided: render, staticRenderFns */
  53889. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53890. "use strict";
  53891. __webpack_require__.r(__webpack_exports__);
  53892. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_assetinfo_vue_vue_type_template_id_4fe1d2e3___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!./assetinfo.vue?vue&type=template&id=4fe1d2e3& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  53893. /* 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_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  53894. /* 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_assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  53895. /***/ }),
  53896. /***/ "./resources/js/components/credential.vue":
  53897. /*!************************************************!*\
  53898. !*** ./resources/js/components/credential.vue ***!
  53899. \************************************************/
  53900. /*! exports provided: default */
  53901. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53902. "use strict";
  53903. __webpack_require__.r(__webpack_exports__);
  53904. /* harmony import */ var _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential.vue?vue&type=template&id=0f5cc562& */ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  53905. /* harmony import */ var _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential.vue?vue&type=script&lang=js& */ "./resources/js/components/credential.vue?vue&type=script&lang=js&");
  53906. /* 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");
  53907. /* normalize component */
  53908. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  53909. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  53910. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  53911. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  53912. false,
  53913. null,
  53914. null,
  53915. null
  53916. )
  53917. /* hot reload */
  53918. if (false) { var api; }
  53919. component.options.__file = "resources/js/components/credential.vue"
  53920. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  53921. /***/ }),
  53922. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  53923. /*!*************************************************************************!*\
  53924. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  53925. \*************************************************************************/
  53926. /*! exports provided: default */
  53927. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53928. "use strict";
  53929. __webpack_require__.r(__webpack_exports__);
  53930. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_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!./credential.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&");
  53931. /* 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_credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  53932. /***/ }),
  53933. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  53934. /*!*******************************************************************************!*\
  53935. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  53936. \*******************************************************************************/
  53937. /*! exports provided: render, staticRenderFns */
  53938. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53939. "use strict";
  53940. __webpack_require__.r(__webpack_exports__);
  53941. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_vue_vue_type_template_id_0f5cc562___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!./credential.vue?vue&type=template&id=0f5cc562& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  53942. /* 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_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  53943. /* 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_credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  53944. /***/ }),
  53945. /***/ "./resources/js/components/woinfo.vue":
  53946. /*!********************************************!*\
  53947. !*** ./resources/js/components/woinfo.vue ***!
  53948. \********************************************/
  53949. /*! exports provided: default */
  53950. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53951. "use strict";
  53952. __webpack_require__.r(__webpack_exports__);
  53953. /* harmony import */ var _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woinfo.vue?vue&type=template&id=33ce32de& */ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  53954. /* harmony import */ var _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woinfo.vue?vue&type=script&lang=js& */ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  53955. /* 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");
  53956. /* normalize component */
  53957. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  53958. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  53959. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  53960. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  53961. false,
  53962. null,
  53963. null,
  53964. null
  53965. )
  53966. /* hot reload */
  53967. if (false) { var api; }
  53968. component.options.__file = "resources/js/components/woinfo.vue"
  53969. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  53970. /***/ }),
  53971. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  53972. /*!*********************************************************************!*\
  53973. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  53974. \*********************************************************************/
  53975. /*! exports provided: default */
  53976. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53977. "use strict";
  53978. __webpack_require__.r(__webpack_exports__);
  53979. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_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!./woinfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  53980. /* 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_woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  53981. /***/ }),
  53982. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  53983. /*!***************************************************************************!*\
  53984. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  53985. \***************************************************************************/
  53986. /*! exports provided: render, staticRenderFns */
  53987. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  53988. "use strict";
  53989. __webpack_require__.r(__webpack_exports__);
  53990. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___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!./woinfo.vue?vue&type=template&id=33ce32de& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  53991. /* 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_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  53992. /* 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_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  53993. /***/ }),
  53994. /***/ "./resources/js/mixins/dateMixin.js":
  53995. /*!******************************************!*\
  53996. !*** ./resources/js/mixins/dateMixin.js ***!
  53997. \******************************************/
  53998. /*! exports provided: default */
  53999. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54000. "use strict";
  54001. __webpack_require__.r(__webpack_exports__);
  54002. /* harmony default export */ __webpack_exports__["default"] = ({
  54003. methods: {
  54004. treatAsUTC: function treatAsUTC(date) {
  54005. var result = new Date(date);
  54006. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  54007. return result;
  54008. },
  54009. daysSinceToday: function daysSinceToday(date) {
  54010. var currentDate = new Date();
  54011. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  54012. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  54013. },
  54014. getHRDate: function getHRDate(dateString) {
  54015. var date = new Date(dateString);
  54016. var year = date.getFullYear();
  54017. var month = date.toLocaleString('default', {
  54018. month: 'short'
  54019. });
  54020. var day = date.getDate();
  54021. var hour = date.getHours() % 12;
  54022. var minute = date.getMinutes();
  54023. var period = date.getHours() < 24 ? 'AM' : 'PM';
  54024. return month + " " + day + ", " + year + " " + hour + ":" + minute + " " + period;
  54025. },
  54026. isZero: function isZero(dateString) {
  54027. return dateString === '0000-00-00 00:00:00';
  54028. }
  54029. }
  54030. });
  54031. /***/ }),
  54032. /***/ "./resources/js/notify.min.js":
  54033. /*!************************************!*\
  54034. !*** ./resources/js/notify.min.js ***!
  54035. \************************************/
  54036. /*! no static exports found */
  54037. /***/ (function(module, exports, __webpack_require__) {
  54038. 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); }
  54039. (function (e) {
  54040. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  54041. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  54042. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  54043. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  54044. })(function (e) {
  54045. function A(t, n, i) {
  54046. typeof i == "string" && (i = {
  54047. className: i
  54048. }), 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);
  54049. }
  54050. var t = [].indexOf || function (e) {
  54051. for (var t = 0, n = this.length; t < n; t++) {
  54052. if (t in this && this[t] === e) return t;
  54053. }
  54054. return -1;
  54055. },
  54056. n = "notify",
  54057. r = n + "js",
  54058. i = n + "!blank",
  54059. s = {
  54060. t: "top",
  54061. m: "middle",
  54062. b: "bottom",
  54063. l: "left",
  54064. c: "center",
  54065. r: "right"
  54066. },
  54067. o = ["l", "c", "r"],
  54068. u = ["t", "m", "b"],
  54069. a = ["t", "b", "l", "r"],
  54070. f = {
  54071. t: "b",
  54072. m: null,
  54073. b: "t",
  54074. l: "r",
  54075. c: null,
  54076. r: "l"
  54077. },
  54078. l = function l(t) {
  54079. var n;
  54080. return n = [], e.each(t.split(/\W+/), function (e, t) {
  54081. var r;
  54082. r = t.toLowerCase().charAt(0);
  54083. if (s[r]) return n.push(r);
  54084. }), n;
  54085. },
  54086. c = {},
  54087. h = {
  54088. name: "core",
  54089. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  54090. 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}"
  54091. },
  54092. p = {
  54093. "border-radius": ["-webkit-", "-moz-"]
  54094. },
  54095. d = function d(e) {
  54096. return c[e];
  54097. },
  54098. v = function v(e) {
  54099. if (!e) throw "Missing Style name";
  54100. c[e] && delete c[e];
  54101. },
  54102. m = function m(t, i) {
  54103. if (!t) throw "Missing Style name";
  54104. if (!i) throw "Missing Style definition";
  54105. if (!i.html) throw "Missing Style HTML";
  54106. var s = c[t];
  54107. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  54108. var o = "";
  54109. i.classes && e.each(i.classes, function (t, n) {
  54110. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  54111. return p[t] && e.each(p[t], function (e, r) {
  54112. return o += " " + r + t + ": " + n + ";\n";
  54113. }), o += " " + t + ": " + n + ";\n";
  54114. }), o += "}\n";
  54115. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  54116. var u = {},
  54117. a = e(i.html);
  54118. y("html", a, u), y("text", a, u), i.fields = u;
  54119. },
  54120. g = function g(t) {
  54121. var n, r, i;
  54122. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  54123. try {
  54124. r.html(t);
  54125. } catch (s) {
  54126. r[0].styleSheet.cssText = t;
  54127. }
  54128. return r;
  54129. },
  54130. y = function y(t, n, r) {
  54131. var s;
  54132. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  54133. var n;
  54134. n = e(this).attr(s), n || (n = i), r[n] = t;
  54135. });
  54136. },
  54137. b = function b(e, t) {
  54138. return e.is(t) ? e : e.find(t);
  54139. },
  54140. w = {
  54141. clickToHide: !0,
  54142. autoHide: !0,
  54143. autoHideDelay: 5e3,
  54144. arrowShow: !0,
  54145. arrowSize: 5,
  54146. breakNewLines: !0,
  54147. elementPosition: "bottom",
  54148. globalPosition: "top right",
  54149. style: "bootstrap",
  54150. className: "error",
  54151. showAnimation: "slideDown",
  54152. showDuration: 400,
  54153. hideAnimation: "slideUp",
  54154. hideDuration: 200,
  54155. gap: 5
  54156. },
  54157. E = function E(t, n) {
  54158. var r;
  54159. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  54160. },
  54161. S = function S(t) {
  54162. return e.extend(w, t);
  54163. },
  54164. x = function x(t) {
  54165. return e("<" + t + "></" + t + ">");
  54166. },
  54167. T = {},
  54168. N = function N(t) {
  54169. var n;
  54170. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  54171. return e(r).attr("name") === t.attr("name");
  54172. }), t = n.first()), t;
  54173. },
  54174. C = function C(e, t, n) {
  54175. var r, i;
  54176. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  54177. if (isNaN(n)) return;
  54178. 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;
  54179. },
  54180. k = function k(e, t, n) {
  54181. if (e === "l" || e === "t") return 0;
  54182. if (e === "c" || e === "m") return n / 2 - t / 2;
  54183. if (e === "r" || e === "b") return n - t;
  54184. throw "Invalid alignment";
  54185. },
  54186. L = function L(e) {
  54187. return L.e = L.e || x("div"), L.e.text(e).html();
  54188. };
  54189. A.prototype.loadHTML = function () {
  54190. var t;
  54191. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  54192. }, A.prototype.show = function (e, t) {
  54193. var n, r, i, s, o;
  54194. r = function (n) {
  54195. return function () {
  54196. !e && !n.elem && n.destroy();
  54197. if (t) return t();
  54198. };
  54199. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  54200. 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 {
  54201. if (!!o || !!e) return r();
  54202. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  54203. }
  54204. return n.push(r), i[s].apply(i, n);
  54205. }, A.prototype.setGlobalPosition = function () {
  54206. var t = this.getPosition(),
  54207. n = t[0],
  54208. i = t[1],
  54209. o = s[n],
  54210. u = s[i],
  54211. a = n + "|" + i,
  54212. f = T[a];
  54213. if (!f || !document.body.contains(f[0])) {
  54214. f = T[a] = x("div");
  54215. var l = {};
  54216. 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);
  54217. }
  54218. return f.prepend(this.wrapper);
  54219. }, A.prototype.setElementPosition = function () {
  54220. 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;
  54221. 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"];
  54222. for (w = 0, S = B.length; w < S; w++) {
  54223. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  54224. }
  54225. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  54226. if (!this.options.arrowShow) this.arrow.hide();else {
  54227. 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";
  54228. for (E = 0, x = a.length; E < x; E++) {
  54229. D = a[E], P = s[D];
  54230. if (D === L) continue;
  54231. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  54232. }
  54233. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  54234. }
  54235. 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);
  54236. if (r) return this.arrow.removeAttr("style").css(r);
  54237. }, A.prototype.getPosition = function () {
  54238. var e, n, r, i, s, f, c, h;
  54239. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  54240. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  54241. 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";
  54242. return e.length === 2 && (e[2] = e[1]), e;
  54243. }, A.prototype.getStyle = function (e) {
  54244. var t;
  54245. e || (e = this.options.style), e || (e = "default"), t = c[e];
  54246. if (!t) throw "Missing style: " + e;
  54247. return t;
  54248. }, A.prototype.updateClasses = function () {
  54249. var t, n;
  54250. 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) {
  54251. return r + "-" + n.name + "-" + e;
  54252. }).join(" "), this.userContainer.attr("class", t);
  54253. }, A.prototype.run = function (t, n) {
  54254. var r, s, o, u, a;
  54255. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  54256. if (this.container && !t) {
  54257. this.show(!1);
  54258. return;
  54259. }
  54260. if (!this.container && !t) return;
  54261. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  54262. for (o in s) {
  54263. r = s[o], u = this.userFields[o];
  54264. if (!u) continue;
  54265. 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);
  54266. }
  54267. 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));
  54268. }, A.prototype.destroy = function () {
  54269. this.wrapper.data(r, null), this.wrapper.remove();
  54270. }, e[n] = function (t, r, i) {
  54271. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  54272. }, e.fn[n] = function (t, n) {
  54273. return e(this).each(function () {
  54274. var i = N(e(this)).data(r);
  54275. i && i.destroy();
  54276. var s = new A(e(this), t, n);
  54277. }), this;
  54278. }, e.extend(e[n], {
  54279. defaults: S,
  54280. addStyle: m,
  54281. removeStyle: v,
  54282. pluginOptions: w,
  54283. getStyle: d,
  54284. insertCSS: g
  54285. }), m("bootstrap", {
  54286. html: "<div>\n<span data-notify-text></span>\n</div>",
  54287. classes: {
  54288. base: {
  54289. "font-weight": "bold",
  54290. padding: "8px 15px 8px 14px",
  54291. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  54292. "background-color": "#fcf8e3",
  54293. border: "1px solid #fbeed5",
  54294. "border-radius": "4px",
  54295. "white-space": "nowrap",
  54296. "padding-left": "25px",
  54297. "background-repeat": "no-repeat",
  54298. "background-position": "3px 7px"
  54299. },
  54300. error: {
  54301. color: "#B94A48",
  54302. "background-color": "#F2DEDE",
  54303. "border-color": "#EED3D7",
  54304. "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=)"
  54305. },
  54306. success: {
  54307. color: "#468847",
  54308. "background-color": "#DFF0D8",
  54309. "border-color": "#D6E9C6",
  54310. "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==)"
  54311. },
  54312. info: {
  54313. color: "#3A87AD",
  54314. "background-color": "#D9EDF7",
  54315. "border-color": "#BCE8F1",
  54316. "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=)"
  54317. },
  54318. warn: {
  54319. color: "#C09853",
  54320. "background-color": "#FCF8E3",
  54321. "border-color": "#FBEED5",
  54322. "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)"
  54323. }
  54324. }
  54325. }), e(function () {
  54326. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  54327. e(this).trigger("notify-hide");
  54328. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  54329. var n = e(this).data(r);
  54330. n && n.show(!1);
  54331. });
  54332. });
  54333. });
  54334. /***/ }),
  54335. /***/ "./resources/sass/app.scss":
  54336. /*!*********************************!*\
  54337. !*** ./resources/sass/app.scss ***!
  54338. \*********************************/
  54339. /*! no static exports found */
  54340. /***/ (function(module, exports) {
  54341. // removed by extract-text-webpack-plugin
  54342. /***/ }),
  54343. /***/ 0:
  54344. /*!*************************************************************!*\
  54345. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  54346. \*************************************************************/
  54347. /*! no static exports found */
  54348. /***/ (function(module, exports, __webpack_require__) {
  54349. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  54350. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  54351. /***/ })
  54352. /******/ });